<p>The function takes three variables. The first is a polyhedron <em>poly</em>, the second <em>str</em> should be "max" or "min" and the third <em>obj</em> is the objective function.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">an style='color: green'>8227; Cdd_SolveLinearProgram</code>( <var class="Arg">lp</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: a list if the program is optimal, otherwise returns the value 0</p>
<p>The function takes a linear program. If the program is optimal, the function returns a list of two entries, the solution vector and the optimal value of the objective, otherwise it returns <varclass="Arg">fail</var>.</p>
<p>To illustrate the using of these functions, let us solve the linear program given by:</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">A:= Cdd_PolyhedronByInequalities( [ [ -100, 1, 0 ], [ 200, -1, 0 ],</span>
<span class="GAPprompt">></span> <span class="GAPinput">[ -80, 0, 1 ], [ 170, 0, -1 ], [ -200, 1, 1 ] ] );</span>
<Polyhedron given by its H-representation>
<span class="GAPprompt">gap></span> <span class="GAPinput">lp1:= Cdd_LinearProgram( A, "max", [1, -2, 5 ] );</span>
<Linear program>
<span class="GAPprompt">gap></span> <span class="GAPinput">Display( lp1 );</span>
Linear program given by:
H-representation
begin 5 X 3 rational
-10010 200 -10
-8001 1700 -1
-20011
end
max [ 1, -2, 5 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">Cdd_SolveLinearProgram( lp1 );</span>
[ [ 100, 170 ], 651 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">lp2:= Cdd_LinearProgram( A, "min", [ 1, -2, 5 ] );</span>
<Linear program>
<span class="GAPprompt">gap></span> <span class="GAPinput">Display( lp2 );</span>
Linear program given by:
H-representation
begin 5 X 3 rational
-10010 200 -10
-8001 1700 -1
-20011
end
min [ 1, -2, 5 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">Cdd_SolveLinearProgram( lp2 );</span>
[ [ 200, 80 ], 1 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= Cdd_V_Rep( A );</span>
<Polyhedron given by its V-representation>
<span class="GAPprompt">gap></span> <span class="GAPinput">Display( B );</span>
V-representation
begin 5 X 3 rational
1100170 1100100 112080 120080 1200170
end
</pre></div>
<p>So the optimal solution for <span class="Math">\texttt{lp1}</span> is <span class="Math">(x=100,y=170)</span> with optimal value <span class="Math">p=1-2(100)+5(170)=651</span> and for <spanclass="Math">\texttt{lp2}</span> is <span class="Math">(x=200,y=80)</span> with optimal value <span class="Math">p=1-2(200)+5(80)=1</span>.</p>
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.