Function programinduction::domains::circuits::make_tasks_advanced
source · pub fn make_tasks_advanced<R: Rng>(
rng: &mut R,
count: u32,
n_input_weights: [u32; 8],
n_gate_weights: [u32; 8],
gate_not: u32,
gate_and: u32,
gate_or: u32,
gate_mux2: u32,
gate_mux4: u32
) -> Vec<impl Task<[bool], Representation = Language, Expression = Expression>>
Expand description
Like make_tasks
, but with a configurable circuit distribution.
This works by randomly constructing Boolean circuits, consisting of some number of inputs and
some number of gates transforming those inputs into final output. The resulting truth table
serves the task’s oracle, providing a log-likelihood of 0.0
for success
and f64::NEG_INFINITY
for failure.
The n_input_weights
and n_gate_weights
arguments specify the relative distributions for the
number of inputs/gates respectively from 1 to 8. The gate_
arguments are relative
weights for sampling the respective logic gate.
Sample circuits which are invalid (i.e. not connected) are rejected.