evolve¶
Evolutionary operations for Neuroevolution fitting.
The selection operation is implicit in cneuromax, see
update_exchange_and_mutate_info() for more details.
- cneuromax.fitting.neuroevolution.utils.evolve.mutate(agents_batch, exchange_and_mutate_info_batch, num_pops)[source]¶
Mutate
agents_batch.- Parameters:
agents_batch (
list[list[BaseAgent]]) – Seeagents_batch.exchange_and_mutate_info_batch (
ndarray[Shape[Len_agents_batch, Num_pops, [mpi_buffer_size, agent_pair_position, sending, seeds]],dtype[uint32]]) – A sub-array ofexchange_and_mutate_infomaintained by this process.
- Return type:
- cneuromax.fitting.neuroevolution.utils.evolve.evaluate_on_cpu(agents_batch, space, curr_gen)[source]¶
Evaluate
agents_batch.- Parameters:
- Return type:
ndarray[Shape[Len_agents_batch, Num_pops, [fitness, num_env_steps]],dtype[float32]]- Returns:
- The output of agent evaluation performed by the process calling
this function on the agents it maintains (
agents_batch). Seeevaluate().
- cneuromax.fitting.neuroevolution.utils.evolve.evaluate_on_gpu(ith_gpu_comm, agents_batch, space, curr_gen, *, transfer)[source]¶
Gather
agents_batchon process subset & evaluate.- Parameters:
ith_gpu_comm (
Comm) – Ampi4pycommunicator used by existing CPU processes to exchange agents for GPU work queueing.agents_batch (
list[list[BaseAgent]]) – Seeagents_batch.transfer (
bool) – Whether any ofenv_transfer,fit_transferormem_transferisTrue.
- Return type:
ndarray[Shape[Len_agents_batch, Num_pops, [fitness, num_env_steps]],dtype[float32]]- Returns:
- The output of agent evaluation by this process. See