Cplex¶
- CPLEXParamSet(interface)[source]¶
This is a function which returns user specified CPLEX control parameters. It is not necessary to use a file like this if you want to use CPLEX default control parameters. It is intended to be a template for individual users to save with their own problem specific settings for CPLEX.
- USAGE:
cpxControl = CPLEXParamSet (solver)
- INPUT:
interface – ‘tomlab_cplex’(default) or ‘ILOGcomplex’
- OUTPUT:
cpxControl – user specified CPLEX control parameters
Example
% (1) Paddy saves this file as CPLEXParamSetPaddyLPJob1 % (2) Paddy edits CPLEXParamSetPaddyLPJob1 in a problem specific way % (3) Paddy then passes the name of this file to solveCobraLP_CPLEX using something like:
[solution, LPProblem] = solveCobraLP_CPLEX(LPProblem, [], [], [], ‘CPLEXParamSetPaddyLPJob1’);
Note
CPLEX consists of 4 different LP solvers which can be used to solve LP problems you can control which of the solvers, e.g. simplex or interior point solve using the CPLEX control parameter cpxControl.LPMETHOD
- buildCplexProblemFromCOBRAStruct(Problem)[source]¶
Build a cplex object from the given LP problem in COBRA Format
- USAGE:
cplexProblem = buildCplexProblemFromCOBRAStruct (Problem)
- INPUT:
Problem –
A COBRA style Problem with the following fields:
.A - The equality and inequality matrix
.b - The right hand side values of the constraints
.ub - the upper bounds of the variables
.lb - the lower bounds of the variables
.osense - The objective sense (-1 for max, 1 for min)
.c - the objective coefficient vector for the linear part
OPTIONAL:
.F - The objective coefficient matrix for the quadratic part
.vartype - The variable types for mixed integer problems (‘I’, integer, ‘C’, continuous, ‘B’ binary)
.b_L - left hand sides of the constraints (used if .csense does not resolve them)
.b_U - right hand sides of the constraints (used together with .b_L)
.csense - The constraint senses, Default assumption is all ‘E’
.basis - CPLEX advanced-start basis to use
.x0 - starting point to use if .basis is absent
- OUTPUT:
cplexProblem – The Cplex() object built from Problem, with .Model (and, when a starting point is supplied, .Start) populated
- checkSolFeas(LP, sol, maxInfeas, tol, internal)[source]¶
Returns the infeasibility of solutions given a COBRA model or LP structure, or a IBM-ILOG CPLEX class
- USAGE:
[infeas, sol] = checkSolFeas (LP, sol, maxInfeas, tol)
- INPUTS:
LP – COBRA model or LP structure, or a IBM-ILOG CPLEX class, with fields:
.A - m x n LHS matrix (COBRA LP structure), used if .S is absent
.S - m x n stoichiometric matrix (COBRA model), used if .A is absent
.b - RHS vector, used if .rhs is absent
.rhs - RHS vector (gurobi-style LP structure), takes precedence over .b
.csense - constraint senses (COBRA LP/model), used if .sense is absent
.sense - constraint senses (gurobi-style LP structure), takes precedence over .csense
.lb - lower bounds, used when present to compute bound infeasibility
.ub - upper bounds, used when present to compute bound infeasibility
.Model - Cplex object Model property, with fields .A, .lhs, .rhs, .lb, .ub, and optionally .indicator; used only when LP is a Cplex object
.Solution - Cplex object Solution property; .Solution.x is used as sol when the sol input is not supplied; used only when LP is a Cplex object
sol – solution structure or columns of solution vectors. If LP is a CPLEX class with. Solution property sol can be omitted or empty. If a structure, with fields:
.full - full solution vector, read if present
.x - solution vector, read if .full is absent
- OPTIONAL INPUTS:
maxInfeas – if true (defaulted), infeas = maximum infeasiblity if false, infeas = struct of vectors of infeasibility with the following fields:
.con for infeasibility of constraints
.lb for infeasibility of lower bounds
.ub for infeasibility of upper bounds
.ind for infeasibility of indicator constraints. = -Inf if an indicator is not active. (CPLEX class only)
tol – feasibility tolerance (defaulted at the Cobra solver feasTol value). For determining if the input solution is indeed feasible. Used only if the input solution is a structure.
internal – true if this call is an internal recursive call (used to batch large solution matrices mSize columns at a time). Reserved for internal use only; callers should not set this (default false)
- OUTPUTS:
varargout – variable-length output list:
infeas - maximum infeasibility (maxInfeas = true) or struct of vectors of infeasibility (maxInfeas = false)
sol - solution structure, returned only when the input sol was itself a structure. If \(infeas \leq tol\), sol.stat = 1. Otherwise no change.
- cplexStatus(Inform)[source]¶
Analyzes the CPLEX output Inform code and returns the CPLEX solution status message in ExitText and the TOMLAB exit flag in ExitFlag
- USAGE:
[ExitText, ExitFlag] = cplexStatus (Inform)
- INPUT:
Inform – Integer status number from a CPLEX run (S = Simplex, B = Barrier); see the Inform-to-message table in the comment block above this function for the full mapping of values to their meaning
- OUTPUTS:
ExitText – CPLEX solution status message
ExitFlag – Exit status, TOMLAB standard:
0 - Successful
1 - Time/iterations limit exceeded
2 - Unbounded
4 - Infeasible
10 - Input errors
11 - Memory errors
-1 - Other Inform values
- getParamList(param, bottomFlag)[source]¶
Get all the end parameters and their paths for matching CPLEX parameters appropriately (e.g., if param.simplex.display is a parameter, then we will have ‘display’ in paramList and ‘param.simplex’ in paramPath)
- USAGE:
[paramList, paramPath, addCur] = getParamList (param, bottomFlag)
- INPUTS:
param – existing structure with parameters for Cplex
bottomFlag – boolean switch to extract parameters based on ‘Cur’ at the bottom level in the user-supplied parameter structure
- OUTPUTS:
paramList – Cell with proper parameter names
paramPath – Cell with superseeding parameter structure
addCur – Structure with booleans whether or not .Cur has been added to the paramPath for user-supplied parameters
- setCplexParam(LP, solverParams, verbFlag)[source]¶
Sets the parameters of the IBM ILOG CPLEX object according to the structure solverParams The solverParams structure has to contain the same structure as the Cplex.Param structue in a Cplex object. But values can be set by directly setting the respective parameter instead of the Cur value which would be necessary if directly modifying the Cplex.Param structure. :USAGE: LP = setCplexParam (LP, solverParams, verbFlag)
- INPUTS:
LP – IBM-ILOG Cplex object
solverParams – parameter structure for Cplex. Check LP.Param. For example, [solverParams.simplex.display, solverParams.tune.display, solverParams.barrier.display, solverParams.sifting.display, solverParams.conflict.display] = deal(0); [solverParams.simplex.tolerances.optimality, solverParams.simplex.tolerances.feasibility] = deal(1e-9,1e-8);
The full set of parameters can be obtained by calling ‘Cplex().Param’
verbFlag – true to show which parameter input is problematic if any (optional, default true)
- OUTPUT:
LP – the input IBM-ILOG Cplex object, with every uniquely identifiable parameter in solverParams set on LP.Param
- setCplexParametersForProblem(cplexProblem, problemTypeParams, solverParams, problemType)[source]¶
Set the parameters for a specific problem from the COBRA Parameter structure and a solver specific parameter structure (latter has precedence). The cobra parameters structure contains fields as specified in getCobraSolverParamsOptionsForType, while solverParams needs to contain a structure compatible with setCplexParam.
- USAGE:
[cplexProblem, logFile, logToFile] = setCplexParametersForProblem (cplexProblem, problemTypeParams, solverParams, problemType)
- INPUTS:
cplexProblem – the Cplex() object to set the parameters on, with fields:
.setDefault - method resetting all CPLEX parameters to their defaults
.Param - CPLEX parameter tree (e.g. .Param.simplex.tolerances.feasibility.Cur) that this function sets
.DisplayFunc - function handle controlling CPLEX log display; suppressed when problemTypeParams.printLevel is 0, or redirected to logFile
problemTypeParams – problem type parameters as defined in getCobraSolverParamsOptionsForType, with fields:
.printLevel - verbosity level; 0 suppresses CPLEX log output
.logFile - 1 to print to the command window, 0/empty for no logging, otherwise a file name to log to
.feasTol - feasibility tolerance, applied to simplex.tolerances.feasibility and network.tolerances.feasibility
.optTol - optimality tolerance, applied to simplex.tolerances.optimality and network.tolerances.optimality
.relMipGapTol - relative MIP gap tolerance (MILP/MIQP only)
.intTol - integrality tolerance (MILP/MIQP only)
.absMipGapTol - absolute MIP gap tolerance (MILP/MIQP only)
.timeLimit - CPLEX time limit in seconds (MILP/MIQP only)
.method - LP/QP algorithm selector used when problemType is MIQP (numeric legacy code, or ‘AUTOMATIC’/’PRIMAL’/’DUAL’/’NETWORK’/’BARRIER’/’SIFTING’/’CONCURRENT’)
solverParams – the solver specific parameter structure, compatible with setCplexParam, with optional fields:
.qpmethod - QP algorithm selector (numeric, or ‘AUTOMATIC’/’PRIMAL’/’DUAL’/ ‘NETWORK’/’BARRIER’/’CONCURRENT’), used when problemType is ‘QP’
.lpmethod - LP algorithm selector (numeric, or ‘AUTOMATIC’/’PRIMAL’/’DUAL’/ ‘NETWORK’/’BARRIER’/’SIFTING’/’CONCURRENT’), used when problemType is ‘LP’
.multiscale - currently dead code (guarded out); when present, its value is read but never applied
.scaind - matrix scaling parameter, applied to read.scale.Cur
.timelimit - CPLEX time limit in seconds, applied to timelimit.Cur
.secondsTimeLimit - time limit in seconds, multiplied by 5 and applied to timelimit.Cur
.emphasis_numerical - numerical precision emphasis, applied to emphasis.numerical.Cur
.markowitz - Markowitz pivot tolerance, applied to simplex.tolerances.markowitz.Cur
problemType – The type of Problem (‘LP’,’MILP’,’QP’,’MIQP’).
- OUTPUTS:
cplexProblem – the Cplex() object with the resolved parameters set
logFile – the resolved log file identifier: 0 if not logging, 1 for command window output, or an open file identifier
logToFile – true if CPLEX output is being redirected to a file, false otherwise
Note
See https://www.ibm.com/docs/en/icos/12.10.0?topic=cplex-list-parameters and https://www.ibm.com/docs/en/icos/12.10.0 for the full CPLEX parameter reference.
- solveCobraCPLEX(model, printLevel, basisReuse, conflictResolve, contFunctName, minNorm)[source]¶
Calls CPLEX to solve an LP or QP problem using the matlab API to cplex written by ILOG
- USAGE:
[solution, model] = solveCobraCPLEX (model, printLevel, basisReuse, conflictResolve, contFunctName, minNorm)
- INPUT:
model – structure with mandatory and optional fields:
.A or .S: - m x n LHS matrix
.b - m x 1 RHS vector
.c - n x 1 Objective coeff vector
.lb - n x 1 Lower bound vector
.ub - n x 1 Upper bound vector
.osense - scalar Objective sense (-1 max, +1 min)
.rxns - (optional) cell array of reaction abbreviations (necessary for making a readable confilict resolution file).
.mets - (optional) cell array of metabolite abbreviations (necessary for making a readable confilict resolution file).
.csense - (optional) Constraint senses, a string containting the constraint sense for each row in A (‘E’, equality, ‘G’ greater than, ‘L’ less than).
.LPBasis - (optional) Basis from previous solution of similar LP problem. See basisReuse
- OPTIONAL INPUTS:
printLevel – Printing level in the CPLEX m-file and CPLEX C-interface.
0 - Silent
1 - Warnings and Errors
2 - Summary information (Default)
3 - More detailed information
> 10 - Pause statements, and maximal printing (debug mode)
basisReuse – 0 - Use this for one of solution of an LP (Default); 1 - Returns a basis for reuse in the next LP i.e. outputs model.LPBasis
conflictResolve – 0 (Default); 1 If LP problem is proven to be infeasible by CPLEX, it will print out a ‘conflict resolution file’, which indicates the irreducible infeasible set of equaltiy & inequality constraints that together, combine to make the problem infeasible. This is useful for debugging an LP problem if you want to try to resolve a constraint conflict
contFunctName –
contFunctName = [] Use all default CLPEX control parameters, (Default);
2. contFunctName = someString e.g. ‘someFunctionName’ uses the user specified control parameters defined in someFunctionName.m; (see template function CPLEXParamSet for details). 3. contFunctName = cpxControl structure (output from a file like CPLEXParamSet.m)
minNorm – {(0), 1 , n x 1 vector} If not zero then, minimise the Euclidean length of the solution to the LP problem. Gives the same objective, but minimises the square of flux. minNorm ~1e-6 should be high enough for regularisation yet keep the same objective
- OUTPUT:
solution – Structure containing the following fields describing a LP solution:
.full: Full LP solution vector
.obj: Objective value
.rcost: Lagrangian multipliers to the simple inequalties (Reduced costs)
.dual: Lagrangian multipliers to the equalities
.nInfeas: Number of infeasible constraints
.sumInfeas: Sum of constraint violation
.stat: COBRA Standardized solver status code:
1 - Optimal solution
2 - Unbounded solution
0 - Infeasible
-1 - No solution reported (timelimit, numerical problem etc)
.origStat: CPLEX status code. Use cplexStatus(solution.origStat) for more information from the CPLEX solver
.solver solver used by cplex
.time time taken to solve the optimization problem
- OPTIONAL OUTPUT:
model: with field:
.LPBasis - When input basisReuse=1, we return a basis for reuse in the next LP
CPLEX consists of 4 different LP solvers which can be used to solve sysbio optimization problems you can control which of the solvers, e.g. simplex vs interior point solver using the CPLEX control parameter cpxControl.LPMETHOD. At the moment, the solver is automatically chosen for you.
- solveCobraLPCPLEX(LPProblem, printLevel, basisReuse, conflictResolve, contFunctName, minNorm, interface)[source]¶
Calls CPLEX to solve an LP problem By default, use the matlab interface to cplex written by TOMLAB, in preference to the one written by ILOG.
- USAGE:
[solution, LPProblem] = solveCobraLPCPLEX (LPProblem, printLevel, basisReuse, conflictResolve, contFunctName, minNorm, interface)
- INPUT:
LPProblem – Structure containing the following fields describing the LP problem to be solved
.A - LHS matrix
.S - stoichiometric matrix, used if .A is absent
.b - RHS vector
.c - Objective coeff vector
.lb - Lower bound vector
.ub - Upper bound vector
.osense - Objective sense (-1 maximise (default), +1 minimise)
.rxns - (optional) cell array of reaction abbreviations (necessary for making a readable confilict resolution file).
.mets - (optional) cell array of metabolite abbreviations (necessary for making a readable confilict resolution file).
.csense - (optional) Constraint senses, a string containting the constraint sense for each row in A (‘E’, equality, ‘G’ greater than, ‘L’ less than).
.LPBasis - (optional) Basis from previous solution of similar LP problem. See basisReuse
- OPTIONAL INPUTS:
printLevel – Printing level in the CPLEX m-file and CPLEX C-interface.
0 - Silent
1 - Warnings and Errors
2 - Summary information (Default)
3 - More detailed information
> 10 - Pause statements, and maximal printing (debug mode)
basisReuse – 0 - Use this for one of solution of an LP (Default); 1 - Returns a basis for reuse in the next LP i.e. outputs model.LPBasis
conflictResolve – 0 (Default); 1 If LP problem is proven to be infeasible by CPLEX, it will, for…
tomlab_cplex print out a ‘conflict resolution file’ ILOGcomplex return the ILOGcplex class with ILOGcplex.Conflict
… which indicate the irreducible infeasible set of equaltiy & inequality constraints that together, combine to make the problem infeasible. This is useful for debugging an LP problem if you want to try to resolve a constraint conflict
contFunctName – structure or function with parameters (only for tomlab_cplex or ILOGcomplex)
when using the tomlab_cplex interface
contFunctName = [] Use all default CLPEX control parameters, (Default);
contFunctName = someString e.g. ‘someFunctionName’ uses the user specified control parameters defined in someFunctionName.m (see template function CPLEXParamSet for details).
contFunctName = cpxControl structure (output from a file like CPLEXParamSet.m)
when using the ILOGcomplex interface (parameter structure for Cplex). The full set of parameters can be obtained by calling Cplex().Param. For example:
[solverParams.simplex.display, solverParams.tune.display, solverParams.barrier.display, solverParams.sifting.display, solverParams.conflict.display] = deal(0);
[solverParams.simplex.tolerances.optimality, solverParams.simplex.tolerances.feasibility] = deal(1e-9, 1e-8);
minNorm – {(0), 1 , n x 1 vector} If not zero then, minimise the Euclidean length of the solution to the LP problem. Gives the same objective, but minimises the square of flux. minNorm ~1e-6 should be high enough for regularisation yet keep the same objective
interface – {‘ILOGcomplex’, ‘ILOGsimple’, ‘tomlab_cplex’} Default is the tomlab_cplex interface
- OUTPUT:
solution – Structure containing the following fields describing a LP solution:
.full: Full LP solution vector
.obj: Objective value
.rcost: Lagrangian multipliers to the simple inequalties (Reduced costs)
.dual: Lagrangian multipliers to the equalities
.nInfeas: Number of infeasible constraints
.sumInfeas: Sum of constraint violation
.stat: COBRA Standardized solver status code:
1 - Optimal solution
2 - Unbounded solution
0 - Infeasible
-1 - No solution reported (timelimit, numerical problem etc)
.origStat: CPLEX status code
.origStatText: CPLEX status text from `cplexStatus(solution.origStat)
.solver solver used by cplex
.time time taken to solve the optimization problemtime taken to solve the optimization problem
- OPTIONAL OUTPUT:
LPProblem: with field:
.LPBasis: When input basisReuse = 1, we return a basis for reuse in the next LP
ILOGcplex: Class Cplex for the optimisation problem
- solveCobraLPCPLEX_2018(LPProblem, printLevel, basisReuse, conflictResolve, contFunctName, minNorm, interface)[source]¶
Calls CPLEX to solve an LP problem By default, use the matlab interface to cplex written by TOMLAB, in preference to the one written by ILOG.
- USAGE:
[solution, LPProblem] = solveCobraLPCPLEX (LPProblem, printLevel, basisReuse, conflictResolve, contFunctName, minNorm, interface)
- INPUT:
LPProblem – Structure containing the following fields describing the LP problem to be solved
.A - LHS matrix
.S - stoichiometric matrix, used if .A is absent
.b - RHS vector
.c - Objective coeff vector
.lb - Lower bound vector
.ub - Upper bound vector
.osense - Objective sense (-1 max, +1 min)
.rxns - (optional) cell array of reaction abbreviations (necessary for making a readable confilict resolution file).
.mets - (optional) cell array of metabolite abbreviations (necessary for making a readable confilict resolution file).
.csense - (optional) Constraint senses, a string containting the constraint sense for each row in A (‘E’, equality, ‘G’ greater than, ‘L’ less than).
.LPBasis - (optional) Basis from previous solution of similar LP problem. See basisReuse
- OPTIONAL INPUTS:
printLevel – Printing level in the CPLEX m-file and CPLEX C-interface.
0 - Silent
1 - Warnings and Errors
2 - Summary information (Default)
3 - More detailed information
> 10 - Pause statements, and maximal printing (debug mode)
basisReuse – 0 - Use this for one of solution of an LP (Default); 1 - Returns a basis for reuse in the next LP i.e. outputs model.LPBasis
conflictResolve – 0 (Default); 1 If LP problem is proven to be infeasible by CPLEX, it will print out a ‘conflict resolution file’, which indicates the irreducible infeasible set of equaltiy & inequality constraints that together, combine to make the problem infeasible. This is useful for debugging an LP problem if you want to try to resolve a constraint conflict
contFunctName – structure or function with parameters (only for tomlab_cplex or ILOGcomplex)
when using the tomlab_cplex interface
contFunctName = [] Use all default CLPEX control parameters, (Default);
contFunctName = someString e.g. ‘someFunctionName’ uses the user specified control parameters defined in someFunctionName.m (see template function CPLEXParamSet for details).
contFunctName = cpxControl structure (output from a file like CPLEXParamSet.m)
when using the ILOGcomplex interface (parameter structure for Cplex). The full set of parameters can be obtained by calling Cplex().Param. For example:
[solverParams.simplex.display, solverParams.tune.display, solverParams.barrier.display, solverParams.sifting.display, solverParams.conflict.display] = deal(0);
[solverParams.simplex.tolerances.optimality, solverParams.simplex.tolerances.feasibility] = deal(1e-9, 1e-8);
minNorm – {(0), 1 , n x 1 vector} If not zero then, minimise the Euclidean length of the solution to the LP problem. Gives the same objective, but minimises the square of flux. minNorm ~1e-6 should be high enough for regularisation yet keep the same objective
interface – {‘ILOGcomplex’, ‘ILOGsimple’, ‘tomlab_cplex’} Default is the tomlab_cplex interface
- OUTPUT:
solution – Structure containing the following fields describing a LP solution:
.full: Full LP solution vector
.obj: Objective value
.rcost: Lagrangian multipliers to the simple inequalties (Reduced costs)
.dual: Lagrangian multipliers to the equalities
.nInfeas: Number of infeasible constraints
.sumInfeas: Sum of constraint violation
.stat: COBRA Standardized solver status code:
1 - Optimal solution
2 - Unbounded solution
0 - Infeasible
-1 - No solution reported (timelimit, numerical problem etc)
.origStat: CPLEX status code. Use cplexStatus(solution.origStat) for more information from the CPLEX solver
.solver solver used by cplex
.time time taken to solve the optimization problemtime taken to solve the optimization problem
- OPTIONAL OUTPUT:
LPProblem: with field:
.LPBasis: When input basisReuse = 1, we return a basis for reuse in the next LP
CPLEX consists of 4 different LP solvers which can be used to solve sysbio optimization problems you can control which of the solvers, e.g. simplex vs interior point solver using the CPLEX control parameter cpxControl.LPMETHOD. At the moment, the solver is automatically chosen for you
- solveCobraLPCPLEXcard(LPProblem, printLevel, basisReuse, conflictResolve, contFunctName, minNorm, theNorm)[source]¶
Calls CPLEX to solve an LP problem By default, use the matlab interface to cplex written by TOMLAB, in preference to the one written by ILOG.
- USAGE:
solveCobraLPCPLEXcard (LPProblem, printLevel, basisReuse, conflictResolve, contFunctName, minNorm, theNorm)
- INPUT:
LPProblem – structure with mandatory and optional fields:
.A or .S: - m x n LHS matrix
.b - m x 1 RHS vector
.c - n x 1 Objective coeff vector
.lb - n x 1 Lower bound vector
.ub - n x 1 Upper bound vector
.osense - scalar Objective sense (-1 max, +1 min)
.rxns - (optional) cell array of reaction abbreviations (necessary for making a readable confilict resolution file).
.mets - (optional) cell array of metabolite abbreviations (necessary for making a readable confilict resolution file).
.csense - (optional) Constraint senses, a string containting the constraint sense for each row in A (‘E’, equality, ‘G’ greater than, ‘L’ less than).
.LPBasis - (optional) Basis from previous solution of similar LP problem. See basisReuse
.reversibleModel - (optional) 0 if the model has been split into forward/reverse reactions (irreversible), used to determine the sign of the cardinality-approximation objective; any other value is treated as a reversible model
- OPTIONAL INPUTS:
printLevel – Printing level in the CPLEX m-file and CPLEX C-interface.
0 - Silent
1 - Warnings and Errors
2 - Summary information (Default)
3 - More detailed information
> 10 - Pause statements, and maximal printing (debug mode)
basisReuse – 0 - Use this for one of solution of an LP (Default); 1 - Returns a basis for reuse in the next LP i.e. outputs model.LPBasis
conflictResolve – 0 (Default); 1 If LP problem is proven to be infeasible by CPLEX, it will print out a ‘conflict resolution file’, which indicates the irreducible infeasible set of equaltiy & inequality constraints that together, combine to make the problem infeasible. This is useful for debugging an LP problem if you want to try to resolve a constraint conflict
contFunctName – = [] Use all default CLPEX control parameters, (Default); = someString e.g. ‘someFunctionName’ uses the user specified control parameters defined in someFunctionName.m (see template function CPLEXParamSet for details). = cpxControl structure (output from a file like CPLEXParamSet.m)
minNorm – {(0), 1 , n x 1 vector} If not zero then, minimise the Euclidean length of the solution to the LP problem. Gives the same objective, but minimises the square of flux. minNorm ~1e-6 should be high enough for regularisation yet keep the same objective
theNorm – {‘zero’, ‘one’, (‘two’)} Controls which norm is minimized. ‘zero’ minimizes cardinality for nonzero entries in minNorm, ‘one’ minimizes taxicab norm for nonzero entries in minNorm (not implemented), ‘two’ minimizes Euclidean norm for nonzero entries in minNorm (default)
- OUTPUT:
solution – Structure containing the following fields describing a LP solution:
.full: Full LP solution vector
.obj: Objective value
.rcost: Lagrangian multipliers to the simple inequalties (Reduced costs)
.dual: Lagrangian multipliers to the equalities
.nInfeas: Number of infeasible constraints
.sumInfeas: Sum of constraint violation
.stat: COBRA Standardized solver status code:
1 - Optimal solution
2 - Unbounded solution
0 - Infeasible
-1 - No solution reported (timelimit, numerical problem etc)
.origStat: CPLEX status code. Use cplexStatus(solution.origStat) for more information from the CPLEX solver
.solver solver used by cplex
.time time taken to solve the optimization problem
- OPTIONAL OUTPUT:
LPProblem: with field:
.LPBasis: When input basisReuse = 1, we return a basis for reuse in the next LP
CPLEX consists of 4 different LP solvers which can be used to solve sysbio optimization problems you can control which of the solvers, e.g. simplex vs interior point solver using the CPLEX control parameter cpxControl.LPMETHOD. At the moment, the solver is automatically chosen for you.
- tuneParam(LPProblem, contFunctName, timelimit, nrepeat, printLevel)[source]¶
Optimizes cplex parameters to make model resolution faster. Particularly interetsing for large-scale MILP models and repeated runs of optimisation. While, it won’t optimize memory space nor model constraints for numerical infeasibilities, tuneParam will provide the optimal set of solver parameters for feasbile models. It requires IBM ILOG cplex (for now).
- USAGE:
optimalParameters = tuneParam (LPProblem,contFunctName,timelimit,nrepeat,printLevel)
- INPUT:
LPProblem – MILP as COBRA LP problem structure, with fields:
.A or .S - m x n LHS/stoichiometric matrix
.b - RHS vector
.c - Objective coefficient vector
.lb - Lower bound vector
.ub - Upper bound vector
.osense - Objective sense (-1 max, +1 min)
.csense - Constraint senses, a string containing the constraint sense for each row in A (‘E’, equality, ‘G’ greater than, ‘L’ less than)
contFunctName – Parameters structure containing the name and value, OR the name of a function that returns such a structure (e.g. ‘CPLEXParamSet’), OR [] for defaults. A set of routine parameters will be added by the solver but won’t be reported.
- OPTIONAL INPUTS:
timelimit – CPX_PARAM_TUNINGTILIM in seconds (default: 10000)
nrepeat – CPX_PARAM_TUNINGREPEAT, number of row/column permutations of the original problem (default: 1). High values require consequent memory and swap.
printLevel – 0/(1)/2/3
- OUTPUT:
optimParam – structure of optimal parameter values directly usable as contFunctName argument in solveCobraLP function
- tuneParamForModel(model, varargin)[source]¶
Optimizes cplex parameters to make model resolution faster. Particularly interetsing for large-scale MILP models and repeated runs of optimisation. While, it won’t optimize memory space nor model constraints for numerical infeasibilities, tuneParam will provide the optimal set of solver parameters for feasbile models. It requires IBM ILOG cplex (for now).
- USAGE:
optimParam = tuneParamForModel (model, contFunctName, timelimit, nrepeat, printLevel)
- INPUT:
model – A COBRA model struct.
- OPTIONAL INPUTS:
varargin – forwarded, in order, to tuneParam after converting model to an LP problem:
contFunctName - Parameters structure containing the name and value. A set of routine parameters will be added by the solver but won’t be reported.
timelimit - default is 10000 second
nrepeat - number of row/column permutation of the original problem, reports robust results. sets the CPX_PARAM_TUNINGREPEAT parameter High values of nrepeat would require consequent memory and swap.
printLevel - 0/1/2/3
- OUTPUT:
optimParam – structure of optimal parameter values directly usable as contFunctName argument in solveCobraLP function
Note
This is just a wrapper function that calls the tuneParam function using a Cobra model structure converted to a LP problem.