Problem Class#

class evox.Problem[source]#

Base class for all problems

__init__()#
evaluate(state, pop)[source]#

Evaluate the fitness at given points

Parameters:
  • state (dict) – The state of this problem.

  • X (ndarray) – The population.

  • pop (Array | Any)

Returns:

  • dict – The new state of the problem.

  • ndarray – The fitness.

Return type:

Tuple[Array, State]

init(key=None, no_state=False, re_init=False)#

Initialize this module and all submodules

This method should not be overwritten.

Parameters:
  • key (Array | None) – A PRNGKey.

  • no_state (bool)

  • re_init (bool)

Returns:

The state of this module and all submodules combined.

Return type:

State

parallel_init(key, num_copies, no_state=False)#

Initialize multiple copies of this module in parallel

This method should not be overwritten.

Parameters:
  • key (Array) – A PRNGKey.

  • num_copies (int) – The number of copies to be initialized

  • no_state (bool) – Whether to skip the state initialization

Returns:

The state of this module and all submodules combined, and the last node_id

Return type:

Tuple[State, int]

setup(key)#

Setup mutable state here

The state it self is immutable, but it act as a mutable state by returning new state each time.

Parameters:

key (Array) – A PRNGKey.

Returns:

The state of this module.

Return type:

State