symphonymat
Solves a mixed integer linear programming constrained optimization problem in intlinprog format.
Calling Sequence
xopt = symphonymat(c,intcon,A,b)
xopt = symphonymat(c,intcon,A,b,Aeq,beq)
xopt = symphonymat(c,intcon,A,b,Aeq,beq,lb,ub)
xopt = symphonymat(c,intcon,A,b,Aeq,beq,lb,ub,options)
[xopt,fopt,status,output] = symphonymat( ... )
Input Parameters
c :
A vector of doubles, containing the coefficients of the variables in the objective function.
intcon :
A vector of integer constraints, specified as a vector of positive integers. The values in intcon indicate the components of the decision variable x that are integer-valued. intcon has values from 1 to n where n is the number of variable.
A :
A matrix of doubles, containing the coefficients of linear inequality constraints of size (m X n) where 'm' is the number of linear inequality constraints.
b :
A vector of doubles, related to 'A' and represents the linear coefficients in the linear inequality constraints of size (m X 1).
Aeq :
A matrix of doubles, containing the coefficients of linear equality constraints of size (m1 X n) where 'm1' is the number of linear equality constraints.
beq :
A vector of double, vector of doubles, related to 'Aeq' and represents the linear coefficients in the equality constraints of size (m1 X 1).
lb :
A vector of doubles, containing the lower bounds of the variables of size (1 X n) or (n X 1) where 'n' is the number of variables.
ub :
A vector of doubles, containing the upper bounds of the variables of size (1 X n) or (n X 1) where 'n' is the number of variables.
options :
A list, containing the option for user to specify. See below for details.
Outputs
xopt :
A vector of doubles, containing the computed solution of the optimization problem.
fopt :
A double, containing the value of the function at x.
status :
The status flag returned from symphony. See below for details.
output :
A structure, containing the information about the optimization. See below for details.
Description
Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by :
\begin{eqnarray}
\mbox{min}_{x}
C^T⋅x \\
\text{Subjected to: } A⋅x \leq b \\
Aeq⋅x = beq \\
lb \leq x \leq ub \\
x_{i} \in \!\, \mathbb{Z}, i \in \!\, I
\end{eqnarray}
The routine calls SYMPHONY, a solver for mixed-integer linear programs written in C, for the actual computation.
Options
The options should be defined as type "list" and consist of over a hundred fields, the most important ones of which have been detailed here:
node_limit : A scalar, specifying the max. number of nodes allowed to be analyzed during the solution.
time_limit : A scalar, specifying the maximum amount of CPU time in seconds that the solver should take.
gap_limit : A scalar, representing the target gap limit allowed for solution.
granularity : A scalar, “the minimum difference between two distinct objective function values
node_selection_rule : A Scalar, specifying the maximum number of iterations that the solver should take.
prep_level : An integer, that determines the level of preprocessing that should be done on the current MILP instance.
do_branch_and_cut : A boolean, representing the decision whether to run the branch and cut algorithm or not.
The status allows the user to know the status of the optimization which is returned by Symphony. The values it can take and what they indicate is described below:
227 : Optimal Solution Found
228 : Maximum CPU Time exceeded.
229 : Maximum Number of Node Limit Exceeded.
230 : Maximum Number of Iterations Limit Exceeded.
For more details on the status, see the symphony documentation which can be found on http://www.coin-or.org/SYMPHONY/man-5.6/
The output data structure contains detailed information about the optimization process.
It is of type "struct" and contains the following fields.
output.iterations: The number of iterations performed.
Example
Here we solve a simple objective function, subjected to three linear inequality constraints.
Find x in R^8 such that it minimizes:
\begin{eqnarray}
\mbox{min}_{x}\ f(x) = 1750x_{1} + 990x_{2} + 1240x_{3} + 1680x_{4} + 500x_{5} + 450x_{6} + 400x_{7} + 100x_{8} \\
\end{eqnarray}\\
\text{Subjected to:}\\
\begin{eqnarray}
\hspace{70pt} &6x_{1} + 4.25x_{2} + 5.5x_{3} + 7.75x_{4} + 3x_{5} + 3.25x_{6} + 3.5x_{7} + 3.75x_{8}&\leq 100\\
\hspace{70pt} &1.25x_{1} + 1.37x_{2} + 1.7x_{3} + 1.93x_{4} + 2.08x_{5} + 2.32x_{6} + 2.56x_{7} + 2.78x_{8}&\leq 205\\
\hspace{70pt} &1.15x_{1} + 1.34x_{2} + 1.66x_{3} + 1.99x_{4} + 2.06x_{5} + 2.32x_{6} + 2.58x_{7} + 2.84x_{8}&\leq 409\\
\end{eqnarray}\\
\text{With integer constraints as: }
\begin{eqnarray}
\begin{array}{cccccc}
[1 & 2 & 3 & 4] \\
\end{array}
\end{eqnarray}
A few examples displaying the various functionalities of symphonymat have been provided below. You will find a series of problems and the appropriate code snippets to solve them.
Example
Here we build up on the previous example by adding upper and lower bounds to the variables.
We add the following bounds to the problem specified above:
\begin{eqnarray}
0 &\leq x_{1} &\leq 1\\
0 &\leq x_{2} &\leq 1\\
0 &\leq x_{3} &\leq 1\\
0 &\leq x_{4} &\leq 1\\
0 &\leq x_{5} &\leq \infty\\
0 &\leq x_{6} &\leq \infty\\
0 &\leq x_{7} &\leq \infty\\
0 &\leq x_{8} &\leq \infty
\end{eqnarray}
Example
In this example, we proceed to add the linear equality constraints to the objective function.
\begin{eqnarray}
\hspace{1pt} &5x_{1} + 3x_{2} + 4x_{3} + 6x_{4} + x_{5} + x_{6} + x_{7} + x_{8}&= 25\\
\hspace{1pt} &0.25x_{1} + 0.12x_{2} + 0.2x_{3} + 0.18x_{4} + 0.08x_{5} + 0.07x_{6} + 0.06x_{7} + 0.03x_{8}&= 1.25\\
\hspace{1pt} &0.15x_{1} + 0.09x_{2} + 0.16x_{3} + 0.24x_{4} + 0.06x_{5} + 0.07x_{6} + 0.08x_{7} + 0.09x_{8}&= 1.25\\
\end{eqnarray}
Example
In this example, we further enhance the functionality of symphonymat by setting input options. This provides us with the ability to control the solver parameters such as the maximum number of solver iterations and the max. CPU time allowed for the computation.
Example
Primal Infeasible Problems: Find x in R^8 such that it minimizes:
Find x in R^8 such that it minimizes:
\begin{eqnarray}
\mbox{min}_{x}\ f(x) = 1750x_{1} + 990x_{2} + 1240x_{3} + 1680x_{4} + 500x_{5} + 450x_{6} + 400x_{7} + 100x_{8} \\
\end{eqnarray}\\
\text{Subjected to:}\\
\begin{eqnarray}
\hspace{70pt} &6x_{1} + 4.25x_{2} + 5.5x_{3} + 7.75x_{4} + 3x_{5} + 3.25x_{6} + 3.5x_{7} + 3.75x_{8}&\leq 26.333\\
\hspace{70pt} &1.25x_{1} + 1.37x_{2} + 1.7x_{3} + 1.93x_{4} + 2.08x_{5} + 2.32x_{6} + 2.56x_{7} + 2.78x_{8}&\leq 3.916\\
\hspace{70pt} &1.15x_{1} + 1.34x_{2} + 1.66x_{3} + 1.99x_{4} + 2.06x_{5} + 2.32x_{6} + 2.58x_{7} + 2.84x_{8}&\leq 5.249\\
\end{eqnarray}\\
\text{With integer constraints as: }
\begin{eqnarray}
\begin{array}{cccc}
[1 & 2 & 3 & 4]
\end{array}
\end{eqnarray}
Example
Unbounded Problems. Find x in R^8 such that it minimizes:
\begin{eqnarray}
\mbox{min}_{x}\ f(x) = 1750x_{1} + 990x_{2} + 1240x_{3} + 1680x_{4} + 500x_{5} + 450x_{6} + 400x_{7} + 100x_{8} \\
\end{eqnarray}\\
\text{Subjected to:}\\
\begin{eqnarray}
\hspace{70pt} &5x_{1} + 3x_{2} + 4x_{3} + 6x_{4} + x_{5} + x_{6} + x_{7} + x_{8}&= 25\\
\hspace{70pt} &0.25x_{1} + 0.12x_{2} + 0.2x_{3} + 0.18x_{4} + 0.08x_{5} + 0.07x_{6} + 0.06x_{7} + 0.03x_{8}&= 1.25\\
\hspace{70pt} &0.15x_{1} + 0.09x_{2} + 0.16x_{3} + 0.24x_{4} + 0.06x_{5} + 0.07x_{6} + 0.08x_{7} + 0.09x_{8}&= 1.25\\
\end{eqnarray}\\
\text{With integer constraints as: }
\begin{eqnarray}
\begin{array}{cccc}
[1 & 2 & 3 & 4] \\
\end{array}
\end{eqnarray}
Authors
Keyur Joshi, Saikiran, Iswarya, Harpreet Singh