least_squares module

Define LeastSquares, a simple and fast optimisation method.

class LeastSquares(*args, **kwargs)

Bases: OptimisationAlgorithm

Plain least-squares method, efficient for small problems.

Notes

Works very well with Envelope1D, has issues converging with TraceWin.

All the attributes but solution are inherited from the Abstract Base Class OptimisationAlgorithm.

supports_constraints: bool = False
__init__(*args, **kwargs) None

Instantiate object.

optimise(keep_history: bool = False, save_history: bool = False) tuple[bool, SetOfCavitySettings | None, OptiInfo]

Set up the optimisation and solve the problem.

Returns:

  • success (bool) – Tells if the optimisation algorithm managed to converge.

  • optimized_cavity_settings (SetOfCavitySettings) – Best solution found by the optimization algorithm.

  • info (dict[str, list[float]]] | None) – Gives list of solutions, corresponding objective, convergence violation if applicable, etc.

property _default_kwargs: dict

Create the kwargs for the optimisation.

_format_variables() tuple[ndarray, Bounds]

Convert the Variable to an array and Bounds.

_output_some_info(objectives_values: dict[str, float]) None

Show the most useful data from scipy’s least_squares.

_abc_impl = <_abc._abc_data object at 0x7fd3c81273c0>