8.8.14. MDOLinExpr¶
- MDOLinExpr¶
- Represents a linear expression in a MindOpt application. A linear expression can contain linear terms and a constant. - Properties - Retrieve the value of constant contained in linear expression - Retrieve the total number of linear terms contained in a linear expression - Calculate the value of this linear expression after the problem is solved - Constant¶
- Retrieve the value of constant contained in linear expression. 
 - Size¶
- Retrieve the total number of linear terms contained in a linear expression 
 - Value¶
- Calculate the value of this linear expression after the problem is solved. 
 - Methods - Add another linear term to the current linear term - Add a value to the constant contained in the linear expression - Add a linear term to this linear expression - Add linear terms to this linear expression - Add linear terms to this linear expression - Clear this linear expression to delete all items and reset its constants to zero - Retrieve the coefficients contained in the ith linear term - Retrieve the variable contained in the ith linear term - Construct a MDOLinExpr - Construct a MDOLinExpr with a variable - Construct a MDOLinExpr with an existing MDOLinExpr - Add a constant multiple of another linear term to the current linear term - Remove a linear term from this linear expression by its index - Remove all linear terms containing a specified variable - Convert the current linear term to its string format - void Add(MDOLinExpr le)¶
- Add another linear term to the current linear term - Parameters
- MDOLinExpr le – Added linear term 
 
 - void AddConstant(double c)¶
- Add a value to the constant contained in the linear expression. - Parameters
- double c – The value to be added. 
 
 - void AddTerm(double coeff, MDOVar var)¶
- Add a linear term to this linear expression - Parameters
- double coeff – Coefficient of the term to be added 
- MDOVar var – The variable of the term to be added 
 
 
 - void AddTerms(double[] coeff, MDOVar[] var)¶
- Add linear terms to this linear expression. - Parameters
- double[] coeff – The coefficients of the terms to be added. 
- MDOVar[] var – The variables of the terms to be added. 
 
 
 - void AddTerms(double[] coeff, MDOVar[] var, int start, int len)¶
- Add linear terms to this linear expression. - Parameters
- double[] coeff – Coefficients of the terms to be added 
- MDOVar[] var – The variables of the terms to be added 
- int start – Start position 
- int len – The number of items to add 
 
 
 - void Clear()¶
- Clear this linear expression to delete all items and reset its constants to zero. 
 - double GetCoeff(int i)¶
- Retrieve the coefficients contained in the ith linear term - Parameters
- int i – The index of the linear term 
- Returns
- Coefficient contained in the ith linear term 
 
 - MDOVar GetVar(int i)¶
- Retrieve the variable contained in the ith linear term. - Parameters
- int i – The index of the linear term. 
- Returns
- The variable contained in the ith linear term. 
 
 - MDOLinExpr()¶
- Construct a MDOLinExpr. 
 - MDOLinExpr(MDOVar var)¶
- Construct a MDOLinExpr with a variable. - Parameters
- MDOVar var – The variable 
 
 - MDOLinExpr(MDOLinExpr le)¶
- Construct a MDOLinExpr with an existing MDOLinExpr. - Parameters
- MDOLinExpr le – Existing MDOLinExpr 
 
 - void MultAdd(double m, MDOLinExpr le)¶
- Add a constant multiple of another linear term to the current linear term - Parameters
- double m – Constant multiplier 
- MDOLinExpr le – The linear term to be added 
 
 
 - void Remove(int i)¶
- Remove a linear term from this linear expression by its index. - Parameters
- int i – The index of the item to be deleted. 
 
 - bool Remove(MDOVar v)¶
- Remove all linear terms containing a specified variable. - Parameters
- MDOVar v – The variable to be removed. 
- Returns
- True if at least 1 term was removed. 
 
 - string ToString()¶
- Convert the current linear term to its string format - Returns
- The string format of the linear term.