Solvers¶
MATLAB functions in RAVEN/solver of the RAVEN toolbox. Help text is collected from the source of the tracked branch.
Functions¶
| Function | Summary |
|---|---|
checkSolution |
Check if a Mosek solution is feasible and optimal. |
optimizeProb |
Optimize an LP or MILP formulated in COBRA terms. |
qMOMA |
Minimize sum((fluxAi - fluxBi)^2) via quadratic programming. |
setRavenSolver |
Set the solver for RAVEN. |
solveLP |
Solve a linear programming problem. |
splitProbForConditioning |
Improve LP conditioning by splitting wide columns. |
Reference¶
checkSolution¶
Check if a Mosek solution is feasible and optimal.
Input arguments:
| Name | Type | Description | Default |
|---|---|---|---|
res
|
struct
|
the output structure from mosekopt. |
required |
Output arguments:
| Name | Type | Description |
|---|---|---|
isFeasible
|
logical
|
true if the solution is feasible. |
isOptimal
|
logical
|
true if the solution is optimal. |
Examples:
[isFeasible, isOptimal] = checkSolution(res);
Notes
This function also throws an error if the license has expired.
optimizeProb¶
Optimize an LP or MILP formulated in COBRA terms.
Input arguments:
| Name | Type | Description | Default |
|---|---|---|---|
prob
|
struct
|
COBRA-style LP/MILP problem struct to be optimised. |
required |
Name-value arguments:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
struct
|
solver-specific parameters. In addition to solver parameters, the field "maxRatio" can be set to a number > 1 to improve numerical conditioning: before solving (LP only) any column whose coefficients span more than maxRatio is split via auxiliary metabolites/variables, preserving the feasible region. See splitProbForConditioning. The field is consumed here and not forwarded to the solver. |
|
verbose
|
logical
|
if true MILP progress is shown (default true). |
Output arguments:
| Name | Type | Description |
|---|---|---|
res
|
struct
|
the output structure from the selected solver RAVENSOLVER (COBRA style). |
See also
splitProbForConditioning
qMOMA¶
Minimize sum((fluxAi - fluxBi)^2) via quadratic programming.
Input arguments:
| Name | Type | Description | Default |
|---|---|---|---|
modelA
|
struct
|
a model structure for the test case. This model must be a subset of modelB (no reactions that are not in modelB). |
required |
modelB
|
struct
|
a model structure for the reference case. |
required |
Name-value arguments:
| Name | Type | Description | Default |
|---|---|---|---|
fluxMinWeight
|
double
|
a value >= 1 that determines whether minimization of the sum of fluxes should also be taken into account in the optimization. A value of 2.0 means that sum(fluxAi)^2 + sum(fluxBi)^2 has equal weight as sum((fluxAi - fluxBi)^2). Values of around 1.01 should be enough to get rid of loops (default 1). |
Output arguments:
| Name | Type | Description |
|---|---|---|
fluxA
|
double
|
the resulting flux distribution in the test model. |
fluxB
|
double
|
the resulting flux distribution in the reference model. |
flag
|
double
|
1 if the optimization terminated successfully. |
Examples:
[fluxA, fluxB, flag] = qMOMA(modelA, modelB, fluxMinWeight);
setRavenSolver¶
Set the solver for RAVEN.
Sets the solver for RAVEN and optionally saves a default value to MATLAB startup.
Input arguments:
| Name | Type | Description | Default |
|---|---|---|---|
solver
|
char
|
string with solver name. The following options are available:
|
required |
Examples:
setRavenSolver(solver);
solveLP¶
Solve a linear programming problem.
Input arguments:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
struct
|
a model structure. |
required |
Name-value arguments:
| Name | Type | Description | Default |
|---|---|---|---|
minFlux
|
double
|
determines if a second optimization should be performed in order to get rid of loops in the flux distribution (default 0):
|
|
params
|
struct
|
solver parameters, forwarded to optimizeProb. Mostly obsolete, but the field "maxRatio" (a number > 1) can be set to improve numerical conditioning of ill-scaled models: any reaction whose stoichiometric coefficients span more than maxRatio is transiently split via auxiliary metabolites before solving, which preserves the feasible region (and thus the flux distribution of the original reactions). A common value is 1e6 (no splitting by default). |
|
hsSol
|
struct
|
hot-start solution for the LP solver. This can significantly speed up the process if many similar optimization problems are solved iteratively. Only used if minFlux is 0 or 1. |
Output arguments:
| Name | Type | Description |
|---|---|---|
solution
|
struct
|
LP solution with fields:
|
hsSolOut
|
struct
|
solution to be used as hot-start solution (see the input parameters). Only used if minFlux is 0 or 1. |
Examples:
[solution, hsSolOut] = solveLP(model, minFlux, params, hsSol);
splitProbForConditioning¶
Improve LP conditioning by splitting wide columns.
Reformulates an LP problem to improve its numerical conditioning by splitting columns whose coefficients span more than a given ratio. In a metabolic model a column corresponds to a reaction, and a wide spread of stoichiometric coefficients within one reaction (e.g. a biomass reaction with both major substrates and trace cofactors) cannot be removed by the diagonal row/column scaling that LP solvers apply, and may lead to unreliable solutions or spurious infeasibility.
Each offending small coefficient is replaced by a chain consisting of an auxiliary "star" metabolite (a new equality constraint row) and one or more conversion variables (new columns), such that no individual column has a coefficient ratio exceeding maxRatio. The feasible region of the original problem is preserved exactly: the new rows are steady-state (=0) constraints and the new variables are fully determined by them, so the values of all original variables are unchanged.
The function is meant to be called inside optimizeProb, on the COBRA-style problem struct, immediately before the problem is passed to the solver. The auxiliary rows are appended at the bottom of prob.A and the auxiliary columns at the right, so the indices of all original constraints and variables are preserved. This allows the augmentation to be stripped from the solver output (see condInfo).
Input arguments:
| Name | Type | Description | Default |
|---|---|---|---|
prob
|
struct
|
COBRA-style LP problem struct, with at least the fields A, b, c, lb, ub, csense and vartype. |
required |
maxRatio
|
double
|
maximum allowed ratio between the largest and smallest absolute coefficient within any single column. |
required |
Output arguments:
| Name | Type | Description |
|---|---|---|
prob
|
struct
|
the (possibly) augmented problem struct. Identical to the input if no column needed splitting. |
condInfo
|
struct
|
struct describing the augmentation, with fields:
|
Examples:
[prob, condInfo] = splitProbForConditioning(prob, maxRatio);
See also
optimizeProb