Constructor of a quadratic expression with a constant.

Synopsis

`QuadExpr(double constant)`

Arguments

`constant`: constant value in quadratic expression object.

Constructor of a quadratic expression with one term.

Synopsis

`QuadExpr(const Var &var, double coeff)`

Arguments

`var`: variable for the added term.

`coeff`: coefficent for the added term.

Constructor of a quadratic expression with a linear expression.

Synopsis

`QuadExpr(const Expr &expr)`

Arguments

`expr`: input linear expression.

Constructor of a quadratic expression with two linear expression.

Synopsis

`QuadExpr(const Expr &expr, const Var &var)`

Arguments

`expr`: one linear expression.

`var`: another variable.

Constructor of a quadratic expression with two linear expression.

Synopsis

`QuadExpr(const Expr &left, const Expr &right)`

Arguments

`left`: one linear expression.

`right`: another linear expression.

Synopsis

`void AddConstant(double constant)`

Arguments

`constant`: the value of the constant.

Add a linear expression to self.

Synopsis

`void AddLinExpr(const Expr &expr, double mult)`

Arguments

`expr`: linear expression to be added.

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

Synopsis

`void AddQuadExpr(const QuadExpr &expr, double mult)`

Arguments

`expr`: quadratic expression to be added.

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

Add a linear term to expression object.

Synopsis

`void AddTerm(const Var &var, double coeff)`

Arguments

`var`: variable of new linear term.

`coeff`: coefficient of new linear term.

Synopsis

`void AddTerm(`

`const Var &var1,`

`const Var &var2,`

`double coeff)`

Arguments

`var1`: first variable of new quadratic term.

`var2`: second variable of new quadratic term.

`coeff`: coefficient of new quadratic term.

Add linear terms to expression object.

Synopsis

`int AddTerms(`

`const VarArray &vars,`

`double *pCoeff,`

`int len)`

Arguments

`vars`: variables for added linear terms.

`pCoeff`: coefficient array for added linear terms.

`len`: length of coefficient array.

Return

Synopsis

`int AddTerms(`

`const VarArray &vars1,`

`const VarArray &vars2,`

`double *pCoeff,`

`int len)`

Arguments

`vars1`: first set of variables for added quadratic terms.

`vars2`: second set of variables for added quadratic terms.

`pCoeff`: coefficient array for added quadratic terms.

`len`: length of coefficient array.

Return

Synopsis

`QuadExpr Clone()`

Return

Synopsis

`double Evaluate()`

Return

Get coefficient from the i-th term in quadratic expression.

Synopsis

`double GetCoeff(int i)`

Arguments

`i`: index of the quadratic term.

Return

Synopsis

`double GetConstant()`

Return

Get linear expression in quadratic expression.

Synopsis

`Expr &GetLinExpr()`

Return

linear expression object.

Get the first variable from the i-th term in quadratic expression.

Synopsis

`Var &GetVar1(int i)`

Arguments

`i`: index of the term.

Return

the first variable of the i-th term in quadratic expression object.

Get the second variable from the i-th term in quadratic expression.

Synopsis

`Var &GetVar2(int i)`

Arguments

`i`: index of the term.

Return

the second variable of the i-th term in quadratic expression object.

Multiply a constant to self.

Synopsis

`void operator*=(double c)`

Arguments

`c`: constant multiplier.

Multiply constant and return new expression.

Synopsis

`QuadExpr operator*(double c)`

Arguments

`c`: constant multiplier.

Return

result expression.

Synopsis

`void operator+=(const QuadExpr &expr)`

Arguments

`expr`: expression to be added.

Add expression and return new expression.

Synopsis

`QuadExpr operator+(const QuadExpr &other)`

Arguments

`other`: other expression to add.

Return

result expression.

Substract an expression from self.

Synopsis

`void operator-=(const QuadExpr &expr)`

Arguments

`expr`: expression to be substracted.

Substract expression and return new expression.

Synopsis

`QuadExpr operator-(const QuadExpr &other)`

Arguments

`other`: other expression to substract.

Return

result expression.

Remove i-th term from expression object.

Synopsis

`void Remove(int i)`

Arguments

`i`: index of the term to be removed.

Remove the term associated with variable from expression.

Synopsis

`void Remove(const Var &var)`

Arguments

`var`: a variable whose term should be removed.

Reserve capacity to contain at least n items.

Synopsis

`void Reserve(size_t n)`

Arguments

`n`: minimum capacity for quadratic expression object.

Set coefficient of the i-th term in quadratic expression.

Synopsis

`void SetCoeff(int i, double val)`

Arguments

`i`: index of the quadratic term.

`val`: coefficient of the term.

Set constant for the expression.

Synopsis

`void SetConstant(double constant)`

Arguments

`constant`: the value of the constant.

`size_t Size()`