summaryrefslogtreecommitdiff
path: root/help/en_US/linprog.xml
blob: c293b7e2b3ab6a3343c7efe65ab7d46060280e47 (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
<?xml version="1.0" encoding="UTF-8"?>

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

<refentry version="5.0-subset Scilab" xml:id="linprog" 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>linprog</refname>
    <refpurpose>Solves a linear programming problem.</refpurpose>
  </refnamediv>


<refsynopsisdiv>
   <title>Calling Sequence</title>
   <synopsis>
   xopt = linprog(c,A,b)
   xopt = linprog(c,A,b,Aeq,beq)
   xopt = linprog(c,A,b,Aeq,beq,lb,ub)
   xopt = linprog(c,A,b,Aeq,beq,lb,ub,param)
   xopt = linprog(file)
   xopt = linprog(file,param)
   [xopt,fopt,exitflag,output,lambda] = linprog( ... )
   
   </synopsis>
</refsynopsisdiv>

<refsection>
   <title>Parameters</title>
   <variablelist>
   <varlistentry><term>c :</term>
      <listitem><para> a vector of double, contains coefficients of the variables in the objective</para></listitem></varlistentry>
   <varlistentry><term>A :</term>
      <listitem><para> a matrix of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.</para></listitem></varlistentry>
   <varlistentry><term>b :</term>
      <listitem><para> a vector of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.</para></listitem></varlistentry>
   <varlistentry><term>Aeq :</term>
      <listitem><para> a matrix of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.</para></listitem></varlistentry>
   <varlistentry><term>beq :</term>
      <listitem><para> a vector of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.</para></listitem></varlistentry>
   <varlistentry><term>lb :</term>
      <listitem><para> Lower bounds, specified as a vector or array of double. lb represents the lower bounds elementwise in lb ≤ x ≤ ub.</para></listitem></varlistentry>
   <varlistentry><term>ub :</term>
      <listitem><para> Upper bounds, specified as a vector or array of double. ub represents the upper bounds elementwise in lb ≤ x ≤ ub.</para></listitem></varlistentry>
   <varlistentry><term>options :</term>
      <listitem><para> a list containing the parameters to be set.</para></listitem></varlistentry>
   <varlistentry><term>file :</term>
      <listitem><para> a string describing the path to the mps file.</para></listitem></varlistentry>
   <varlistentry><term>xopt :</term>
      <listitem><para> a vector of double, the computed solution of the optimization problem.</para></listitem></varlistentry>
   <varlistentry><term>fopt :</term>
      <listitem><para> a double, the value of the function at x.</para></listitem></varlistentry>
   <varlistentry><term>status :</term>
      <listitem><para> status flag returned from symphony. See below for details.</para></listitem></varlistentry>
   <varlistentry><term>output :</term>
      <listitem><para> The output data structure contains detailed information about the optimization process. See below for details.</para></listitem></varlistentry>
   <varlistentry><term>lambda :</term>
      <listitem><para> The structure consist of the Lagrange multipliers at the solution of problem. See below for details.</para></listitem></varlistentry>
   </variablelist>
</refsection>

<refsection>
   <title>Description</title>
   <para>
OSI-CLP is used for solving the linear programming problems, OSI-CLP is a library written in C++.
Search the minimum of a constrained linear programming problem specified by :
   </para>
   <para>
<latex>
\begin{eqnarray}
&amp;\mbox{min}_{x}
&amp; c^T⋅x  \\
&amp; \text{subject to} &amp; A⋅x \leq b \\
&amp; &amp; Aeq⋅x = beq \\
&amp; &amp; lb \leq x \leq ub \\
\end{eqnarray}
</latex>
   </para>
   <para>
The routine calls Clp for solving the linear programming problem, Clp is a library written in C++.
   </para>
   <para>
The options allows the user to set various parameters of the Optimization problem.
It should be defined as type "list" and contains the following fields. In the current version it only contains maxiter.
<itemizedlist>
<listitem>Syntax : options= list("MaxIter", [---]);</listitem>
<listitem>MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take.</listitem>
<listitem>Default Values : options = list("MaxIter", [3000]);</listitem>
</itemizedlist>
   </para>
   <para>
The exitflag allows to know the status of the optimization which is given back by CLP.
<itemizedlist>
<listitem>exitflag=0 : Optimal Solution Found </listitem>
<listitem>exitflag=1 : Primal Infeasible </listitem>
<listitem>exitflag=2 : Dual Infeasible</listitem>
<listitem>exitflag=3 : Maximum Number of Iterations Exceeded. Output may not be optimal.</listitem>
<listitem>exitflag=4 : Solution Abandoned</listitem>
<listitem>exitflag=5 : Primal objective limit reached.</listitem>
<listitem>exitflag=6 : Dual objective limit reached.</listitem>
</itemizedlist>
   </para>
   <para>
The output data structure contains detailed informations about the optimization process.
It has type "struct" and contains the following fields.
<itemizedlist>
<listitem>output.iterations: The number of iterations performed during the search</listitem>
<listitem>output.constrviolation: The max-norm of the constraint violation.</listitem>
</itemizedlist>
   </para>
   <para>
The lambda data structure contains the Lagrange multipliers at the end
of optimization. In the current version the values are returned only when the the solution is optimal.
It has type "struct" and contains the following fields.
<itemizedlist>
<listitem>lambda.lower: The Lagrange multipliers for variable lower bounds.</listitem>
<listitem>lambda.eqlin: The Lagrange multipliers for the linear equality constraints.</listitem>
<listitem>lambda.ineqlin: The Lagrange multipliers for the linear inequality constraints.</listitem>
</itemizedlist>
   </para>
   <para>
</para>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
//Optimal problems
//Linear program, linear inequality constraints
c=[-1,-1/3]'
A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
b=[2,1,2,1,-1,2]
[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b)
// Press ENTER to continue

   ]]></programlisting>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
//Linear program with Linear Inequalities and Equalities`
c=[-1,-1/3]'
A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
b=[2,1,2,1,-1,2]
Aeq=[1,1/4]
beq=[1/2]
[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq)
// Press ENTER to continue

   ]]></programlisting>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
//Linear program with all constraint types
c=[-1,-1/3]'
A=[1,1;1,1/4;1,-1;-1/4,-1;-1,-1;-1,1]
b=[2,1,2,1,-1,2]
Aeq=[1,1/4]
beq=[1/2]
lb=[-1,-0.5]
ub=[1.5,1.25]
[xopt,fopt,exitflag,output,lambda]=linprog(c, A, b, Aeq, beq, lb, ub)
// Press ENTER to continue

   ]]></programlisting>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
//Primal Infeasible Problem
c=[-1,-1,-1]'
A=[1,2,-1]
b=[-4]
Aeq=[1,5,3;1,1,0]
beq=[10,100]
lb=[0,0,0]
ub=[%inf,%inf,%inf]
[xopt,fopt,exitflag,output,lambda]= linprog(c,A,b,Aeq,beq,lb,ub)
// Press ENTER to continue

   ]]></programlisting>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
//Dual Infeasible Problem
c=[3,5,-7]'
A=[-1,-1,4;1,1,4]
b=[-8,5]
Aeq=[]
beq=[]
lb=[-%inf,-%inf,-%inf]
ub=[%inf,%inf,%inf]
[xopt,fopt,exitflag,output,lambda]= linprog(c,A,b,Aeq,beq,lb,ub)
// Press ENTER to continue

   ]]></programlisting>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
filepath = get_absolute_file_path('linprog.dem.sce');
filepath = filepath + "exmip1.mps"
[xopt,fopt,exitflag,output,lambda] =linprog(filepath)
   ]]></programlisting>
</refsection>

<refsection>
   <title>Authors</title>
   <simplelist type="vert">
   <member>Bhanu Priya Sayal, Guru Pradeep Reddy</member>
   </simplelist>
</refsection>
</refentry>