Initializing help system before first use

# LinTermList

A linear expression that is represented as a list of terms. More...

Inheritance diagram for xpress::objects::LinTermList:

## Public Member Functions
| LinTermList ()
| Create a empty expression.
| LinTermList (double c)
| Create a expression that represents a constant term.
| LinTermList (double c, int capacity)
| Create a expression with a constant term and an initial capacity.
virtual auto | addConstant (double c) -> LinTermList &override
  | Add a value to the constant term of this expression. Parameters
  c | The constant to add.
Returns Always returns `this`. Since 44.00
virtual auto | addTerm (double const &coefficient, Variable const &variable) -> LinTermList &override
  | 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.Examples using `addTerm`: Capbgt2l.cpp Catenary.cpp ContractAllocation.cpp CuttingStock.cpp ELSManagedCuts.cpp Pplan.cpp Pplan2.cpp QuadraticProgramming.cpp RecursiveFinancialPlanning.cpp Sangraalind.cpp TravelingSalesPerson.cpp Parameters
  coefficient | Coefficient to add for `variable`.
  variable | Variable.
Returns Always returns `this`. Since 44.00 Examples using `addTerm`:
auto | addTerm (LinTerm const &term) -> LinExpression &
| Add `term` term to this expression.
virtual auto | addTerm (Variable const &variable, double const &coefficient) -> LinTermList &override
  | 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.Examples using `addTerm`: Capbgt2l.cpp Catenary.cpp ContractAllocation.cpp CuttingStock.cpp ELSManagedCuts.cpp Pplan.cpp Pplan2.cpp QuadraticProgramming.cpp RecursiveFinancialPlanning.cpp Sangraalind.cpp TravelingSalesPerson.cpp Parameters
  variable | Variable.
  coefficient | Coefficient to add for `variable`.
Returns Always returns `this`. Since 44.00 Examples using `addTerm`:
virtual auto | addTerm (Variable const &x) -> LinTermList &override
  | 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.Examples using `addTerm`: Capbgt2l.cpp Catenary.cpp ContractAllocation.cpp CuttingStock.cpp ELSManagedCuts.cpp Pplan.cpp Pplan2.cpp QuadraticProgramming.cpp RecursiveFinancialPlanning.cpp Sangraalind.cpp TravelingSalesPerson.cpp Parameters
  x | Variable.
Returns Always returns `this`. Since 44.00 Examples using `addTerm`:
virtual auto | addTerms (LinExpression const &expr) -> LinTermList &override
  | Add another linear expression to this expression. Parameters
  expr | The expression to add
Returns Always returns `this`. Since 44.00
virtual auto | addTerms (LinExpression const &expr, double factor) -> LinTermList &override
  | 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
template<typename Strm_variables , typename Strm_coefficients , is-stream(Strm_variables) , is-stream(Strm_coefficients) >
auto | addTerms (Strm_variables const &variables, Strm_coefficients const &coefficients) -> LinExpression &
| Add multiple terms to this expression.
auto | compress () const -> void
| Compress duplicate terms.
virtual auto | deepCopy () -> xpress::objects::LinExpression override
| Get a deep copy of this expression. Returns A deep copy of this expression. Since 44.00
virtual auto | deepCopy (double factor) -> xpress::objects::LinExpression override
  | 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
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`: CapitalBudgeting.cpp PolygonObjects.cpp 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`:
virtual auto | getConstant () const -> double override
| Get the constant value in this expression. Returns The constant value in this expression. Since 44.00
auto | reserve (int l) -> LinTermList &
| Reserve a maximum number of elements in this expression.
virtual auto | reset () -> LinTermList &override
| Clear this expression.Removes all terms and sets the constant to 0.Examples using `reset`: tsp.cpp Returns Always returns `this`. Since 44.00 Examples using `reset`:
virtual auto | setConstant (double c) -> LinTermList &override
  | 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
virtual auto | toString () const -> std::string override
| Get a string representation of this expression.Examples using `toString`: Boxes02.cpp Capbgt2l.cpp Returns A string representing this expression. Since 44.00 Examples using `toString`:
Public Member Functions inherited from xpress::objects::LinExpression
auto | addTerm (LinTerm const &term) -> LinExpression &
| Add `term` term to this expression.
template<typename Strm_variables , typename Strm_coefficients , is-stream(Strm_variables) , is-stream(Strm_coefficients) >
auto | addTerms (Strm_variables const &variables, Strm_coefficients const &coefficients) -> LinExpression &
| Add multiple terms to 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.Examples using `eq`: BoolVars.cpp 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`: BoolVars.cpp Parameters
  rhs | Right-hand side of constraint.
Returns The constraint. Since 44.00 Examples using `eq`:
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.Examples using `in`: Folio.cpp FolioCB.cpp FolioMipIIS.cpp QuadraticProgramming.cpp 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`: TravelingSalesPerson.cpp 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`: TravelingSalesPerson.cpp Parameters
  rhs | Right-hand side of constraint.
Returns The constraint. Since 44.00 Examples using `leq`:
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 | 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 | uminus () const -> xpress::objects::Expression
| Create a expression that represents the unary minus of this one.

## Static Public Member Functions
static auto | isAutoCompress () -> bool
| Test whether auto-compression is enabled for this class.
static auto | setAutoCompress (bool compress) -> void
| Enable/disable auto-compression for instances of this class.
Static Public Member Functions inherited from xpress::objects::LinExpression
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.
static auto | create (double constant, int reserve) -> xpress::objects::LinExpression
| Create a linear expression with the specified constant term and prepare for adding the specified number of terms.
static auto | setCreateLists (bool newValue) -> bool
| Configures whether the `create()` functions should return instances of `LinTermList` (if `newValue` is true) or `LinTermMap` (if `newValue` is false).

## Detailed Description

A linear expression that is represented as a list of terms.

Instances of this class represent a linear expression as a list of terms. This is the most efficient way to represent a list. By default, the implementation assumes that there are no two terms in the list that refer to the same variable. If there are you must either explicitly call `compress()` or set the `autoCompress` property to `true`.

Since
  44.00

## Constructor & Destructor Documentation

## LinTermList() [1/3]

xpress::objects::LinTermList::LinTermList | ( |  | ) |
| inline

Create a empty expression.

Since
  44.00

## LinTermList() [2/3]

xpress::objects::LinTermList::LinTermList | ( | double | c | ) |
| inline

Create a expression that represents a constant term.

Parameters

  c | The constant term.

Since
  44.00

## LinTermList() [3/3]

xpress::objects::LinTermList::LinTermList | ( | double | c,
|  | int | capacity )
| inline

Create a expression with a constant term and an initial capacity.

Parameters

  c | The constant term.
  capacity | The initial capacity.

Since
  44.00

## Member Function Documentation

## addConstant()

auto xpress::objects::LinTermList::addConstant | ( | double | c | ) | -> LinTermList&
| inline override virtual

Add a value to the constant term of this expression.

Parameters

  c | The constant to add.

Returns
  Always returns `this`.

Since
  44.00

Since
  44.00

Reimplemented from xpress::objects::LinExpression.

## addTerm() [1/4]

auto xpress::objects::LinTermList::addTerm | ( | double const & | coefficient,
|  | Variable const & | variable ) -> LinTermList&
| inline override virtual

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.Examples using `addTerm`:

- Capbgt2l.cpp
- Catenary.cpp
- ContractAllocation.cpp
- CuttingStock.cpp
- ELSManagedCuts.cpp
- Pplan.cpp
- Pplan2.cpp
- QuadraticProgramming.cpp
- RecursiveFinancialPlanning.cpp
- Sangraalind.cpp
- TravelingSalesPerson.cpp

Parameters

  coefficient | Coefficient to add for `variable`.
  variable | Variable.

Returns
  Always returns `this`.

Since
  44.00

Examples using `addTerm`:

- Capbgt2l.cpp
- Catenary.cpp
- ContractAllocation.cpp
- CuttingStock.cpp
- ELSManagedCuts.cpp
- Pplan.cpp
- Pplan2.cpp
- QuadraticProgramming.cpp
- RecursiveFinancialPlanning.cpp
- Sangraalind.cpp
- TravelingSalesPerson.cpp

Since
  44.00

Reimplemented from xpress::objects::LinExpression.

## addTerm() [2/4]

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

Add `term` term to this expression.

Examples using `addTerm`:

- Capbgt2l.cpp
- Catenary.cpp
- ContractAllocation.cpp
- CuttingStock.cpp
- ELSManagedCuts.cpp
- Pplan.cpp
- Pplan2.cpp
- QuadraticProgramming.cpp
- RecursiveFinancialPlanning.cpp
- Sangraalind.cpp
- TravelingSalesPerson.cpp

Parameters

  term | The term to add.

Returns
  Always returns `this`.

Since
  44.00

## addTerm() [3/4]

auto xpress::objects::LinTermList::addTerm | ( | Variable const & | variable,
|  | double const & | coefficient ) -> LinTermList&
| inline override virtual

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.Examples using `addTerm`:

- Capbgt2l.cpp
- Catenary.cpp
- ContractAllocation.cpp
- CuttingStock.cpp
- ELSManagedCuts.cpp
- Pplan.cpp
- Pplan2.cpp
- QuadraticProgramming.cpp
- RecursiveFinancialPlanning.cpp
- Sangraalind.cpp
- TravelingSalesPerson.cpp

Parameters

  variable | Variable.
  coefficient | Coefficient to add for `variable`.

Returns
  Always returns `this`.

Since
  44.00

Examples using `addTerm`:

- Capbgt2l.cpp
- Catenary.cpp
- ContractAllocation.cpp
- CuttingStock.cpp
- ELSManagedCuts.cpp
- Pplan.cpp
- Pplan2.cpp
- QuadraticProgramming.cpp
- RecursiveFinancialPlanning.cpp
- Sangraalind.cpp
- TravelingSalesPerson.cpp

Since
  44.00

Reimplemented from xpress::objects::LinExpression.

## addTerm() [4/4]

auto xpress::objects::LinTermList::addTerm | ( | Variable const & | x | ) | -> LinTermList&
| inline override virtual

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.Examples using `addTerm`:

- Capbgt2l.cpp
- Catenary.cpp
- ContractAllocation.cpp
- CuttingStock.cpp
- ELSManagedCuts.cpp
- Pplan.cpp
- Pplan2.cpp
- QuadraticProgramming.cpp
- RecursiveFinancialPlanning.cpp
- Sangraalind.cpp
- TravelingSalesPerson.cpp

Parameters

  x | Variable.

Returns
  Always returns `this`.

Since
  44.00

Examples using `addTerm`:

- Capbgt2l.cpp
- Catenary.cpp
- ContractAllocation.cpp
- CuttingStock.cpp
- ELSManagedCuts.cpp
- Pplan.cpp
- Pplan2.cpp
- QuadraticProgramming.cpp
- RecursiveFinancialPlanning.cpp
- Sangraalind.cpp
- TravelingSalesPerson.cpp

Since
  44.00

Reimplemented from xpress::objects::LinExpression.

## addTerms() [1/3]

auto xpress::objects::LinTermList::addTerms | ( | LinExpression const & | expr | ) | -> LinTermList&
| inline override virtual

Add another linear expression to this expression.

Parameters

  expr | The expression to add

Returns
  Always returns `this`.

Since
  44.00

Since
  44.00

Reimplemented from xpress::objects::LinExpression.

## addTerms() [2/3]

auto xpress::objects::LinTermList::addTerms | ( | LinExpression const & | expr,
|  | double | factor ) -> LinTermList&
| inline override virtual

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

Since
  44.00

Reimplemented from xpress::objects::LinExpression.

## addTerms() [3/3]

template<typename Strm_variables , typename Strm_coefficients , is-stream(Strm_variables) , is-stream(Strm_coefficients) >

auto xpress::objects::LinExpression::addTerms | ( | Strm_variables const & | variables,
|  | Strm_coefficients 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

  Strm_variables | Something that supports `begin()` and `end()` and contains values of type `Variable`.
  Strm_coefficients | Something that supports `begin()` and `end()` and contains values of type `double`.

Returns
  Always returns `this`.

Since
  44.00

## compress()

auto xpress::objects::LinTermList::compress | ( |  | ) | const -> void
| inline

Compress duplicate terms.

Sorts the terms and merges any terms for the same variable into a single term.

Examples using `compress`:

- Catenary.cpp

Since
  44.00

## deepCopy() [1/2]

auto xpress::objects::LinTermList::deepCopy | ( |  | ) | -> xpress::objects::LinExpression
| inline override virtual

Get a deep copy of this expression.

Returns
  A deep copy of this expression.

Since
  44.00

Since
  44.00

Reimplemented from xpress::objects::LinExpression.

## deepCopy() [2/2]

auto xpress::objects::LinTermList::deepCopy | ( | double | factor | ) | -> xpress::objects::LinExpression
| inline override virtual

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

Since
  44.00

Reimplemented from xpress::objects::LinExpression.

## evaluate()

auto xpress::objects::LinTermList::evaluate | ( | xpress::SizedArray< double const > const & | solution | ) | const -> double
| inline override virtual

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

- CapitalBudgeting.cpp
- PolygonObjects.cpp

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`:

- CapitalBudgeting.cpp
- PolygonObjects.cpp

Parameters

  solution | Solution values for which the expression is evaluated.

Since
  44.00

Reimplemented from xpress::objects::Expression.

## getConstant()

auto xpress::objects::LinTermList::getConstant | ( |  | ) | const -> double
| inline override virtual

Get the constant value in this expression.

Returns
  The constant value in this expression.

Since
  44.00

Since
  44.00

Reimplemented from xpress::objects::LinExpression.

## isAutoCompress()

auto xpress::objects::LinTermList::isAutoCompress | ( |  | ) | -> bool
| inline static

Test whether auto-compression is enabled for this class.

Returns
  `true` if auto compression is enabled for all instances of this class.

Since
  44.00

## reserve()

auto xpress::objects::LinTermList::reserve | ( | int | l | ) | -> LinTermList&
| inline

Reserve a maximum number of elements in this expression.

Parameters

  l | The number of additional elements to reserve.

Returns
  Always returns this instance.

Since
  44.00

## reset()

auto xpress::objects::LinTermList::reset | ( |  | ) | -> LinTermList&
| inline override virtual

Clear this expression.Removes all terms and sets the constant to 0.Examples using `reset`:

- tsp.cpp

Returns
  Always returns `this`.

Since
  44.00

Examples using `reset`:

- tsp.cpp

Since
  44.00

Reimplemented from xpress::objects::LinExpression.

## setAutoCompress()

auto xpress::objects::LinTermList::setAutoCompress | ( | bool | compress | ) | -> void
| inline static

Enable/disable auto-compression for instances of this class.

With auto-compression disabled, any instance of this class assumes that expressions do not contain two terms with the same variable.

Parameters

  compress | `true` to enable, `false` otherwise.

Since
  44.00

## setConstant()

auto xpress::objects::LinTermList::setConstant | ( | double | c | ) | -> LinTermList&
| inline override virtual

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

Since
  44.00

Reimplemented from xpress::objects::LinExpression.

## toString()

auto xpress::objects::LinTermList::toString | ( |  | ) | const -> std::string
| inline override virtual

Get a string representation of this expression.Examples using `toString`:

- Boxes02.cpp
- Capbgt2l.cpp

Returns
  A string representing this expression.

Since
  44.00

Examples using `toString`:

- Boxes02.cpp
- Capbgt2l.cpp

Since
  44.00

Reimplemented from xpress::objects::Expression.

The documentation for this class was generated from the following file:

- xpress_objects.hpp

Parent Topic objects

© 2001-2026 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.