|
|
Trees | Indices | Help |
|
|---|
| Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
| Class Variables | |
status = PresolveStatus()See PresolveStatus() |
|
method = PresolveMethod()See PresolveMethod() |
|
col_status = PresolveColStatus()See PresolveColStatus() |
|
row_status = PresolveRowStatus()See PresolveRowStatus() |
|
| Method Details |
Crushes a linear formula down into the presolved space. formula may either be an instance of the SparsePair class or a sequence of length two, the first entry of which contains variable names or indices, the second entry of which contains the float values associated with those variables. Returns a (crushed_formula, offset) pair, where crushed_formula is a SparsePair object containing the crushed formula in terms of the presolved variables and offset is the value of the linear formula corresponding to variables that have been removed in the presolved problem. >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) >>> c.presolve.crush_formula(cplex.SparsePair(ind = [1, 2], val = [1.0] * 2)) (SparsePair(ind = [1, 2], val = [1.0, 1.0]), 0.0) |
Projects a primal solution down to the presolved space. x must be a list of floats with length equal to the number of variables in the original problem. Returns a list of floats with length equal to the number of variables in the presolved problem. >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) >>> c.presolve.crush_x([1.0] * 4) [1.0, 1.0, 1.0] |
Projects a dual solution down to the presolved space. pi must be a list of floats with length equal to the number of linear constraints in the original problem. Returns a list of floats with length equal to the number of linear constraints in the presolved problem. >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) >>> c.presolve.crush_pi([1.0] * 4) [1.0, 1.0, 1.0] |
Uncrushes a linear formula up from the presolved space. formula may either be an instance of the SparsePair class or a sequence of length two, the first entry of which contains variable names or indices, the second entry of which contains the float values associated with those variables. Returns a (formula, offset) pair, where formula is a SparsePair object containing the formula in terms of variables in the original problem and offset is the value of the linear formula corresponding to variables that have been removed in the presolved problem. >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) >>> c.presolve.uncrush_formula(cplex.SparsePair(ind = [1, 2], val = [1.0] * 2)) (SparsePair(ind = [1, 2], val = [1.0, 1.0]), 0.0) |
Projects a primal presolved solution up to the original space. x must be a list of floats with length equal to the number of variables in the presolved problem. Returns a list of floats with length equal to the number of variables in the original problem. >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) >>> c.presolve.uncrush_x([1.0] * 3) [1.0, 1.0, 1.0, 0.0] |
Projects a dual presolved solution up to the presolved space. pi must be a list of floats with length equal to the number of linear constraints in the presolved problem. Returns a list of floats with length equal to the number of linear constraints in the original problem. >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) >>> c.presolve.uncrush_pi([1.0] * 3) [1.0, 1.0, 1.0, 0.0] |
Frees the presolved problem. Example usage: >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) >>> c.presolve.free() |
Returns the status of presolve. Returns an attribute of Cplex.presolve.status. >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) >>> c.presolve.get_status() 1 |
Returns the status of the original linear constraints. Returns a list of integers with length equal to the number of linear constraints in the original problem. Each entry of this list is an attribute of Cplex.presolve.row_status. >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) >>> c.presolve.get_row_status() [-3, 1, 2, -3] |
Returns the status of the original variables. Returns a list of integers with length equal to the number of variables in the original problem. Each entry of this list is an attribute of Cplex.presolve.col_status. >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) >>> c.presolve.get_col_status() [0, 1, 2, -5] |
Returns the status of the presolved linear constraints. Returns a list of integers with length equal to the number of linear constraints in the presolved problem. -1 indicates that the presolved linear constraint corresponds to more than one linear constraint in the original problem. Otherwise the value is the index of the corresponding linear constraint in the original problem. >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) >>> c.presolve.get_presolved_row_status() [-1, 1, 2] |
Returns the status of the presolved variables. Returns a list of integers with length equal to the number of variables in the presolved problem. -1 indicates that the presolved variable corresponds to a linear combination of more than one variable in the original problem. Otherwise the value is the index of the corresponding variable in the original problem. >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) >>> c.presolve.get_presolved_col_status() [0, 1, 2] |
Adds linear constraints to the presolved problem. presolve.add_rows accepts the keyword arguments lin_expr, senses, rhs, and names. If more than one argument is specified, all arguments must have the same length. lin_expr may be either a list of SparsePair instances or a matrix in list-of-lists format.
senses must be either a list of single-character strings or a string containing the types of the variables. rhs is a list of floats, specifying the righthand side of each linear constraint. names is a list of strings. The specified constraints are added to both the original problem and the presolved problem. |
Sets the linear objective function of the presolved problem. objective must be either a SparsePair instance or a list of two lists, the first of which contains variable indices or names, the second of which contains floats. The objective function of both the original problem and the presolved problem are changed. |
Solves the presolved problem. method must be an attribute of Cplex.presolve.method. >>> import cplex >>> c = cplex.Cplex() >>> out = c.set_results_stream(None) >>> out = c.set_log_stream(None) >>> c.read("example.mps") >>> c.presolve.presolve(c.presolve.method.dual) |
|
|
Trees | Indices | Help |
|
|---|