summaryrefslogtreecommitdiff
path: root/help/en_US/symphonymat.xml
blob: 5aca7d1e6060d18e032002cc6d41d290ca0402fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<?xml version="1.0" encoding="UTF-8"?>

<!--
 *
 * This help file was generated from symphonymat.sci using help_from_sci().
 *
 -->

<refentry version="5.0-subset Scilab" xml:id="symphonymat" xml:lang="en"
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg"
          xmlns:ns3="http://www.w3.org/1999/xhtml"
          xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:scilab="http://www.scilab.org"
          xmlns:db="http://docbook.org/ns/docbook">

  <refnamediv>
    <refname>symphonymat</refname>
    <refpurpose>Solves a mixed integer linear programming constrained optimization problem in intlinprog format.</refpurpose>
  </refnamediv>


<refsynopsisdiv>
   <title>Calling Sequence</title>
   <synopsis>
   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( ... )
   
   </synopsis>
</refsynopsisdiv>

<refsection>
   <title>Input Parameters</title>
   <variablelist>
   <varlistentry><term>c :</term>
      <listitem><para> A vector of doubles, containing the coefficients of the variables in the objective function.</para></listitem></varlistentry>
   <varlistentry><term>intcon :</term>
      <listitem><para> 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.</para></listitem></varlistentry>
   <varlistentry><term>A :</term>
      <listitem><para> 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.</para></listitem></varlistentry>
   <varlistentry><term>b :</term>
      <listitem><para> A vector of doubles, related to 'A' and represents the linear coefficients in the linear inequality constraints of size (m X 1).</para></listitem></varlistentry>
   <varlistentry><term>Aeq :</term>
      <listitem><para> 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.</para></listitem></varlistentry>
   <varlistentry><term>beq :</term>
      <listitem><para> A vector of double, vector of doubles, related to 'Aeq' and represents the linear coefficients in the equality constraints of size (m1 X 1).</para></listitem></varlistentry>
   <varlistentry><term>lb :</term>
      <listitem><para> 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.</para></listitem></varlistentry>
   <varlistentry><term>ub :</term>
      <listitem><para> 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.</para></listitem></varlistentry>
   <varlistentry><term>options :</term>
      <listitem><para> A list, containing the option for user to specify. See below for details.</para></listitem></varlistentry>
 </variablelist>
</refsection>
<refsection>
<title> Outputs</title>
 <variablelist>
   <varlistentry><term>xopt :</term>
      <listitem><para> A vector of doubles, containing the computed solution of the optimization problem.</para></listitem></varlistentry>
   <varlistentry><term>fopt :</term>
      <listitem><para> A double, containing the value of the function at x.</para></listitem></varlistentry>
   <varlistentry><term>status :</term>
      <listitem><para> The status flag returned from symphony. See below for details.</para></listitem></varlistentry>
   <varlistentry><term>output :</term>
      <listitem><para> A structure, containing the information about the optimization. See below for details.</para></listitem></varlistentry>
   </variablelist>
</refsection>

<refsection>
   <title>Description</title>
   <para>
Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by :
   </para>
   <para>
<latex>
 \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}
</latex>
   </para>
   <para>
The routine calls SYMPHONY, a  solver for mixed-integer linear programs written in C, for the actual computation.
   </para>
  <para>
     <title>Options</title>
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:
</para>
   <para>
<itemizedlist>
  <listitem>node_limit : A scalar, specifying the max. number of nodes allowed to be analyzed during the solution.</listitem>
  <listitem>time_limit : A scalar, specifying the maximum amount of CPU time in seconds that the solver should take.</listitem>
  <listitem>gap_limit : A scalar, representing the target gap limit allowed for solution.</listitem>
<listitem>granularity : A scalar, “the minimum difference between two distinct objective function values</listitem>

<listitem>node_selection_rule : A Scalar, specifying the maximum number of iterations that the solver should take.</listitem>
<listitem>prep_level : An integer, that determines the level of preprocessing that should be done on the current MILP instance.</listitem>
<listitem>do_branch_and_cut : A boolean, representing the decision whether to run the branch and cut algorithm or not. </listitem>
</itemizedlist>
   </para>
   <para>
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:
<itemizedlist>
<listitem>227 : Optimal Solution Found </listitem>
<listitem>228 : Maximum CPU Time exceeded.</listitem>
<listitem>229 : Maximum Number of Node Limit Exceeded.</listitem>
<listitem>230 : Maximum Number of Iterations Limit Exceeded.</listitem>
</itemizedlist>
   </para>
   <para>
For more details on the status, see the symphony documentation which can be found on http://www.coin-or.org/SYMPHONY/man-5.6/
   </para>
   <para>
The output data structure contains detailed information about the optimization process.
It is of type "struct" and contains the following fields.
<itemizedlist>
<listitem>output.iterations: The number of iterations performed.</listitem>
</itemizedlist>
   </para>
   <para>
</para>
</refsection>

<refsection>
   <title>Example</title>
   <para>
 Here we solve a simple objective function, subjected to three linear inequality constraints.
   </para>
   <para>
Find x in R^8 such that it minimizes:
   </para>
   <para>
<latex>
  \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} &amp;6x_{1} + 4.25x_{2} + 5.5x_{3} + 7.75x_{4} + 3x_{5} + 3.25x_{6} + 3.5x_{7} + 3.75x_{8}&amp;\leq 100\\ 
\hspace{70pt} &amp;1.25x_{1} + 1.37x_{2} + 1.7x_{3} + 1.93x_{4} + 2.08x_{5} + 2.32x_{6} + 2.56x_{7} + 2.78x_{8}&amp;\leq 205\\ 
\hspace{70pt} &amp;1.15x_{1} + 1.34x_{2} + 1.66x_{3} + 1.99x_{4} + 2.06x_{5} + 2.32x_{6} + 2.58x_{7} + 2.84x_{8}&amp;\leq 409\\ 
\end{eqnarray}\\
\text{With integer constraints as: } 
\begin{eqnarray}
\begin{array}{cccccc}
[1 &amp; 2 &amp; 3 &amp; 4] \\
\end{array}
\end{eqnarray}
  </latex>
    </para>
  <para>
</para>
   <programlisting role="example"><![CDATA[
// Example 1:
// Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. "An application of mixed integer
// programming in a Swedish steel mill." Interfaces 7, no. 2 (1977): 39-43. Modified acc. to requirements.
c = [350*5,330*3,310*4,280*6,500,450,400,100]';
A = [6,4.25, 5.5, 7.75, 3, 3.25, 3.5,3.75; 
    1.25,1.37,1.7,1.93,2.08,2.32,2.56,2.78;  
    1.15,1.34,1.66,1.99,2.06,2.32,2.58,2.84 ];
b = [100 ,205, 249 ];
//Defining the integer constraints
intcon = [1 2 3 4];
// Calling Symphony
[x,f,status,output] = symphonymat(c,intcon,A,b)
// Press ENTER to continue

   ]]></programlisting>
</refsection>
<para>
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.
   </para>
<refsection>
   <title>Example</title>
   <para>
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:   </para>
   <para>
<latex>
\begin{eqnarray}
0 &amp;\leq x_{1} &amp;\leq 1\\
0 &amp;\leq x_{2} &amp;\leq 1\\
0 &amp;\leq x_{3} &amp;\leq 1\\
0 &amp;\leq x_{4} &amp;\leq 1\\
0 &amp;\leq x_{5} &amp;\leq \infty\\
0 &amp;\leq x_{6} &amp;\leq \infty\\
0 &amp;\leq x_{7} &amp;\leq \infty\\
0 &amp;\leq x_{8} &amp;\leq \infty 
\end{eqnarray}
  </latex>
</para>
   <programlisting role="example"><![CDATA[
// Example 2:
// Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. "An application of mixed integer
// programming in a Swedish steel mill." Interfaces 7, no. 2 (1977): 39-43. Modified acc. to requirements.
  c = [350*5,330*3,310*4,280*6,500,450,400,100]';
  //Inequality constraints
  A = [6,4.25, 5.5, 7.75, 3, 3.25, 3.5,3.75; 
      1.25,1.37,1.7,1.93,2.08,2.32,2.56,2.78;  
      1.15,1.34,1.66,1.99,2.06,2.32,2.58,2.84 ];
  b = [100 ,205, 249 ];

  // Lower Bound of variable
lb = repmat(0,1,8);
// Upper Bound of variables
ub = [repmat(1,1,4) repmat(%inf,1,4)];
  //Integer Constraints
  intcon = [1 2 3 4];
  // Calling Symphony
  [x,f,status,output] = symphonymat(c,intcon,A,b,[],[],lb,ub)
// Press ENTER to continue

   ]]></programlisting>
</refsection>

<refsection>
   <title>Example</title>
   <para>
In this example, we proceed to add the linear equality constraints to the objective function.
   </para>
   
   <para>
<latex>
\begin{eqnarray}
\hspace{1pt} &amp;5x_{1} + 3x_{2} + 4x_{3} + 6x_{4} + x_{5} + x_{6} + x_{7} + x_{8}&amp;= 25\\ 
\hspace{1pt} &amp;0.25x_{1} + 0.12x_{2} + 0.2x_{3} + 0.18x_{4} + 0.08x_{5} + 0.07x_{6} + 0.06x_{7} + 0.03x_{8}&amp;= 1.25\\ 
\hspace{1pt} &amp;0.15x_{1} + 0.09x_{2} + 0.16x_{3} + 0.24x_{4} + 0.06x_{5} + 0.07x_{6} + 0.08x_{7} + 0.09x_{8}&amp;= 1.25\\ 
\end{eqnarray}
  </latex>
</para>
   <programlisting role="example"><![CDATA[
// Example 3:
// Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. "An application of mixed integer
// programming in a Swedish steel mill." Interfaces 7, no. 2 (1977): 39-43. Modified acc. to requirements.
c = [350*5,330*3,310*4,280*6,500,450,400,100]';
//Inequality constraints
A = [6,4.25, 5.5, 7.75, 3, 3.25, 3.5,3.75; 
    1.25,1.37,1.7,1.93,2.08,2.32,2.56,2.78;  
    1.15,1.34,1.66,1.99,2.06,2.32,2.58,2.84 ];
b = [100 ,205, 249 ];
// Lower Bound of variable
lb = repmat(0,1,8);
// Upper Bound of variables
ub = [repmat(1,1,4) repmat(%inf,1,4)];
// Equality Constraints
Aeq = [5,3,4,6,1,1,1,1;
5*0.05,3*0.04,4*0.05,6*0.03,0.08,0.07,0.06,0.03;
5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;]
beq = [ 25, 1.25, 1.25];
  //Integer Constraints
intcon = [1 2 3 4];
// Calling Symphony
[x,f,status,output] = symphonymat(c,intcon,A,b,Aeq,beq,lb,ub)
// Press ENTER to continue

   ]]></programlisting>
</refsection>

<refsection>
   <title>Example</title>
   <para>
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.
   </para>
   
   <para>
</para>
   <programlisting role="example"><![CDATA[
// Example 4:
// Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. "An application of mixed integer
// programming in a Swedish steel mill." Interfaces 7, no. 2 (1977): 39-43. Modified acc. to requirements.
c = [350*5,330*3,310*4,280*6,500,450,400,100]';
//Inequality constraints
A = [6,4.25, 5.5, 7.75, 3, 3.25, 3.5,3.75; 
    1.25,1.37,1.7,1.93,2.08,2.32,2.56,2.78;  
    1.15,1.34,1.66,1.99,2.06,2.32,2.58,2.84 ];
b = [100 ,205, 249 ];
// Lower Bound of variable
lb = repmat(0,1,8);
// Upper Bound of variables
ub = [repmat(1,1,4) repmat(%inf,1,4)];
// Equality Constraints
Aeq = [5,3,4,6,1,1,1,1;
5*0.05,3*0.04,4*0.05,6*0.03,0.08,0.07,0.06,0.03;
5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;]
beq = [ 25, 1.25, 1.25];
  //Integer Constraints
intcon = [1 2 3 4];
//Options
options = list("time_limit", 25);
// Calling Symphony
[x,f,status,output] = symphonymat(c,intcon,A,b,Aeq,beq,lb,ub)
// Press ENTER to continue

   ]]></programlisting>
</refsection>

<refsection>
   <title>Example</title>
   <para>
Primal Infeasible Problems: Find x in R^8 such that it minimizes:
  </para>
   <para>
Find x in R^8 such that it minimizes:
   </para>
   <para>
<latex>
  \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} &amp;6x_{1} + 4.25x_{2} + 5.5x_{3} + 7.75x_{4} + 3x_{5} + 3.25x_{6} + 3.5x_{7} + 3.75x_{8}&amp;\leq 26.333\\ 
\hspace{70pt} &amp;1.25x_{1} + 1.37x_{2} + 1.7x_{3} + 1.93x_{4} + 2.08x_{5} + 2.32x_{6} + 2.56x_{7} + 2.78x_{8}&amp;\leq 3.916\\ 
\hspace{70pt} &amp;1.15x_{1} + 1.34x_{2} + 1.66x_{3} + 1.99x_{4} + 2.06x_{5} + 2.32x_{6} + 2.58x_{7} + 2.84x_{8}&amp;\leq 5.249\\ 
\end{eqnarray}\\
\text{With integer constraints as: } 
\begin{eqnarray}
\begin{array}{cccc}
[1 &amp; 2 &amp; 3 &amp; 4] 
\end{array}
\end{eqnarray}
  </latex>
</para>
   <programlisting role="example"><![CDATA[
// Example 5:
// Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. "An application of mixed integer 
// programming in a Swedish steel mill." Interfaces 7, no. 2 (1977): 39-43. Modified acc. to requirements.
c = [350*5,330*3,310*4,280*6,500,450,400,100]';
//Inequality constraints 
A = [6,4.25, 5.5, 7.75, 3, 3.25, 3.5,3.75; 
    1.25,1.37,1.7,1.93,2.08,2.32,2.56,2.78;  
    1.15,1.34,1.66,1.99,2.06,2.32,2.58,2.84 ]; 
b = [26.333 ,3.916 ,5.249 ];
  //Integer Constraints
intcon = [1 2 3 4];
 
// Calling Symphony
 
[x,f,status,output] = symphonymat(c,intcon,A,b)
// Press ENTER to continue

   ]]></programlisting>
</refsection>

<refsection>
   <title>Example</title>
   <para>
Unbounded Problems. Find x in R^8 such that it minimizes:
   </para>
   <para>
<latex>
 \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} &amp;5x_{1} + 3x_{2} + 4x_{3} + 6x_{4} + x_{5} + x_{6} + x_{7} + x_{8}&amp;= 25\\ 
\hspace{70pt} &amp;0.25x_{1} + 0.12x_{2} + 0.2x_{3} + 0.18x_{4} + 0.08x_{5} + 0.07x_{6} + 0.06x_{7} + 0.03x_{8}&amp;= 1.25\\ 
\hspace{70pt} &amp;0.15x_{1} + 0.09x_{2} + 0.16x_{3} + 0.24x_{4} + 0.06x_{5} + 0.07x_{6} + 0.08x_{7} + 0.09x_{8}&amp;= 1.25\\
\end{eqnarray}\\
\text{With integer constraints as: } 
\begin{eqnarray}
\begin{array}{cccc}
[1 &amp; 2 &amp; 3 &amp; 4] \\
\end{array}
\end{eqnarray}
  </latex>
</para>
   <programlisting role="example"><![CDATA[
// Example 6:
// Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. "An application of mixed integer
// programming in a Swedish steel mill." Interfaces 7, no. 2 (1977): 39-43. Modified acc. to requirements.
c = [350*5,330*3,310*4,280*6,500,450,400,100]';
//Inequality constraints
A = [];
b = [];
// Equality Constraints
Aeq = [5,3,4,6,1,1,1,1;
5*0.05,3*0.04,4*0.05,6*0.03,0.08,0.07,0.06,0.03;
5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;]
beq = [ 25, 1.25, 1.25];
  //Integer Constraints
intcon = [1 2 3 4];
// Calling Symphony
[x,f,status,output] = symphonymat(c,intcon,A,b,Aeq,beq)
// Press ENTER to continue

   ]]></programlisting>
</refsection>



<refsection>
   <title>Authors</title>
   <simplelist type="vert">
   <member>Keyur Joshi, Saikiran, Iswarya, Harpreet Singh</member>
   </simplelist>
</refsection>
</refentry>