Initializing help system before first use

LinExpression

A linear expression that represents its data by a collection of terms. More...

#include <xpress_objects.hpp>

Inheritance diagram for xpress::objects::LinExpression:
xpress::objects::AbstractExpression xpress::objects::Expression xpress::objects::LinTermList xpress::objects::LinTermMap

Public Member Functions

virtual auto  addConstant (double c) -> LinExpression &
  Add a value to the constant term of this expression.
 
virtual auto  addTerm (double const &coefficient, Variable const &variable) -> LinExpression &
  Add a term to this expression.
 
auto  addTerm (LinTerm const &term) -> LinExpression &
  Add term term to this expression.
 
virtual auto  addTerm (Variable const &variable, double const &coefficient) -> LinExpression &
  Add a term to this expression.
 
virtual auto  addTerm (Variable const &x) -> LinExpression &
  Add term 1*x to this expression.
 
template<typename Strm0 , typename Strm1 , typename Strm0IsStream = typename std::enable_if<xpress::is_stream<Strm0>::value>::type, typename Strm1IsStream = typename std::enable_if<xpress::is_stream<Strm1>::value>::type>
auto  addTerms (Strm0 const &variables, Strm1 const &coefficients) -> LinExpression &
  Add multiple terms to this expression.
 
virtual auto  addTerms (xpress::objects::LinExpression const &expr) -> LinExpression &
  Add another linear expression to this expression.
 
virtual auto  addTerms (xpress::objects::LinExpression const &expr, double factor) -> LinExpression &
  Add another linear expression to this expression.
 
virtual auto  deepCopy () -> xpress::objects::LinExpression
  Get a deep copy of this expression.
 
virtual auto  deepCopy (double factor) -> xpress::objects::LinExpression
  Get a deep copy of this expression multiplied by a constant.
 
virtual auto  getConstant () const -> double
  Get the constant value in this expression.
 
virtual auto  reset () -> LinExpression &
  Clear this expression.
 
virtual auto  setConstant (double c) -> LinExpression &
  Set the constant term in this expression.
 
auto  square () -> xpress::objects::Expression
  Create a QuadExpression by multiplying this expression by itself.
 
 Public Member Functions inherited from xpress::objects::AbstractExpression
virtual auto  eq (double rhs) const -> xpress::objects::InequalityDefinition override
  Create an "equals" constraint with this expression as left-hand side.
Parameters
rhs Right-hand side of constraint.
Returns
The constraint.
Since
44.00

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

 
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

 
virtual auto  in (double lb, double ub) -> xpress::objects::InequalityDefinition override
  Create a range constraint that bounds this expression from below and above.
Parameters
lb Lower bound for this expression.
ub Upper bound for this expression.
Returns
The constraint.
Since
44.00

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

 
 Public Member Functions inherited from xpress::objects::Expression
virtual auto  div (double arg) const -> xpress::objects::Expression
  Create a expression that represents the quotient of this and arg.
 
virtual auto  div (Expression arg) const -> xpress::objects::Expression
  Create a expression that represents the quotient of this and arg.
 
virtual auto  evaluate (xpress::SizedArray< double const > const &solution) const -> double
  Compute the value of this expression with respect to the given solution vector (which is not required to be feasible).
 
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  mul (double arg) const -> xpress::objects::Expression
  Create a expression that represents the product of this and arg.
 
virtual auto  mul (Expression arg) const -> xpress::objects::Expression
  Create a expression that represents the product 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.
 
virtual auto  toString () const -> std::string
  Get a string representation of this expression.
 
virtual auto  uminus () const -> xpress::objects::Expression
  Create a expression that represents the unary minus of this one.
 

Static Public Member Functions

static auto  create () -> xpress::objects::LinExpression
  Create an empty linear expression.
 
static auto  create (double constant) -> xpress::objects::LinExpression
  Create a linear expression with the specified constant term.
 

Detailed Description

A linear expression that represents its data by a collection of terms.

This is an abstract base class that is implement by different subclasses which use different data types to actually store the various terms in the expression.

Since
44.00

Member Function Documentation

addConstant()

auto xpress::objects::LinExpression::addConstant ( double c ) -> LinExpression&
inlinevirtual

Add a value to the constant term of this expression.

Parameters
c The constant to add.
Returns
Always returns this.
Since
44.00

Reimplemented in xpress::objects::LinTermList, and xpress::objects::LinTermMap.

addTerm() [1/4]

auto xpress::objects::LinExpression::addTerm ( double const & coefficient,
Variable const & variable ) -> LinExpression&
inlinevirtual

Add a term to this expression.

If the expression already has a coefficient for variable then the old and the new coefficients will be added.

Parameters
coefficient Coefficient to add for variable.
variable Variable.
Returns
Always returns this.
Since
44.00

Reimplemented in xpress::objects::LinTermList, and xpress::objects::LinTermMap.

addTerm() [2/4]

auto xpress::objects::LinExpression::addTerm ( LinTerm const & term ) -> LinExpression&
inline

Add term term to this expression.

Parameters
term The term to add.
Returns
Always returns this.
Since
44.00

addTerm() [3/4]

auto xpress::objects::LinExpression::addTerm ( Variable const & variable,
double const & coefficient ) -> LinExpression&
inlinevirtual

Add a term to this expression.

If the expression already has a coefficient for variable then the old and the new coefficients will be added.

Parameters
variable Variable.
coefficient Coefficient to add for variable.
Returns
Always returns this.
Since
44.00

Reimplemented in xpress::objects::LinTermList, and xpress::objects::LinTermMap.

addTerm() [4/4]

auto xpress::objects::LinExpression::addTerm ( Variable const & x ) -> LinExpression&
inlinevirtual

Add term 1*x to this expression.

If the expression already has a coefficient for x then the old and the new coefficients will be added.

Parameters
x Variable.
Returns
Always returns this.
Since
44.00

Reimplemented in xpress::objects::LinTermList, and xpress::objects::LinTermMap.

addTerms() [1/3]

template<typename Strm0 , typename Strm1 , typename Strm0IsStream , typename Strm1IsStream >
auto xpress::objects::LinExpression::addTerms ( Strm0 const & variables,
Strm1 const & coefficients ) -> LinExpression&
inline

Add multiple terms to this expression.

Adds the scalar product defined by the element-wise multiplication of variables and coefficients.

Parameters
variables Variables.
coefficients Coefficients.
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
Always returns this.
Since
44.00

addTerms() [2/3]

auto xpress::objects::LinExpression::addTerms ( xpress::objects::LinExpression const & expr ) -> LinExpression&
inlinevirtual

Add another linear expression to this expression.

Parameters
expr The expression to add
Returns
Always returns this.
Since
44.00

Reimplemented in xpress::objects::LinTermList, and xpress::objects::LinTermMap.

addTerms() [3/3]

auto xpress::objects::LinExpression::addTerms ( xpress::objects::LinExpression const & expr,
double factor ) -> LinExpression&
inlinevirtual

Add another linear expression to this expression.

Parameters
expr The expression to add.
factor Factor by which to multiply elements in expr before adding.
Returns
Always returns this.
Since
44.00

Reimplemented in xpress::objects::LinTermList, and xpress::objects::LinTermMap.

create() [1/2]

auto xpress::objects::LinExpression::create ( ) -> xpress::objects::LinExpression
inlinestatic

Create an empty linear expression.

Returns
The linear expression.
Since
44.00

create() [2/2]

auto xpress::objects::LinExpression::create ( double constant ) -> xpress::objects::LinExpression
inlinestatic

Create a linear expression with the specified constant term.

Parameters
constant The constant term to which the expression is initialized.
Returns
The quadratic expression.
Since
44.00

deepCopy() [1/2]

auto xpress::objects::LinExpression::deepCopy ( ) -> xpress::objects::LinExpression
inlinevirtual

Get a deep copy of this expression.

Returns
A deep copy of this expression.
Since
44.00

Reimplemented in xpress::objects::LinTermList, and xpress::objects::LinTermMap.

deepCopy() [2/2]

auto xpress::objects::LinExpression::deepCopy ( double factor ) -> xpress::objects::LinExpression
inlinevirtual

Get a deep copy of this expression multiplied by a constant.

Parameters
factor Factor to scale this with.
Returns
A deep copy of this expression multiplied by factor.
Since
44.00

Reimplemented in xpress::objects::LinTermList, and xpress::objects::LinTermMap.

getConstant()

auto xpress::objects::LinExpression::getConstant ( ) const -> double
inlinevirtual

Get the constant value in this expression.

Returns
The constant value in this expression.
Since
44.00

Reimplemented in xpress::objects::LinTermList, and xpress::objects::LinTermMap.

reset()

auto xpress::objects::LinExpression::reset ( ) -> LinExpression&
inlinevirtual

Clear this expression.

Removes all terms and sets the constant to 0.

Returns
Always returns this.
Since
44.00

Reimplemented in xpress::objects::LinTermList, and xpress::objects::LinTermMap.

setConstant()

auto xpress::objects::LinExpression::setConstant ( double c ) -> LinExpression&
inlinevirtual

Set the constant term in this expression.

Any existing constant term will be overwritten.

Parameters
c New constant term for this expression
Returns
Always returns this.
Since
44.00

Reimplemented in xpress::objects::LinTermList, and xpress::objects::LinTermMap.

square()

auto xpress::objects::LinExpression::square ( ) -> xpress::objects::Expression
inline

Create a QuadExpression by multiplying this expression by itself.

Returns
New expression that represents the product of this with itself.
Since
44.00

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.