Initializing help system before first use

Variable

A reference to a variable. More...

Inheritance diagram for xpress::objects::Variable:
xpress::objects::Expression xpress::objects::Index

Public Member Functions

auto  absOf (Variable x) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the absolute value of x.
 
template<typename Strm0 , is-stream(Strm0) >
auto  andOf (Strm0 const &variables) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the and of the specified arguments.
 
template<typename Strm0 , is-stream(Strm0) >
auto  andOf (Strm0 const &variables, std::optional< std::string > name) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the and of the specified arguments.
 
template<typename... VARIABLES, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<Variable, VARIABLES...>::value>::type>
auto  andOf (VARIABLES... variables) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the and of the specified other variables.
 
auto  chgCoef (Inequality r, double newCoef) -> void
  Change the coefficient for this variable in a row.
 
auto  chgCoefs (xpress::SizedArray< Inequality const > const &r, xpress::SizedArray< double const > const &newCoef) -> void
  Change the coefficients for this variable in multiple rows.
 
auto  chgObj (double newCoef) -> Variable &
  Change objective coefficient for this variable.
 
auto  chgObjN (int objidx, double newCoef) -> Variable &
  Change objective coefficient for this variable.
 
virtual auto  compareTo (Variable const &other) const -> int final
 
auto  div (ConstantExpression arg) const -> xpress::objects::LinTerm
  Create a expression that represents the quotient of this and arg.
 
virtual auto  div (double arg) const -> xpress::objects::Expression override
  Create a expression that represents the quotient of this and arg.
Parameters
arg Divisor.
Returns
Quotient of this and arg.
Since
44.00

 
virtual auto  div (xpress::objects::Expression arg) const -> xpress::objects::Expression override
  Create a expression that represents the quotient of this and arg.
Parameters
arg Divisor.
Returns
Quotient of this and arg.
Since
44.00

 
virtual auto  eq (double rhs) const -> xpress::objects::InequalityDefinition override
  Create an "equals" constraint with this expression as left-hand side.Examples using eq:

Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00
Examples using eq:
 
virtual auto  eq (Expression const &rhs) const -> xpress::objects::InequalityDefinition override
  Create an "equals" constraint with this expression as left-hand side.Examples using eq:

Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00
Examples using eq:
 
virtual auto  evaluate (xpress::SizedArray< double const > const &solution) const -> double override
  Compute the value of this expression with respect to the given solution vector (which is not required to be feasible).Examples using evaluate:

Parameters
solution Solution values for which the expression is evaluated.
Returns
The value of this expression evaluated at solution.
Since
44.00
Examples using evaluate:
 
auto  fix (double value) -> Variable &
  Fix this variable to a value.
 
virtual auto  geq (double rhs) const -> xpress::objects::InequalityDefinition override
  Create a "greater than or equal" constraint with this expression as left-hand side.
Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00

 
virtual auto  geq (Expression const &rhs) const -> xpress::objects::InequalityDefinition override
  Create a "greater than or equal" constraint with this expression as left-hand side.
Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00

 
auto  getCallbackRedCost () -> double
  Get reduced cost value for this variable from the solution associated with the current callback.
 
auto  getCallbackSolution () -> double
  Get value for this variable from the solution associated with the current callback.
 
virtual auto  getHashCode () const -> std::size_t final
 
auto  getIndex () const -> int override
  Get the index that this object has in the underlying model.Attention: this is a very advanced function. Use it only if you know exactly what you are doing.
Returns
The index of this object in the underlying model.
Since
44.00

 
auto  getIndexForProb (XpressProblem const *xprob) const -> int override
  Get the index stored in this object but raise an exception if the problem that created this object is not prob.
Parameters
xprob The problem for which the index is queried. If this object does not belong to prob then an execption is raised.
Returns
The low-level index for this object in prob.
Since
44.00

 
auto  getLB () const -> double
  Get the lower bound for this variable.
 
auto  getName () const -> std::string override
  Get the name of this object.Queries the problem instance that owns this object and returns the name from that instance.Examples using getName:

Returns
The name of this object.
Since
44.00
Examples using getName:
 
auto  getObj () const -> double
  Get objective coefficient for this variable.
 
auto  getObjN (int objIdx) const -> double
  Get objective coefficient for this variable.
 
auto  getProblem () const -> xpress::objects::XpressProblem *override
  Get the problem to which this element belongs.
Returns
The problem to which this element belongs. This will be nullptr if the element was deleted.
Since
44.00

 
auto  getRedCost () const -> double
  Get the current reduced cost value for this variable.
 
auto  getSolution () const -> double
  Get the current solution value for this variable.
 
auto  getType () const -> xpress::ColumnType
  Get the type for this variable.
 
auto  getUB () const -> double
  Get the upper bound for this variable.
 
auto  getValue (xpress::SizedArray< double const > const &data) const -> double
  Get the value of this variable from an array.
 
auto  ifNotThen (InequalityDefinition implied) const -> xpress::objects::IndicatorDescription
  Create an indicator constraint with this variable as indicator variable.
 
auto  ifThen (InequalityDefinition implied) const -> xpress::objects::IndicatorDescription
  Create an indicator constraint with this variable as indicator variable.
 
virtual auto  in (double lb, double ub) -> xpress::objects::InequalityDefinition override
  Create a range constraint that bounds this expression from below and above.Examples using in:

Parameters
lb Lower bound for this expression.
ub Upper bound for this expression.
Returns
The constraint.
Since
44.00
Examples using in:
 
virtual auto  leq (double rhs) const -> xpress::objects::InequalityDefinition override
  Create a "less than or equal" constraint with this expression as left-hand side.Examples using leq:

Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00
Examples using leq:
 
virtual auto  leq (Expression const &rhs) const -> xpress::objects::InequalityDefinition override
  Create a "less than or equal" constraint with this expression as left-hand side.Examples using leq:

Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00
Examples using leq:
 
template<typename Strm0 , typename Strm1 , is-stream(Strm0) , is-stream(Strm1) >
auto  maxOf (Strm0 const &variables, Strm1 const &values) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the maximum of the specified arguments.
 
template<typename Strm0 , typename Strm1 , is-stream(Strm0) , is-stream(Strm1) >
auto  maxOf (Strm0 const &variables, Strm1 const &values, std::optional< std::string > name) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the maximum of the specified arguments.
 
template<typename... VARIABLES, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<Variable, VARIABLES...>::value>::type>
auto  maxOf (VARIABLES... variables) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the maximum of the specified other variables.
 
template<typename... VALUES, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<double, VALUES...>::value>::type>
auto  maxOf (xpress::SizedArray< Variable const > const &variables, VALUES... values) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the maximum of the specified other variables and values.
 
template<typename Strm0 , typename Strm1 , is-stream(Strm0) , is-stream(Strm1) >
auto  minOf (Strm0 const &variables, Strm1 const &values) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the minimum of the specified arguments.
 
template<typename Strm0 , typename Strm1 , is-stream(Strm0) , is-stream(Strm1) >
auto  minOf (Strm0 const &variables, Strm1 const &values, std::optional< std::string > name) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the minimum of the specified arguments.
 
template<typename... VARIABLES, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<Variable, VARIABLES...>::value>::type>
auto  minOf (VARIABLES... variables) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the minimum of the specified other variables.
 
template<typename... VALUES, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<double, VALUES...>::value>::type>
auto  minOf (xpress::SizedArray< Variable const > const &variables, VALUES... values) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the minimum of the specified other variables and values.
 
auto  mul (ConstantExpression arg) const -> xpress::objects::LinTerm
  Create a expression that represents the product of this and arg.
 
virtual auto  mul (double arg) const -> xpress::objects::Expression override
  Create a expression that represents the product of this and arg.Examples using mul:

Parameters
arg Factor.
Returns
Product of this and arg.
Since
44.00
Examples using mul:
 
virtual auto  mul (Expression arg) const -> xpress::objects::Expression override
  Create a expression that represents the product of this and arg.Examples using mul:

Parameters
arg Factor.
Returns
Product of this and arg.
Since
44.00
Examples using mul:
 
auto  mul (LinTerm arg) const -> xpress::objects::QuadTerm
  Create a expression that represents the product of this and arg.
 
auto  mul (Variable arg) const -> xpress::objects::QuadTerm
  Create a expression that represents the product of this and arg.
 
template<typename Strm0 , is-stream(Strm0) >
auto  orOf (Strm0 const &variables) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the or of the specified arguments.
 
template<typename Strm0 , is-stream(Strm0) >
auto  orOf (Strm0 const &variables, std::optional< std::string > name) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the or of the specified arguments.
 
template<typename... VARIABLES, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<Variable, VARIABLES...>::value>::type>
auto  orOf (VARIABLES... variables) const -> xpress::objects::GeneralConstraintDefinition
  Create a constraint that requires this variable to be the or of the specified other variables.
 
template<typename... BREAKPOINTS, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<xpress::PwlBreakpoint, BREAKPOINTS...>::value>::type>
auto  pwlOf (Variable input, BREAKPOINTS... breakpoints) const -> xpress::objects::PWLDefinition
  Create a piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
 
template<typename Strm0 , is-stream(Strm0) >
auto  pwlOf (Variable input, Strm0 const &breakpoints) const -> xpress::objects::PWLDefinition
  Create a piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
 
template<typename Strm0 , is-stream(Strm0) >
auto  pwlOf (Variable input, Strm0 const &breakpoints, std::optional< std::string > name) const -> xpress::objects::PWLDefinition
  Create a piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
 
auto  pwlOf (Variable input, xpress::SizedArray< double const > const &xval, xpress::SizedArray< double const > const &yval) const -> xpress::objects::PWLDefinition
  Create a piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by xval/yval evaluated for input.
 
auto  pwlOf (Variable input, xpress::SizedArray< double const > const &xval, xpress::SizedArray< double const > const &yval, std::optional< std::string > name) const -> xpress::objects::PWLDefinition
  Create a piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by xval/yval evaluated for input.
 
auto  setLB (double newLB) -> Variable &
  Set the lower bound for this variable.
 
auto  setLimit (double newLimit) -> Variable &
  Set the limit for this variable.
 
auto  setName (std::optional< std::string > newName) -> Variable &
  Set the name of this variable.
 
auto  setType (xpress::ColumnType newType) -> Variable &
  Set the type for this variable.
 
auto  setUB (double newUB) -> Variable &
  Set the upper bound for this variable.
 
auto  square () -> xpress::objects::QuadTerm
  Create a quadratic term by multiplying this variable with itself.
 
virtual auto  toString () const -> std::string override
  Returns the name from getName().
 
virtual auto  uminus () const -> xpress::objects::Expression override
  Create a expression that represents the unary minus of this one.
Returns
Expression representing -this.
Since
44.00

 
 Public Member Functions inherited from xpress::objects::Expression
virtual auto  minus (double arg) const -> xpress::objects::Expression
  Create a expression that represents the difference of this and arg.
 
virtual auto  minus (xpress::objects::Expression arg) const -> xpress::objects::Expression
  Create a expression that represents the difference of this and arg.
 
virtual auto  plus (double arg) const -> xpress::objects::Expression
  Create a expression that represents the sum of this and arg.
 
virtual auto  plus (xpress::objects::Expression arg) const -> xpress::objects::Expression
  Create a expression that represents the sum of this and arg.
 
 Public Member Functions inherited from xpress::objects::Index

Detailed Description

A reference to a variable.

Since
44.00

Member Function Documentation

absOf()

auto xpress::objects::Variable::absOf ( Variable x ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the absolute value of x.

Examples using absOf:

Parameters
x Argument for the absolute value constraint.
Returns
this = abs(x).
Since
44.00

andOf() [1/3]

template<typename Strm0 , typename Strm0IsStream >
auto xpress::objects::Variable::andOf ( Strm0 const & variables ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the and of the specified arguments.

Examples using andOf:

Parameters
variables Variables in the and constraint.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type Variable.
Returns
this = and(variables, value).
Since
44.00

andOf() [2/3]

template<typename Strm0 , typename Strm0IsStream >
auto xpress::objects::Variable::andOf ( Strm0 const & variables,
std::optional< std::string > name ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the and of the specified arguments.

Examples using andOf:

Parameters
variables Variables in the and constraint.
name Constraint name, can be std::nullopt to indicate the constraint has no name.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type Variable.
Returns
this = and(variables, value).
Since
44.00

andOf() [3/3]

template<typename... VARIABLES, typename RestrictPack >
auto xpress::objects::Variable::andOf ( VARIABLES... variables ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the and of the specified other variables.

Examples using andOf:

Parameters
variables Variables in the and constraint.
Returns
this = and(variables).
Since
44.00

chgCoef()

auto xpress::objects::Variable::chgCoef ( Inequality r,
double newCoef ) -> void
inline

Change the coefficient for this variable in a row.

Examples using chgCoef:

Parameters
r Inequality for which to change the coefficient.
newCoef New coefficient.
Since
44.00

chgCoefs()

auto xpress::objects::Variable::chgCoefs ( xpress::SizedArray< Inequality const > const & r,
xpress::SizedArray< double const > const & newCoef ) -> void
inline

Change the coefficients for this variable in multiple rows.

Parameters
r Inequalities for which to change the coefficient.
newCoef New coefficients.
Since
44.00

chgObj()

auto xpress::objects::Variable::chgObj ( double newCoef ) -> Variable&
inline

Change objective coefficient for this variable.

Examples using chgObj:

Parameters
newCoef New objective coefficient.
Returns
Always returns this instance.
Since
44.00

chgObjN()

auto xpress::objects::Variable::chgObjN ( int objidx,
double newCoef ) -> Variable&
inline

Change objective coefficient for this variable.

Parameters
objidx Index of objective function to change.
newCoef New objective coefficient.
Returns
Always returns this instance.
Since
44.00

compareTo()

auto xpress::objects::Variable::compareTo ( Variable const & other ) const -> int
inlinefinalvirtual

Since
44.00

div() [1/3]

auto xpress::objects::Variable::div ( ConstantExpression arg ) const -> xpress::objects::LinTerm
inline

Create a expression that represents the quotient of this and arg.

Parameters
arg Divisor.
Returns
The expression.
Since
44.00

div() [2/3]

auto xpress::objects::Variable::div ( double arg ) const -> xpress::objects::Expression
inlineoverridevirtual

Create a expression that represents the quotient of this and arg.

Parameters
arg Divisor.
Returns
Quotient of this and arg.
Since
44.00

Since
44.00

Reimplemented from xpress::objects::Expression.

div() [3/3]

auto xpress::objects::Variable::div ( xpress::objects::Expression arg ) const -> xpress::objects::Expression
inlineoverridevirtual

Create a expression that represents the quotient of this and arg.

Parameters
arg Divisor.
Returns
Quotient of this and arg.
Since
44.00

Since
44.00

Reimplemented from xpress::objects::Expression.

eq() [1/2]

auto xpress::objects::Variable::eq ( double rhs ) const -> xpress::objects::InequalityDefinition
inlineoverridevirtual

Create an "equals" constraint with this expression as left-hand side.Examples using eq:

Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00
Examples using eq:

Since
44.00

Reimplemented from xpress::objects::Expression.

eq() [2/2]

auto xpress::objects::Variable::eq ( Expression const & rhs ) const -> xpress::objects::InequalityDefinition
inlineoverridevirtual

Create an "equals" constraint with this expression as left-hand side.Examples using eq:

Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00
Examples using eq:

Since
44.00

Reimplemented from xpress::objects::Expression.

evaluate()

auto xpress::objects::Variable::evaluate ( xpress::SizedArray< double const > const & solution ) const -> double
inlineoverridevirtual

Compute the value of this expression with respect to the given solution vector (which is not required to be feasible).Examples using evaluate:

Parameters
solution Solution values for which the expression is evaluated.
Returns
The value of this expression evaluated at solution.
Since
44.00
Examples using evaluate:

Parameters
solution Solution values for which the expression is evaluated.
Since
44.00

Reimplemented from xpress::objects::Expression.

fix()

auto xpress::objects::Variable::fix ( double value ) -> Variable&
inline

Fix this variable to a value.

Set the lower bound and upper bound in the XpressProblem instance to which this variable belongs.

Examples using fix:

Parameters
value New lower and upper bound.
Returns
This variable
Since
44.00

geq() [1/2]

auto xpress::objects::Variable::geq ( double rhs ) const -> xpress::objects::InequalityDefinition
inlineoverridevirtual

Create a "greater than or equal" constraint with this expression as left-hand side.

Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00

Since
44.00

Reimplemented from xpress::objects::Expression.

geq() [2/2]

auto xpress::objects::Variable::geq ( Expression const & rhs ) const -> xpress::objects::InequalityDefinition
inlineoverridevirtual

Create a "greater than or equal" constraint with this expression as left-hand side.

Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00

Since
44.00

Reimplemented from xpress::objects::Expression.

getCallbackRedCost()

auto xpress::objects::Variable::getCallbackRedCost ( ) -> double
inline

Get reduced cost value for this variable from the solution associated with the current callback.

Note: This functions uses xpress::XPRSProblem#getCallbackRedCosts(bool *, Array<double> const &, int, int) const under the hood.

Note: Calling this function for multiple variables is not efficient. If you need to get values for multiple variables then consider using xpress::objects::XpressProblem#getCallbackRedCosts() const to get the values for all variables and then use getValue(SizedArray<double const> const &) const to extract the value for a particular variable.

Returns
Reduced cost for this variable.
Since
44.00

getCallbackSolution()

auto xpress::objects::Variable::getCallbackSolution ( ) -> double
inline

Get value for this variable from the solution associated with the current callback.

Note: This functions uses xpress::XPRSProblem#getCallbackSolution(bool *, Array<double> const &, int, int) const under the hood.

Note: Calling this function for multiple variables is not efficient. If you need to get values for multiple variables then consider using xpress::objects::XpressProblem#getCallbackSolution() const to get the values for all variables and then use getValue(SizedArray<double const> const &) const to extract the value for a particular variable.

Examples using getCallbackSolution:

Returns
Solution value for this variable.
Since
44.00

getHashCode()

auto xpress::objects::Variable::getHashCode ( ) const -> std::size_t
inlinefinalvirtual
Since
44.00

getIndex()

auto xpress::objects::Variable::getIndex ( ) const -> int
inlineoverridevirtual

Get the index that this object has in the underlying model.Attention: this is a very advanced function. Use it only if you know exactly what you are doing.

Returns
The index of this object in the underlying model.
Since
44.00

Since
44.00

Implements xpress::objects::Index.

getIndexForProb()

auto xpress::objects::Variable::getIndexForProb ( XpressProblem const * xprob ) const -> int
inlineoverridevirtual

Get the index stored in this object but raise an exception if the problem that created this object is not prob.

Parameters
xprob The problem for which the index is queried. If this object does not belong to prob then an execption is raised.
Returns
The low-level index for this object in prob.
Since
44.00

Since
44.00

Implements xpress::objects::Index.

getLB()

auto xpress::objects::Variable::getLB ( ) const -> double
inline

Get the lower bound for this variable.

Queries the xpress::objects::XpressProblem instance to which this variable belongs and returns the lower bound obtained from that instance.

Since
44.00

getName()

auto xpress::objects::Variable::getName ( ) const -> std::string
inlineoverridevirtual

getObj()

auto xpress::objects::Variable::getObj ( ) const -> double
inline

Get objective coefficient for this variable.

Returns
Objective coefficient for this variable.
Since
44.00

getObjN()

auto xpress::objects::Variable::getObjN ( int objIdx ) const -> double
inline

Get objective coefficient for this variable.

Parameters
objIdx Index of objective function to query.
Returns
Objective coefficient for this variable.
Since
44.00

getProblem()

auto xpress::objects::Variable::getProblem ( ) const -> xpress::objects::XpressProblem *
inlineoverridevirtual

Get the problem to which this element belongs.

Returns
The problem to which this element belongs. This will be nullptr if the element was deleted.
Since
44.00

Returns
The problem to which this element belongs. This will be nullptr if the element was deleted.
Since
44.00

Implements xpress::objects::Index.

getRedCost()

auto xpress::objects::Variable::getRedCost ( ) const -> double
inline

Get the current reduced cost value for this variable.

Note: This functions uses xpress::XPRSProblem#getRedCosts(int *, Array<double> const &, int, int) const under the hood. This is only valid to call if the xpress::objects::XpressProblem instance owning this variable is currently not under optimization.

Note: Calling this function for multiple variables is not efficient. If you need to get values for multiple variables then consider using xpress::objects::XpressProblem#getRedCosts() const to get the values for all variables and then use getValue(SizedArray<double const> const &) const to extract the value for a particular variable. This strategy is also valid from callbacks.

Returns
Reduced cost for this variable.
Since
44.00

getSolution()

auto xpress::objects::Variable::getSolution ( ) const -> double
inline

Get the current solution value for this variable.

Note: This functions uses xpress::XPRSProblem#getSolution(int *, Array<double> const &, int, int) const under the hood. This is only valid to call if the XpressProblem instance owning this variable is currently not under optimization.

Note: Calling this function for multiple variables is not efficient. If you need to get values for multiple variables then consider using xpress::objects::XpressProblem#getSolution() const to get the values for all variables and then use getValue(SizedArray<double const> const &) const to extract the value for a particular variable. This strategy is also valid from callbacks.

Examples using getSolution:

Returns
Solution value for this variable.
Since
44.00

getType()

auto xpress::objects::Variable::getType ( ) const -> xpress::ColumnType
inline

Get the type for this variable.

Queries the XpressProblem instance to which this variable belongs and returns the name obtained from that instance.

Returns
Type of this variable.
Since
44.00

getUB()

auto xpress::objects::Variable::getUB ( ) const -> double
inline

Get the upper bound for this variable.

Queries the XpressProblem instance to which this variable belongs and returns the upper bound obtained from that instance.

Returns
The upper bound for this variable.
Since
44.00

getValue()

auto xpress::objects::Variable::getValue ( xpress::SizedArray< double const > const & data ) const -> double
inline

Get the value of this variable from an array.

The function assumes that data is an array that stores a value for each variable in the underlying problem and returns the value from this array that corresponds to this variable. data arrays can be obtained for example from prob.getSolution() or prob.getCallbackSolution().

Examples using getValue:

Parameters
data Data for all variables.
Returns
The value for this variable in data.
Since
44.00

ifNotThen()

auto xpress::objects::Variable::ifNotThen ( InequalityDefinition implied ) const -> xpress::objects::IndicatorDescription
inline

Create an indicator constraint with this variable as indicator variable.

The constraint will enforce implied if this variable is set to 0.

Examples using ifNotThen:

Parameters
implied The constraint that should be enforced if this variable is 0.
Returns
Definition for the constraint described by the arguments.
Since
44.00

ifThen()

auto xpress::objects::Variable::ifThen ( InequalityDefinition implied ) const -> xpress::objects::IndicatorDescription
inline

Create an indicator constraint with this variable as indicator variable.

The constraint will enforce implied if this variable is set to 1.

Examples using ifThen:

Parameters
implied The constraint that should be enforced if this variable is 1.
Returns
Definition for the constraint described by the arguments.
Since
44.00

in()

auto xpress::objects::Variable::in ( double lb,
double ub ) -> xpress::objects::InequalityDefinition
inlineoverridevirtual

Create a range constraint that bounds this expression from below and above.Examples using in:

Parameters
lb Lower bound for this expression.
ub Upper bound for this expression.
Returns
The constraint.
Since
44.00
Examples using in:

Since
44.00

Reimplemented from xpress::objects::Expression.

leq() [1/2]

auto xpress::objects::Variable::leq ( double rhs ) const -> xpress::objects::InequalityDefinition
inlineoverridevirtual

Create a "less than or equal" constraint with this expression as left-hand side.Examples using leq:

Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00
Examples using leq:

Since
44.00

Reimplemented from xpress::objects::Expression.

leq() [2/2]

auto xpress::objects::Variable::leq ( Expression const & rhs ) const -> xpress::objects::InequalityDefinition
inlineoverridevirtual

Create a "less than or equal" constraint with this expression as left-hand side.Examples using leq:

Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00
Examples using leq:

Since
44.00

Reimplemented from xpress::objects::Expression.

maxOf() [1/4]

template<typename Strm0 , typename Strm1 , typename Strm0IsStream , typename Strm1IsStream >
auto xpress::objects::Variable::maxOf ( Strm0 const & variables,
Strm1 const & values ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the maximum of the specified arguments.

Examples using maxOf:

Parameters
variables Variables in the maximum constraint.
values Values in the maximum constraint.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type Variable.
Strm1 Something that supports begin() and end() and contains values of type double.
Returns
this = max(variables, value).
Since
44.00

maxOf() [2/4]

template<typename Strm0 , typename Strm1 , typename Strm0IsStream , typename Strm1IsStream >
auto xpress::objects::Variable::maxOf ( Strm0 const & variables,
Strm1 const & values,
std::optional< std::string > name ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the maximum of the specified arguments.

Examples using maxOf:

Parameters
variables Variables in the maximum constraint.
values Values in the maximum constraint.
name Constraint name, can be std::nullopt to indicate the constraint has no name.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type Variable.
Strm1 Something that supports begin() and end() and contains values of type double.
Returns
this = max(variables, value).
Since
44.00

maxOf() [3/4]

template<typename... VARIABLES, typename RestrictPack >
auto xpress::objects::Variable::maxOf ( VARIABLES... variables ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the maximum of the specified other variables.

Examples using maxOf:

Parameters
variables Variables in the maximum constraint.
Returns
this = max(variables).
Since
44.00

maxOf() [4/4]

template<typename... VALUES, typename RestrictPack >
auto xpress::objects::Variable::maxOf ( xpress::SizedArray< Variable const > const & variables,
VALUES... values ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the maximum of the specified other variables and values.

Examples using maxOf:

Parameters
variables Variables in the maximum constraint.
values Values in the maximum constraint.
Returns
this = max(variables, value).
Since
44.00

minOf() [1/4]

template<typename Strm0 , typename Strm1 , typename Strm0IsStream , typename Strm1IsStream >
auto xpress::objects::Variable::minOf ( Strm0 const & variables,
Strm1 const & values ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the minimum of the specified arguments.

Examples using minOf:

Parameters
variables Variables in the minimum constraint.
values Values in the minimum constraint.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type Variable.
Strm1 Something that supports begin() and end() and contains values of type double.
Returns
this = min(variables, value).
Since
44.00

minOf() [2/4]

template<typename Strm0 , typename Strm1 , typename Strm0IsStream , typename Strm1IsStream >
auto xpress::objects::Variable::minOf ( Strm0 const & variables,
Strm1 const & values,
std::optional< std::string > name ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the minimum of the specified arguments.

Examples using minOf:

Parameters
variables Variables in the minimum constraint.
values Values in the minimum constraint.
name Constraint name, can be std::nullopt to indicate the constraint has no name.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type Variable.
Strm1 Something that supports begin() and end() and contains values of type double.
Returns
this = min(variables, value).
Since
44.00

minOf() [3/4]

template<typename... VARIABLES, typename RestrictPack >
auto xpress::objects::Variable::minOf ( VARIABLES... variables ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the minimum of the specified other variables.

Examples using minOf:

Parameters
variables Variables in the minimum constraint.
Returns
this = min(variables).
Since
44.00

minOf() [4/4]

template<typename... VALUES, typename RestrictPack >
auto xpress::objects::Variable::minOf ( xpress::SizedArray< Variable const > const & variables,
VALUES... values ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the minimum of the specified other variables and values.

Examples using minOf:

Parameters
variables Variables in the minimum constraint.
values Values in the minimum constraint.
Returns
this = min(variables, value).
Since
44.00

mul() [1/5]

auto xpress::objects::Variable::mul ( ConstantExpression arg ) const -> xpress::objects::LinTerm
inline

Create a expression that represents the product of this and arg.

Examples using mul:

Parameters
arg Factor.
Returns
The expression.
Since
44.00

mul() [2/5]

auto xpress::objects::Variable::mul ( double arg ) const -> xpress::objects::Expression
inlineoverridevirtual

Create a expression that represents the product of this and arg.Examples using mul:

Parameters
arg Factor.
Returns
Product of this and arg.
Since
44.00
Examples using mul:

Since
44.00

Reimplemented from xpress::objects::Expression.

mul() [3/5]

auto xpress::objects::Variable::mul ( Expression arg ) const -> xpress::objects::Expression
inlineoverridevirtual

Create a expression that represents the product of this and arg.Examples using mul:

Parameters
arg Factor.
Returns
Product of this and arg.
Since
44.00
Examples using mul:

Since
44.00

Reimplemented from xpress::objects::Expression.

mul() [4/5]

auto xpress::objects::Variable::mul ( LinTerm arg ) const -> xpress::objects::QuadTerm
inline

Create a expression that represents the product of this and arg.

Examples using mul:

Parameters
arg Factor.
Returns
The expression.
Since
44.00

mul() [5/5]

auto xpress::objects::Variable::mul ( Variable arg ) const -> xpress::objects::QuadTerm
inline

Create a expression that represents the product of this and arg.

Examples using mul:

Parameters
arg Factor.
Returns
The expression.
Since
44.00

orOf() [1/3]

template<typename Strm0 , typename Strm0IsStream >
auto xpress::objects::Variable::orOf ( Strm0 const & variables ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the or of the specified arguments.

Examples using orOf:

Parameters
variables Variables in the or constraint.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type Variable.
Returns
this = or(variables, value).
Since
44.00

orOf() [2/3]

template<typename Strm0 , typename Strm0IsStream >
auto xpress::objects::Variable::orOf ( Strm0 const & variables,
std::optional< std::string > name ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the or of the specified arguments.

Examples using orOf:

Parameters
variables Variables in the or constraint.
name Constraint name, can be std::nullopt to indicate the constraint has no name.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type Variable.
Returns
this = or(variables, value).
Since
44.00

orOf() [3/3]

template<typename... VARIABLES, typename RestrictPack >
auto xpress::objects::Variable::orOf ( VARIABLES... variables ) const -> xpress::objects::GeneralConstraintDefinition
inline

Create a constraint that requires this variable to be the or of the specified other variables.

Examples using orOf:

Parameters
variables Variables in the or constraint.
Returns
this = or(variables).
Since
44.00

pwlOf() [1/5]

template<typename... BREAKPOINTS, typename RestrictPack >
auto xpress::objects::Variable::pwlOf ( Variable input,
BREAKPOINTS... breakpoints ) const -> xpress::objects::PWLDefinition
inline

Create a piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.

Examples using pwlOf:

Parameters
input Input for piecewise linear constraint.
breakpoints Breakpoints for constraint.
Returns
Definition for the constraint described by the arguments.
Since
44.00

pwlOf() [2/5]

template<typename Strm0 , typename Strm0IsStream >
auto xpress::objects::Variable::pwlOf ( Variable input,
Strm0 const & breakpoints ) const -> xpress::objects::PWLDefinition
inline

Create a piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.

Examples using pwlOf:

Parameters
input Input for piecewise linear constraint.
breakpoints Breakpoints for constraint.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type xpress::PwlBreakpoint.
Returns
Definition for the constraint described by the arguments.
Since
44.00

pwlOf() [3/5]

template<typename Strm0 , typename Strm0IsStream >
auto xpress::objects::Variable::pwlOf ( Variable input,
Strm0 const & breakpoints,
std::optional< std::string > name ) const -> xpress::objects::PWLDefinition
inline

Create a piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.

Examples using pwlOf:

Parameters
input Input for piecewise linear constraint.
breakpoints Breakpoints for constraint.
name Name for constraint, can be std::nullopt.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type xpress::PwlBreakpoint.
Returns
Definition for the constraint described by the arguments.
Since
44.00

pwlOf() [4/5]

auto xpress::objects::Variable::pwlOf ( Variable input,
xpress::SizedArray< double const > const & xval,
xpress::SizedArray< double const > const & yval ) const -> xpress::objects::PWLDefinition
inline

Create a piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by xval/yval evaluated for input.

Examples using pwlOf:

Parameters
input Input for piecewise linear constraint.
xval X coordinates of breakpoints.
yval X coordinates of breakpoints.
Returns
Definition for the constraint described by the arguments.
Since
44.00

pwlOf() [5/5]

auto xpress::objects::Variable::pwlOf ( Variable input,
xpress::SizedArray< double const > const & xval,
xpress::SizedArray< double const > const & yval,
std::optional< std::string > name ) const -> xpress::objects::PWLDefinition
inline

Create a piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by xval/yval evaluated for input.

Examples using pwlOf:

Parameters
input Input for piecewise linear constraint.
xval X coordinates of breakpoints.
yval X coordinates of breakpoints.
name Name of the constraint, can be std::nullopt.
Returns
Definition for the constraint described by the arguments.
Since
44.00

setLB()

auto xpress::objects::Variable::setLB ( double newLB ) -> Variable&
inline

Set the lower bound for this variable.

Set the lower bound in the XpressProblem instance to which this variable belongs.

Examples using setLB:

Parameters
newLB New lower bound.
Returns
This variable
Since
44.00

setLimit()

auto xpress::objects::Variable::setLimit ( double newLimit ) -> Variable&
inline

Set the limit for this variable.

Set the limit in the XpressProblem instance to which this variable belongs. Note that limits are ignored unless the variable is semi-continuous, semi-integer, or partial integer.

Parameters
newLimit New limit.
Returns
This variable
Since
44.00

setName()

auto xpress::objects::Variable::setName ( std::optional< std::string > newName ) -> Variable&
inline

Set the name of this variable.

Sets the name of this variable in the problem instance that owns the object.

Examples using setName:

Parameters
newName The name to be set.
Returns
Always returns this instance.
Since
44.00

setType()

auto xpress::objects::Variable::setType ( xpress::ColumnType newType ) -> Variable&
inline

Set the type for this variable.

Set the type in the XpressProblem instance to which this variable belongs.

Parameters
newType New type.
Returns
This variable
Since
44.00

setUB()

auto xpress::objects::Variable::setUB ( double newUB ) -> Variable&
inline

Set the upper bound for this variable.

Set the upper bound in the XpressProblem instance to which this variable belongs.

Examples using setUB:

Parameters
newUB New upper bound.
Returns
This variable
Since
44.00

square()

auto xpress::objects::Variable::square ( ) -> xpress::objects::QuadTerm
inline

Create a quadratic term by multiplying this variable with itself.

Examples using square:

Returns
The term representing the product of this variable with itself.
Since
44.00

toString()

auto xpress::objects::Variable::toString ( ) const -> std::string
inlineoverridevirtual

Returns the name from getName().

Examples using toString:

Returns
This variable's name.
Since
44.00

Reimplemented from xpress::objects::Expression.

uminus()

auto xpress::objects::Variable::uminus ( ) const -> xpress::objects::Expression
inlineoverridevirtual

Create a expression that represents the unary minus of this one.

Returns
Expression representing -this.
Since
44.00

Since
44.00

Reimplemented from xpress::objects::Expression.


The documentation for this class was generated from the following file:
  • xpress_objects.hpp

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.