|
My Project
|
#include <MILP_Model.h>
Public Types | |
| enum | VarType { REAL, INTEGER, BOOLEAN } |
| enum | RowType { LEQ, GEQ, EQ } |
| Types of variables. | |
| enum | Status { OPTIMAL, NONOPTIMAL, UNFEASIBLE, UNBOUNDED, UNKNOWN, ERROR } |
| Type of constraints. | |
| using | Term = pair< double, int > |
| Type of solution. | |
| using | vecTerms = vector< Term > |
| Type to represent a term (coefficient, var index) | |
| using | vecVars = vector< int > |
| Vector of terms. | |
Public Member Functions | |
| Milp_Model (const string &solver="") | |
| Vector of variables. More... | |
| const string & | getError () const |
| void | setError (const string &err="") |
| Defines the error message of the object (no error by default). More... | |
| void | setMinimize () |
| Defines a model to minimize the cost function. | |
| void | setMaximize () |
| Defines a model to maximize the cost function. | |
| void | setEpsilon (double eps) |
| Defines the min epsilon value to distinguish from zero. More... | |
| int | numVariables () const |
| int | numConstraints () const |
| int | newRealVar (string name="", double lower_bound=0.0, double upper_bound=-1.0) |
| Creates a new real variable. More... | |
| int | newIntegerVar (string name="", double lower_bound=0, double upper_bound=-1) |
| Creates a new integer variable. More... | |
| int | newBooleanVar (string name="") |
| Creates a new Boolean variable. More... | |
| Status | getStatus () const |
| double | getObj () const |
| double | operator[] (int i) const |
| Returns the value of a variable. More... | |
| double | operator[] (const string &name) const |
| Returns the value of a variable. More... | |
| bool | isTrue (int i) const |
| Checks whether the value of a boolean variable is true. More... | |
| bool | isFalse (int i) const |
| Checks whether the value of a boolean variable is false. More... | |
| int | newRow (char type='<', double rhs=0.0, const string &name="") |
| Creates a new row in the constraint matrix. More... | |
| int | newRow (const vecTerms &terms, char type='<', double rhs=0.0, const string &name="") |
| Creates a new row in the constraint matrix from a vector of terms. More... | |
| void | newTerm (int rowIndex, double coeff, int varIndex) |
| Adds a new term to a constraint. More... | |
| void | setRHS (int rowIndex, double rhs) |
| Defines the RHS of a constraint. More... | |
| int | atMostOne (const vecVars &vars, const string &name="") |
| Creates an at-most-one constraint (v1+...+vn <= 1). More... | |
| int | atLeastOne (const vecVars &vars, const string &name="") |
| Creates an at-least-one constraint (v1+...+vn >= 1). More... | |
| int | exactlyOne (const vecVars &vars, const string &name="") |
| Creates an exactly-one constraint (v1+...+vn = 1). More... | |
| int | equalSum (const vecVars &x, const vecVars &y, const string &name="") |
| Creates a constraint indicating that the sum of a set of variables must be equal to the sum of another set, i.e., x1 + ... + xn = y1 + ... + ym. More... | |
| int | allEqual (const vecVars &v) |
| Creates a set of constraints that enforces a set of variables to have the same value. More... | |
| int | implies (int x, const vecVars &y) |
| Creates a constraint representing the Boolean implication x => y1 + ... + ym. More... | |
| int | implies (const vecVars &x, int y) |
| Creates a set of constraints representing the Boolean implication x1 + ... + xn => y. More... | |
| void | newCostTerm (double coeff, int varIndex) |
| Adds a new term to the cost function. More... | |
| bool | writeLP (const string &filename) |
| Write the LP model into a file in CPLEX LP format. More... | |
| bool | solve (int timelimit=-1) |
| Calls the MILP solver. More... | |
| bool | init (const string &solver="") |
| Initializes the MILP model. More... | |
| void | writeOutDelays (const string &file_name) |
| Writes a output file to save output pin timing to retrieve critical path. More... | |
| string | getVarName (int id) |
| Get variables names. More... | |
|
inline |
Vector of variables.
Default constructor.
|
inline |
Creates a set of constraints that enforces a set of variables to have the same value.
| v | The vector of variables. |
|
inline |
Creates an at-least-one constraint (v1+...+vn >= 1).
| vars | The variables of the constraint. |
| name | The name of the constraint. |
|
inline |
Creates an at-most-one constraint (v1+...+vn <= 1).
| vars | The variables of the constraint. |
| name | The name of the constraint. |
Creates a constraint indicating that the sum of a set of variables must be equal to the sum of another set, i.e., x1 + ... + xn = y1 + ... + ym.
| x | The first set of variables. |
| y | The second set of variables. |
| name | The name of the constraint. |
|
inline |
Creates an exactly-one constraint (v1+...+vn = 1).
| vars | The variables of the constraint. |
| name | The name of the constraint. |
|
inline |
|
inline |
|
inline |
|
inline |
Get variables names.
| id | variable id |
|
inline |
Creates a constraint representing the Boolean implication x => y1 + ... + ym.
| x | The variable in the antecedent. |
| y | The set of variables in the consequent. |
|
inline |
Creates a set of constraints representing the Boolean implication x1 + ... + xn => y.
| x | The set of variables in the antecedent. |
| y | The variable in the consequent. |
|
inline |
Initializes the MILP model.
| solver | Name of the MILP solver. |
|
inline |
Checks whether the value of a boolean variable is false.
| i | Index of the variable. |
|
inline |
Checks whether the value of a boolean variable is true.
| i | Index of the variable. |
|
inline |
Creates a new Boolean variable.
| name | Name of the variable. |
|
inline |
Adds a new term to the cost function.
| coeff | Coefficient of the term. |
| varIndex | Index of the variable. |
|
inline |
Creates a new integer variable.
| name | Name of the variable. |
| lower_bound | Lower bound. |
| upper_bound | Upper bound (unbounded if upper_bound < lower_bound). |
|
inline |
Creates a new real variable.
| name | Name of the variable. |
| lower_bound | Lower bound |
| upper_bound | Upper bound (unbounded if upper_bound < lower_bound). |
|
inline |
Creates a new row in the constraint matrix.
| type | Type of row ('<', '>', '='). |
| rhs | RHS of the constraint. |
| name | Name of the row. |
|
inline |
Creates a new row in the constraint matrix from a vector of terms.
| terms | Vector of terms (pairs of {coeff, var index}). |
| type | Type of row ('<', '>', '='). |
| rhs | RHS of the constraint. |
| name | Name of the constraint. |
|
inline |
Adds a new term to a constraint.
| rowIndex | Index of the constraint. |
| coeff | Coefficient of the term. |
| varIndex | Index of the variable. |
|
inline |
|
inline |
Returns the value of a variable.
| i | Index of the variable. |
|
inline |
Returns the value of a variable.
| name | Name of the variable. |
|
inline |
Defines the min epsilon value to distinguish from zero.
| eps | Epsilon value. |
|
inline |
Defines the error message of the object (no error by default).
| err | Error message. |
|
inline |
Defines the RHS of a constraint.
| rowIndex | Index of the constraint. |
| rhs | RHS value. |
|
inline |
Calls the MILP solver.
| timelimit | Time limit in seconds. No limit if <= 0. |
|
inline |
Write the LP model into a file in CPLEX LP format.
| filename | Name of the file. |
|
inline |
Writes a output file to save output pin timing to retrieve critical path.
| file_name | name of the file where to save the output |
1.8.13