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
Number of parameters in the NLP scheme.
Gets the parameters of the NLP scheme.
Gets the parameters of 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)
Examples using csnlp.nlps.HasParameters#
A simple optimization problem: Rosenbrock function
Comparison of CasADi’s and csnlp’s sensitivity computations
A simple example of sensitivity analysis (3d version)