Skip to main content
Version: v0.7.0 beta

Optimization Variable Definition

Optimization variables are quantities that change during the optimization process, such as the steering control input delta, and position states x, y. When defining optimization variables, you can simultaneously define hard bounds, soft bounds, and penalties for violating soft bounds (see Constraint Transformation for the definition of soft constraints in OPTIMake).

Below is an example of defining optimization variables:

delta = prob.variable(name='delta', hard_lowerbound=-0.5, hard_upperbound=0.5)

# xLowerBound and xUpperBound are previously defined parameters
x = prob.variable(
name = 'x',
hard_lowerbound=xLowerBound,
hard_upperbound=xUpperBound,
soft_lowerbound=-0.2,
soft_upperbound=0.2,
weight_soft_lowerbound=100.0,
weight_soft_upperbound=100.0,
penalty_type_soft_lowerbound='quadratic',
penalty_type_soft_upperbound='l1')
y = prob.variable('y')
theta = prob.variable('theta')

The function parameters are defined as follows:

  • name: The name of the optimization variable, string type
  • hard_lowerbound (optional): The hard lower bound of the optimization variable, can be a constant or an expression in terms of parameter pp, default value is -inf, meaning no lower bound
  • hard_upperbound (optional): The hard upper bound of the optimization variable, can be a constant or an expression in terms of parameter pp, default value is inf, meaning no upper bound
  • soft_lowerbound (optional): The soft lower bound of the optimization variable, can be a constant or an expression in terms of parameter pp, default value is -inf, meaning no lower bound
  • soft_upperbound (optional): The soft upper bound of the optimization variable, can be a constant or an expression in terms of parameter pp, default value is inf, meaning no upper bound
  • weight_soft_lowerbound (optional): The penalty weight for the soft lower bound of the optimization variable, must be non-negative, can be a constant or an expression in terms of parameter pp, default value is 0.0, meaning no penalty
  • weight_soft_upperbound (optional): The penalty weight for the soft upper bound of the optimization variable, must be non-negative, can be a constant or an expression in terms of parameter pp, default value is 0.0, meaning no penalty
  • penalty_type_soft_lowerbound (optional): The penalty type for the soft lower bound of the optimization variable, options are 'quadratic' or 'l1', default value is 'quadratic'
  • penalty_type_soft_upperbound (optional): The penalty type for the soft upper bound of the optimization variable, options are 'quadratic' or 'l1', default value is 'quadratic'