csnlp.nlps.HasParameters#

class csnlp.nlps.HasParameters(sym_type='SX')[source]#

Bases: Generic[SymType]

Class for the creation and storage of symbolic parameters in an NLP problem.

Parameters:
sym_type{“SX”, “MX”}, optional

The CasADi symbolic variable type to use in the NLP, by default "SX".

Methods

parameter(name[, shape])

Adds a parameter to the NLP scheme.

Attributes

np

Number of parameters in the NLP scheme.

p

Gets the parameters of the NLP scheme.

parameters

Gets the parameters of the NLP scheme.

property np: int#

Number of parameters in the NLP scheme.

property p: SymType#

Gets the parameters of the NLP scheme.

parameter(name, shape=(1, 1))[source]#

Adds a parameter to the NLP scheme.

Parameters:
namestr

Name of the new parameter. Must not be already in use.

shapetuple of 2 ints, optional

Shape of the new parameter. By default a scalar, i.e., (1, 1).

Returns:
casadi.SX or MX

The symbol for the new parameter.

Raises:
ValueError

Raises if there is already another parameter with the same name name.

Return type:

TypeVar(SymType, SX, MX)

property parameters: dict[str, SymType]#

Gets the parameters of the NLP scheme.

Examples using csnlp.nlps.HasParameters#

A simple optimization problem: hanging chain

A simple optimization problem: hanging chain

A mixed integer linear programming example

A mixed integer linear programming example

A simple problem with multiple minima

A simple problem with multiple minima

Linear MPC control

Linear MPC control

MPC controller for PWA systems

MPC controller for PWA systems

Multiple Scenario MPC

Multiple Scenario MPC

Simple open-loop MPC controller

Simple open-loop MPC controller

Scenario-based MPC

Scenario-based MPC

A simple optimization problem: Rosenbrock function

A simple optimization problem: Rosenbrock function

How scaling can help convergence

How scaling can help convergence

Comparison of CasADi’s and csnlp’s sensitivity computations

Comparison of CasADi's and csnlp's sensitivity computations

A simple example of sensitivity analysis

A simple example of sensitivity analysis

A simple example of sensitivity analysis (3d version)

A simple example of sensitivity analysis (3d version)