opytimizer.core.agent

Agent.

class opytimizer.core.agent.Agent(n_variables: int, n_dimensions: int, lower_bound: List[Union[int, float]], upper_bound: List[Union[int, float]], mapping: Optional[List[str]] = None)

An Agent class for all optimization techniques.

__init__(n_variables: int, n_dimensions: int, lower_bound: List[Union[int, float]], upper_bound: List[Union[int, float]], mapping: Optional[List[str]] = None) → None

Initialization method.

Parameters:
  • n_variables – Number of decision variables.
  • n_dimensions – Number of dimensions.
  • lower_bound – Minimum possible values.
  • upper_bound – Maximum possible values.
  • mapping – String-based identifiers for mapping variables’ names.
n_variables

Number of decision variables.

n_dimensions

Number of dimensions.

position

N-dimensional array of positions.

fit

Fitness value.

Type:float
lb

Lower bounds.

ub

Upper bounds.

ts

Timestamp of the agent.

mapping

Variables mapping.

mapped_position

Dictionary mapping variables names and array of positions.

clip_by_bound() → None

Clips the agent’s decision variables to the bounds limits.

fill_with_binary() → None

Fills the agent’s decision variables with a binary distribution.

fill_with_static(values: numpy.ndarray) → None

Fills the agent’s decision variables with static values. Note that this method ignore the agent’s bounds, so use it carefully.

Parameters:values – Values to be filled.
fill_with_uniform() → None

Fills the agent’s decision variables with a uniform distribution based on bounds limits.