Funccem
cem(*, center_init, parenthood_ratio, objective_sense, stdev_init=None, radius_init=None, stdev_min=None, stdev_max=None, stdev_max_change=None)
¶
Get an initial state for the cross entropy method (CEM).
The received initial state, a named tuple of type CEMState
, is to be
passed to the function cem_ask(...)
to receive the solutions belonging
to the first generation of the evolutionary search.
References:
Rubinstein, R. (1999). The cross-entropy method for combinatorial
and continuous optimization.
Methodology and computing in applied probability, 1(2), 127-190.
Duan, Y., Chen, X., Houthooft, R., Schulman, J., Abbeel, P. (2016).
Benchmarking deep reinforcement learning for continuous control.
International conference on machine learning. PMLR, 2016.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
center_init
|
BatchableVector
|
Center (i.e. mean) of the initial search distribution.
Expected as a PyTorch tensor with at least 1 dimension.
If the given |
required |
stdev_init
|
Optional[Union[float, BatchableVector]]
|
Standard deviation of the initial search distribution.
If this is given as a scalar |
None
|
radius_init
|
Optional[Union[float, BatchableScalar]]
|
Radius for the initial search distribution, representing
the euclidean norm for the first standard deviation vector.
Setting this value as |
None
|
parenthood_ratio
|
float
|
Proportion of the solutions that will be chosen as the parents for the next generation. For example, if this is given as 0.5, the top 50% of the solutions will be chosen as parents. |
required |
objective_sense
|
str
|
Expected as a string, either as 'min' or as 'max'. Determines if the goal is to minimize or is to maximize. |
required |
stdev_min
|
Optional[Union[float, BatchableVector]]
|
Minimum allowed standard deviation for the search distribution. Can be given as a scalar or as a tensor with one or more dimensions. When given with at least 2 dimensions, the extra leftmost dimensions will be interpreted as batch dimensions. |
None
|
stdev_max
|
Optional[Union[float, BatchableVector]]
|
Maximum allowed standard deviation for the search distribution. Can be given as a scalar or as a tensor with one or more dimensions. When given with at least 2 dimensions, the extra leftmost dimensions will be interpreted as batch dimensions. |
None
|
stdev_max_change
|
Optional[Union[float, BatchableVector]]
|
Maximum allowed change for the standard deviation
vector. If this is given as a scalar, this scalar will serve as a
limiter for the change of the entire standard deviation vector.
For example, a scalar value of 0.2 means that the elements of the
standard deviation vector cannot change more than the 20% of their
original values. If this is given as a vector (i.e. as a
1-dimensional tensor), each element of |
None
|
Source code in evotorch/algorithms/functional/funccem.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
cem_ask(state, *, popsize)
¶
Obtain a population from cross entropy method, given the state.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
CEMState
|
The current state of the cross entropy method search. |
required |
popsize
|
int
|
Number of solutions to be generated for the requested population. |
required |
Source code in evotorch/algorithms/functional/funccem.py
cem_tell(state, values, evals)
¶
Given the old state and the evals (fitnesses), obtain the next state.
From this state tuple, the center point of the search distribution can be
obtained via the field .center
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
CEMState
|
The old state of the cross entropy method search. |
required |
values
|
Tensor
|
The most recent population, as a PyTorch tensor. |
required |
evals
|
Tensor
|
Evaluation results (i.e. fitnesses) for the solutions expressed
by |
required |