Expr::Expr()

Constructor of a constant linear expression.

Synopsis

Expr(double constant)

Arguments

constant: constant value in expression object.

Expr::Expr()

Constructor of a linear expression with one term.

Synopsis

Expr(const Var &var, double coeff)

Arguments

var: variable for the added term.

coeff: coefficent for the added term.

Expr::AddConstant()

Add constant for the expression.

Synopsis

void AddConstant(double constant)

Arguments

constant: the value of the constant.

Expr::AddExpr()

Add an expression to self.

Synopsis

void AddExpr(const Expr &expr, double mult)

Arguments

expr: expression to be added.

mult: optional, constant multiplier, default value is 1.0.

Expr::AddTerm()

Add a term to expression object.

Synopsis

void AddTerm(const Var &var, double coeff)

Arguments

var: a variable for new term.

coeff: coefficient for new term.

Expr::AddTerms()

Add terms to expression object.

Synopsis

int AddTerms(

const VarArray &vars,

double *pCoeff,

int len)

Arguments

vars: variables for added terms.

pCoeff: coefficient array for added terms.

len: length of coefficient array.

Return

number of added terms.

Expr::Clone()

Deep copy linear expression object.

Synopsis

Expr Clone()

Return

cloned expression object.

Expr::Evaluate()

evaluate linear expression after solving

Synopsis

double Evaluate()

Return

value of linear expression

Expr::GetCoeff()

Get coefficient from the i-th term in expression.

Synopsis

double GetCoeff(int i)

Arguments

i: index of the term.

Return

coefficient of the i-th term in expression object.

Expr::GetConstant()

Get constant in expression.

Synopsis

double GetConstant()

Return

constant in expression.

Expr::GetVar()

Get variable from the i-th term in expression.

Synopsis

Var &GetVar(int i)

Arguments

i: index of the term.

Return

variable of the i-th term in expression object.

Expr::operator*=()

Multiply a constant to self.

Synopsis

void operator*=(double c)

Arguments

c: constant multiplier.

Expr::operator*()

Multiply constant and return new expression.

Synopsis

Expr operator*(double c)

Arguments

c: constant multiplier.

Return

result expression.

Expr::operator*()

Multiply a variable and return new quadratic expression object.

Synopsis

QuadExpr operator*(const Var &var)

Arguments

var: variable object.

Return

result quadratic expression.

Expr::operator*()

Multiply a linear expression and return new quadratic expression object.

Synopsis

QuadExpr operator*(const Expr &other)

Arguments

other: linear expression object.

Return

result quadratic expression.

Expr::operator+=()

Add an expression to self.

Synopsis

void operator+=(const Expr &expr)

Arguments

expr: expression to be added.

Expr::operator+()

Add expression and return new expression.

Synopsis

Expr operator+(const Expr &other)

Arguments

other: other expression to add.

Return

result expression.

Expr::operator-=()

Substract an expression from self.

Synopsis

void operator-=(const Expr &expr)

Arguments

expr: expression to be substracted.

Expr::operator-()

Substract expression and return new expression.

Synopsis

Expr operator-(const Expr &other)

Arguments

other: other expression to substract.

Return

result expression.

Expr::Remove()

Remove i-th term from expression object.

Synopsis

void Remove(int i)

Arguments

i: index of the term to be removed.

Expr::Remove()

Remove the term associated with variable from expression.

Synopsis

void Remove(const Var &var)

Arguments

var: a variable whose term should be removed.

Expr::Reserve()

Reserve capacity to contain at least n items.

Synopsis

void Reserve(size_t n)

Arguments

n: minimum capacity for linear expression object.

Expr::SetCoeff()

Set coefficient for the i-th term in expression.

Synopsis

void SetCoeff(int i, double val)

Arguments

i: index of the term.

val: coefficient of the term.

Expr::SetConstant()

Set constant for the expression.

Synopsis

void SetConstant(double constant)

Arguments

constant: the value of the constant.

Expr::Size()

Get number of terms in expression.

Synopsis

size_t Size()

Return

number of terms.