# Optimisation with polynomials#

Perform unconstrained or constrained optimisation.

This class performs unconstrained or constrained optimisation of poly objects or custom functions using scipy.optimize.minimize or an in-house trust-region method.

Parameters

method (str) – A string specifying the method that will be used for optimisation. Any of the methods available from scipy.optimize.minimize can be chosen. In the case of general constrained optimisation, the options are COBYLA, SLSQP, and trust-constr. The in-house options trust-region and omorf are also available.

Adds bounds $$lb <= x <=ub$$ to the optimisation problem. Only L-BFGS-B, TNC, SLSQP, trust-constr, trust-region, and COBYLA methods can handle bounds.

Parameters
• lb (numpy.ndarray) – 1-by-n matrix that contains lower bounds of x.

• ub (numpy.ndarray) – 1-by-n matrix that contains upper bounds of x.

Adds linear equality constraints $$Ax = b$$ to the optimisation routine. Only trust-constr and SLSQP methods can handle equality constraints.

Parameters
• A (numpy.ndarray) – An (M, n) matrix that contains coefficients of the linear equality constraints.

• b (numpy.ndarray) – An (M, 1) matrix that specifies right hand side of the linear equality constraints.

Adds linear inequality constraints $$b_l <= A x <= b_u$$ to the optimisation problem. Only trust-constr, COBYLA, and SLSQP methods can handle general constraints.

Parameters
• A (numpy.ndarray) – An (M,n) matrix that contains coefficients of the linear inequality constraints.

• b_l (numpy.ndarray) – An (M,1) matrix that specifies lower bounds of the linear inequality constraints. If there is no lower bound, set b_l = -np.inf * np.ones(M).

• b_u (numpy.ndarray) – An (M,1) matrix that specifies upper bounds of the linear inequality constraints. If there is no upper bound, set b_u = np.inf * np.ones(M).

Adds nonlinear inequality constraints $$g(x) = value$$ (for poly option) or $$g(x) = 0$$ (for function option) to the optimisation routine.

Only trust-constr and SLSQP methods can handle equality constraints. If poly object is provided in the poly dictionary, gradients and Hessians will be computed automatically.

Parameters
• poly (dict, optional) –

Dictionary containing a Poly and value for constraints:

• poly (Poly): An instance of the Poly class.

• value (float): Value of the nonlinear constraint.

• custom (dict, optional) –

Dictionary containing additional custom callable arguments:

• function (Callable): The constraint function to be called.

• jac_function (Callable, optional): The gradient (or derivative) of the constraint.

• hess_function (Callable, optional): The Hessian of the constraint function.

Adds nonlinear inequality constraints $$lb <= g(x) <= ub$$ (for poly option) with $$lb$$, $$ub = bounds$$ or $$g(x) >= 0$$ (for function option) to the optimisation problem.

Only trust-constr, COBYLA, and SLSQP methods can handle general constraints. If Poly object is provided in the poly dictionary, gradients and Hessians will be computed automatically. If a lambda function is provided via function dictionary, the user may also provide jac_function for gradients and hess_function for Hessians; otherwise, a 2-point differentiation rule will be used to approximate the derivative and a BFGS update will be used to approximate the Hessian.

Parameters
• poly (dict, optional) –

Dictionary containing a Poly and bounds for constraints:

• poly (Poly): An instance of the Poly class.

• bounds (numpy.ndarray): An array with two entries specifying the lower and upper bounds of the inequality. If there is no lower bound, set bounds = -np.inf. If there is no upper bound, set bounds = np.inf.

• custom (dict, optional) –

Dictionary containing additional custom callable arguments:

• function (Callable): The constraint function to be called.

• jac_function (Callable, optional): The gradient (or derivative) of the constraint.

• hess_function (Callable, optional): The Hessian of the constraint function.

Adds objective function to be optimised.

Parameters
• poly (Poly) – A Poly object.

• custom (dict, optional) –

Dictionary containing optional arguments:

• function (Callable): The objective function to be called.

• jac_function (Callable, optional): The gradient (or derivative) of the objective.

• hess_function (Callable, optional): The Hessian of the objective function.

• maximise (bool, optional) – A flag to specify if the user would like to maximise the function instead of minimising it.

optimise(x0, *args, **kwargs)[source]#

Performs optimisation on a specified function, provided the objective has been added using :meth:’~equadratures.optimisation.add_objective’ and constraints have been added using the relevant method.

Parameters
• x0 (numpy.ndarray) – Starting point for optimiser.

• del_k (float) – Initial trust-region radius for trust-region or omorf methods

• delmin (float) – Minimum allowable trust-region radius for trust-region or omorf methods

• delmax (float) – Maximum allowable trust-region radius for trust-region or omorf methods

• d (int) – Reduced dimension for omorf method

• subspace_method (str) – Subspace method for omorf method with options variable-projection or active-subspaces

Returns

A dictionary containing the optimisation result. Important attributes are: the solution array x, and a Boolean flag success indicating if the optimiser exited successfully.

Return type

dict