SciPy generators
xopt.generators.sequential.neldermead.NelderMeadGenerator ¶
NelderMeadGenerator(**kwargs)
Bases: SequentialGenerator
Nelder-Mead algorithm from SciPy in Xopt's Generator form. Converted to use a state machine to resume in exactly the last state.
Attributes:
name : str The name of the generator. initial_point : Optional[Dict[str, float]] Initial point for the optimization. initial_simplex : Optional[Dict[str, Union[List[float], np.ndarray]]] Initial simplex for the optimization. adaptive : bool Change hyperparameters based on dimensionality. current_state : SimplexState Current state of the simplex. future_state : Optional[SimplexState] Future state of the simplex. x : Optional[np.ndarray] Current x value. y : Optional[float] Current y value.
Methods:
add_data(self, new_data: pd.DataFrame) Add new data to the generator. generate(self, n_candidates: int) -> Optional[List[Dict[str, float]]] Generate a specified number of candidate samples. _call_algorithm(self) Call the Nelder-Mead algorithm. simplex(self) -> Dict[str, np.ndarray] Returns the simplex in the current state.
Source code in xopt/generators/sequential/neldermead.py
126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
Attributes¶
xopt.generators.sequential.neldermead.NelderMeadGenerator.simplex
property
¶
simplex
Returns the simplex in the current state.
Returns:
Dict[str, np.ndarray] The simplex in the current state.
xopt.generators.sequential.neldermead.NelderMeadGenerator.x0
property
¶
x0
Raw internal initial point for convenience. If initial_point is set, it will be used. Otherwise, if data is set, the last point will be used.
Returns:
np.ndarray The initial point as a NumPy array.
xopt.generators.sequential.rcds.RCDSGenerator ¶
RCDSGenerator(**kwargs)
Bases: SequentialGenerator
RCDS algorithm.
Reference: An algorithm for online optimization of accelerators Huang, X., Corbett, J., Safranek, J. and Wu, J. doi: 10.1016/j.nima.2013.05.046
This algorithm must be stepped serially.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Name of the generator. |
x0 |
Optional[list]
|
Initial solution vector. |
init_mat |
Optional[ndarray]
|
Initial direction matrix. |
noise |
PositiveFloat
|
Estimated noise level. |
step |
PositiveFloat
|
Step size for the optimization. |
_ub |
ndarray
|
Upper bounds of the variables. |
_lb |
ndarray
|
Lower bounds of the variables. |
_powell |
PowellMainStateMachine
|
Instance of the PowellMainStateMachine. |
_sign |
int
|
Sign of the objective function (1 for MINIMIZE, -1 for MAXIMIZE). |
Source code in xopt/generator.py
102 103 104 105 106 107 108 |
|
xopt.generators.sequential.extremumseeking.ExtremumSeekingGenerator ¶
ExtremumSeekingGenerator(**kwargs)
Bases: SequentialGenerator
Extremum seeking algorithm.
Reference: Extremum Seeking-Based Control System for Particle Accelerator Beam Loss Minimization A. Scheinker, E. -C. Huang and C. Taylor doi: 10.1109/TCST.2021.3136133
This algorithm must be stepped serially.
Attributes:
name : str The name of the generator. k : PositiveFloat Feedback gain. oscillation_size : PositiveFloat Oscillation size. decay_rate : PositiveFloat Decay rate. _nES : int Number of extremum seeking parameters. _wES : np.ndarray Frequencies for extremum seeking. _dtES : float Time step for extremum seeking. _aES : np.ndarray Amplitudes for extremum seeking. _p_ave : np.ndarray Average of parameter bounds. _p_diff : np.ndarray Difference of parameter bounds. _amplitude : float Amplitude of oscillation. _i : int Evaluation counter. _last_input : np.ndarray Last input values. _last_outcome : float Last outcome value.
Methods:
add_data(self, new_data: pd.DataFrame) Add new data to the generator. p_normalize(self, p: np.ndarray) -> np.ndarray Normalize parameters. p_un_normalize(self, p: np.ndarray) -> np.ndarray Un-normalize parameters. generate(self, n_candidates: int) -> List[Dict[str, float]] Generate a specified number of candidate samples.
Source code in xopt/generators/sequential/extremumseeking.py
82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
Functions¶
xopt.generators.sequential.extremumseeking.ExtremumSeekingGenerator.p_normalize ¶
p_normalize(p)
Normalize parameters.
Parameters:
p : np.ndarray The parameters to normalize.
Returns:
np.ndarray The normalized parameters.
Source code in xopt/generators/sequential/extremumseeking.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
xopt.generators.sequential.extremumseeking.ExtremumSeekingGenerator.p_un_normalize ¶
p_un_normalize(p)
Un-normalize parameters.
Parameters:
p : np.ndarray The parameters to un-normalize.
Returns:
np.ndarray The un-normalized parameters.
Source code in xopt/generators/sequential/extremumseeking.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|