QuadExpr::QuadExpr()
Constructor of a quadratic expression with a constant.
Synopsis
QuadExpr(double constant)
Arguments
constant
: constant value in quadratic expression object.
QuadExpr::QuadExpr()
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.
QuadExpr::QuadExpr()
Constructor of a quadratic expression with a linear expression.
Synopsis
QuadExpr(const Expr &expr)
Arguments
expr
: input linear expression.
QuadExpr::QuadExpr()
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.
QuadExpr::QuadExpr()
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.
QuadExpr::AddConstant()
Add constant for the expression.
Synopsis
void AddConstant(double constant)
Arguments
constant
: the value of the constant.
QuadExpr::AddLinExpr()
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.
QuadExpr::AddQuadExpr()
Add a quadratic expression to self.
Synopsis
void AddQuadExpr(const QuadExpr &expr, double mult)
Arguments
expr
: quadratic expression to be added.
mult
: optional, constant multiplier, default value is 1.0.
QuadExpr::AddTerm()
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.
QuadExpr::AddTerm()
Add a quadratic term to expression object.
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.
QuadExpr::AddTerms()
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
number of added linear terms.
QuadExpr::AddTerms()
Add quadratic terms to expression object.
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
number of added quadratic terms.
QuadExpr::Clone()
Deep copy quadratic expression object.
Synopsis
QuadExpr Clone()
Return
cloned quadratic expression object.
QuadExpr::Evaluate()
evaluate quadratic expression after solving
Synopsis
double Evaluate()
Return
value of quadratic expression
QuadExpr::GetCoeff()
Get coefficient from the i-th term in quadratic expression.
Synopsis
double GetCoeff(int i)
Arguments
i
: index of the quadratic term.Return
coefficient of the i-th quadratic term in quadratic expression object.
QuadExpr::GetConstant()
Get constant in quadratic expression.
Synopsis
double GetConstant()
Return
constant in quadratic expression.
QuadExpr::GetLinExpr()
Get linear expression in quadratic expression.
Synopsis
Expr &GetLinExpr()
Return
linear expression object.
QuadExpr::GetVar1()
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.
QuadExpr::GetVar2()
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.
QuadExpr::operator*=()
Multiply a constant to self.
Synopsis
void operator*=(double c)
Arguments
c
: constant multiplier.
QuadExpr::operator*()
Multiply constant and return new expression.
Synopsis
QuadExpr operator*(double c)
Arguments
c
: constant multiplier.Return
result expression.
QuadExpr::operator+=()
Add an expression to self.
Synopsis
void operator+=(const QuadExpr &expr)
Arguments
expr
: expression to be added.
QuadExpr::operator+()
Add expression and return new expression.
Synopsis
QuadExpr operator+(const QuadExpr &other)
Arguments
other
: other expression to add.Return
result expression.
QuadExpr::operator-=()
Substract an expression from self.
Synopsis
void operator-=(const QuadExpr &expr)
Arguments
expr
: expression to be substracted.
QuadExpr::operator-()
Substract expression and return new expression.
Synopsis
QuadExpr operator-(const QuadExpr &other)
Arguments
other
: other expression to substract.Return
result expression.
QuadExpr::Remove()
Remove i-th term from expression object.
Synopsis
void Remove(int i)
Arguments
i
: index of the term to be removed.
QuadExpr::Remove()
Remove the term associated with variable from expression.
Synopsis
void Remove(const Var &var)
Arguments
var
: a variable whose term should be removed.
QuadExpr::Reserve()
Reserve capacity to contain at least n items.
Synopsis
void Reserve(size_t n)
Arguments
n
: minimum capacity for quadratic expression object.
QuadExpr::SetCoeff()
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.
QuadExpr::SetConstant()
Set constant for the expression.
Synopsis
void SetConstant(double constant)
Arguments
constant
: the value of the constant.
QuadExpr::Size()
Get number of terms in expression.
Synopsis
size_t Size()
Return
number of terms.