bluemira.equilibria.optimisation.problem._position
Classes
Coilset OptimisationProblem for coil currents and positions |
Module Contents
- class bluemira.equilibria.optimisation.problem._position.CoilsetPositionCOP(eq: bluemira.equilibria.equilibrium.Equilibrium, targets: bluemira.equilibria.optimisation.constraints.MagneticConstraintSet | None, position_mapper: bluemira.utilities.positioning.PositionMapper, max_currents: numpy.typing.ArrayLike | None = None, gamma=1e-08, opt_algorithm: bluemira.optimisation.AlgorithmType = Algorithm.SBPLX, opt_conditions: dict[str, float] | None = None, opt_parameters: dict[str, float] | None = None, constraints: list[bluemira.equilibria.optimisation.constraints.UpdateableConstraint] | None = None)
Bases:
bluemira.equilibria.optimisation.problem.base.EqCoilsetOptimisationProblemCoilset OptimisationProblem for coil currents and positions subject to maximum current bounds and positions bounded within a provided region.
Coil currents and positions are optimised simultaneously.
- Parameters:
eq (bluemira.equilibria.equilibrium.Equilibrium) – Equilibrium object (used to update magnetic field targets) with Coilset to optimise.
targets (bluemira.equilibria.optimisation.constraints.MagneticConstraintSet | None) – Set of magnetic field targets to use in objective function.
position_mapper (bluemira.utilities.positioning.PositionMapper) – Position mappings of coil regions
max_currents (numpy.typing.ArrayLike | None) – Maximum allowed current for each independent coil current in coilset [A]. If specified as a float, the float will set the maximum allowed current for all coils.
gamma – Tikhonov regularisation parameter in units of [A⁻¹].
opt_algorithm (bluemira.optimisation.AlgorithmType) – The optimisation algorithm to use (e.g. SLSQP)
opt_conditions (dict[str, float] | None) – The stopping conditions for the optimiser. for defaults see
AlgorithDefaultTolerancesalong with max_eval=100opt_parameters (dict[str, float] | None) – Optimiser specific parameters, see https://nlopt.readthedocs.io/en/latest/NLopt_Reference/#algorithm-specific-parameters Otherwise, the parameters can be founded by digging through the source code.
constraints (list[bluemira.equilibria.optimisation.constraints.UpdateableConstraint] | None) – List of optimisation constraints to apply to the optimisation problem
Notes
Setting stopval and maxeval is the most reliable way to stop optimisation at the desired figure of merit and number of iterations respectively. Some NLOpt optimisers display unexpected behaviour when setting xtol and ftol, and may not terminate as expected when those criteria are reached.
- position_mapper
- bounds
- gamma = 1e-08
- optimise(x0: numpy.typing.NDArray | None = None, *, keep_history: bool = False, check_constraints: bool = False, **_) bluemira.equilibria.optimisation.problem.base.CoilsetOptimiserResult
Run the optimisation.
- Return type:
The result of the optimisation.
- Parameters:
x0 (numpy.typing.NDArray | None)
keep_history (bool)
check_constraints (bool)
- objective(vector: numpy.typing.NDArray[numpy.float64]) float
Least-squares objective with Tikhonov regularisation term.
- Parameters:
vector (numpy.typing.NDArray[numpy.float64]) – The new coilset state vector.
- Return type:
The figure of merit being minimised.
- get_mapped_state_bounds(max_currents: numpy.typing.ArrayLike | None = None) tuple[numpy.ndarray, numpy.ndarray]
Get mapped bounds on the coilset state vector from the coil regions and maximum coil currents.
- Parameters:
max_currents (numpy.typing.ArrayLike | None) – Maximum allowed current for each independent coil current in coilset [A]. If specified as a float, the float will set the maximum allowed current for all coils.
- Returns:
bounds – Array containing state vectors representing lower and upper bounds for coilset state degrees of freedom.
- Return type:
np.array