8.5.12. MDOPsdExpr¶
-
class MDOPsdExpr¶
Represent a PSD expression in MindOpt application. A PSD expression contains PSD terms, and optionally, a linear expression.
Methods
Construct a MDOPsdExpr with a constant value
Construct a MDOPsdExpr with a linear expression
Construct a MDOPsdExpr with a PSD term
Add a PSD term to this PSD expression
Add linear terms to this PSD expression
Clear all terms contained in this PSD expression, that is, remove all PSD terms, linear terms from this PSD expression and reset its constant to zero
Retrieve the coefficient contained in ith PSD term
Retrieve the linear expression contained in this PSD expression
Retrieve the PSD variable contained in ith PSD term
Calculate the value of this PSD expression after problem solved
Remove the ith PSD term from this PSD expression
Remove all PSD terms that contain a specified PSD variable
Retrieve the number of PSD terms contained in PSD expression
-
MDOPsdExpr(double constant = 0.0)¶
Construct a MDOPsdExpr with a constant value.
- Parameters
double constant=0.0 – The initial constant value.
-
MDOPsdExpr(const MDOLinExpr &le)¶
Construct a MDOPsdExpr with a linear expression.
- Parameters
const MDOLinExpr& le – The initial linear expression.
-
MDOPsdExpr(MDOPsdVar var, MDOMatrix coeff)¶
Construct a MDOPsdExpr with a PSD term.
- Parameters
MDOPsdVar var – The PSD variable of PSD term.
MDOMatrix coeff – The coefficient of PSD term.
-
void addTerm(const MDOMatrix &coeff, const MDOPsdVar var)¶
Add a PSD term to this PSD expression.
- Parameters
const MDOMatrix& coeff – The coefficient of new PSD term to be added.
const MDOPsdVar var – The PSD variable of new PSD term to be added.
-
void addTerms(const double *coeff, const MDOVar *var, int cnt)¶
Add linear terms to this PSD expression.
- Parameters
const double* coeff – The coefficients of new linear terms to be added.
const MDOVar* var – The variables of new linear terms to be added.
int cnt – The number of linear terms to be added.
-
void clear()¶
Clear all terms contained in this PSD expression, that is, remove all PSD terms, linear terms from this PSD expression and reset its constant to zero.
-
MDOMatrix getCoeff(int i)¶
Retrieve the coefficient contained in ith PSD term.
- Parameters
int i – The index of PSD term.
- Returns
The coefficient contained in ith PSD term.
-
MDOLinExpr getLinExpr()¶
Retrieve the linear expression contained in this PSD expression.
- Returns
The linear expression contained in this PSD expression.
-
MDOPsdVar getPsdVar(int i)¶
Retrieve the PSD variable contained in ith PSD term.
- Parameters
int i – The index of PSD term.
- Returns
The PSD variable contained in ith PSD term.
-
double getValue()¶
Calculate the value of this PSD expression after problem solved.
- Returns
The value of this PSD expression after problem solved.
-
void remove(int i)¶
Remove the ith PSD term from this PSD expression.
- Parameters
int i – The index of PSD term to be removed
-
bool remove(MDOPsdVar v)¶
Remove all PSD terms that contain a specified PSD variable
- Parameters
MDOPsdVar v – The contained PSD variable to be removed
- Returns
True if at least 1 term was removed.
-
unsigned int size()¶
Retrieve the number of PSD terms contained in PSD expression.
- Returns
The number of PSD terms contained in PSD expression.
-
MDOPsdExpr(double constant = 0.0)¶