<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi,<br>
<br>
This message would better fit in the scope of the
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a> list.<br>
<br>
Anyway, below is a way to solve your problem. <br>
<br>
Here is the exact solution:<br>
<br>
// Solution<br>
c = [20 24]';<br>
A = [<br>
3 6<br>
4 2<br>
];<br>
b = [60 32]';<br>
xopt = [4 8]';<br>
fopt = c'*xopt // fopt = 272<br>
A*xopt - b // zero<br>
<br>
You can try the karmarkar function built in Scilab :<br>
<br>
// Use slack variables:<br>
//<br>
// Minimize -20.x1 - 24.x2<br>
// 3.x1 + 6.x2 + x3 = 60<br>
// 4.x1 + 2.x2 + x4 = 32<br>
// x1, x2, x3, x4 >= 0<br>
<br>
c = [-20 -24 0 0]';<br>
a = [<br>
3 6 1 0<br>
4 2 0 1<br>
];<br>
b = [60 32]';<br>
[x0,kerA]=linsolve(a,-b)<br>
// x0=lsq(a,b) also works<br>
x1=karmarkar(a,b,c,x0)<br>
<br>
This produces :<br>
<br>
-->x1=karmarkar(a,b,c,x0)<br>
1. -0.269E+03 0.367E-02<br>
2. -0.270E+03 0.275E-02<br>
3. -0.270E+03 0.207E-02<br>
4. -0.271E+03 0.156E-02<br>
5. -0.271E+03 0.118E-02<br>
6. -0.271E+03 0.896E-03<br>
7. -0.271E+03 0.688E-03<br>
8. -0.271E+03 0.534E-03<br>
9. -0.272E+03 0.419E-03<br>
10. -0.272E+03 0.333E-03<br>
11. -0.272E+03 0.267E-03<br>
12. -0.272E+03 0.216E-03<br>
13. -0.272E+03 0.174E-03<br>
14. -0.272E+03 0.139E-03<br>
15. -0.272E+03 0.110E-03<br>
16. -0.272E+03 0.862E-04<br>
17. -0.272E+03 0.668E-04<br>
18. -0.272E+03 0.513E-04<br>
19. -0.272E+03 0.392E-04<br>
20. -0.272E+03 0.297E-04<br>
21. -0.272E+03 0.225E-04<br>
22. -0.272E+03 0.170E-04<br>
23. -0.272E+03 0.128E-04<br>
24. -0.272E+03 0.960E-05<br>
x1 =<br>
<br>
3.9996501 <br>
7.999964 <br>
0.0012658 <br>
0.0014716 <br>
<br>
<br>
You can also try the "quapro" module and the linpro function.<br>
<br>
// Minimize -20.x1 - 24.x2<br>
// 3.x1 + 6.x2 <= 60<br>
// 4.x1 + 2.x2 <= 32<br>
// 0 <= x1 , x2 <= %inf<br>
atomsInstall("quapro");<br>
atomsLoad("quapro");<br>
p = [-20 -24]';<br>
C = [<br>
3 6<br>
4 2<br>
];<br>
b = [60 32]';<br>
ci=[0 0]';<br>
cs=[%inf %inf]';<br>
[x1,lagr,f]=linpro(p,C,b,ci,cs)<br>
<br>
This produces :<br>
<br>
-->[x1,lagr,f]=linpro(p,C,b,ci,cs)<br>
f =<br>
- 272. <br>
lagr =<br>
0. <br>
0. <br>
3.1111111 <br>
2.6666667 <br>
x1 =<br>
4. <br>
8. <br>
<br>
The lagrange multipliers indicate that the linear equalities are
active. The bounds are inactive.<br>
<br>
Best regards,<br>
<br>
Michaël Baudin<br>
<br>
Le 31/12/2010 17:08, Prof. Dr. Reinaldo Golmia Dante a écrit :
<blockquote cite="mid:656403.59951.qm@web45503.mail.sp1.yahoo.com"
type="cite">
<style type="text/css"><!-- DIV {margin:0px;} --></style>
<div style="font-family: times new roman,new york,times,serif;
font-size: 12pt;">
<div>Hi Scilab developers,</div>
<div> </div>
<div>I would like to suggest to you if a simple linear
optimization function could be implemented</div>
<div>in order to solve linear optimization problems.</div>
<div> </div>
<div>I tried to integrate LPSOLVE with Scilab, but
unfortunately, it was hard for me.</div>
<div> </div>
<div>The manual called "Optimization in Scilab" seems complex to
beginners because starts</div>
<div>to show nonlinear optimization functions.</div>
<div> </div>
<div>I would like to know how could I solve a simple linear
problem using Scilab like that:</div>
<div><span style="font-style: italic; color: rgb(1, 168, 1);"></span> </div>
<div><span style="font-style: italic; color: rgb(1, 168, 1);"><font
color="#000000">Max 20*x1 + 24*x2;</font></span></div>
<span style="font-style: italic; color: rgb(1, 168, 1);"></span>
<div><br>
<font color="#000000">such as:<br>
</font><font color="#000000"><span style="font-style: italic;
color: rgb(1, 168, 1);"><span style="font-style: italic;
color: rgb(1, 168, 1);"><font color="#000000">3*x1 +
6*x2 <= 60;</font></span></span></font></div>
<div><font color="#000000"><span style="font-style: italic;
color: rgb(1, 168, 1);"><span style="font-style: italic;
color: rgb(1, 168, 1);"><font color="#000000">4*x1 +
2*x2 <= 32;</font></span></span></font></div>
<div><font color="#000000"><span style="font-style: italic;
color: rgb(1, 168, 1);"><span style="font-style: italic;
color: rgb(1, 168, 1);"><font color="#000000">x1, x2
>= 0;</font></span></span></font></div>
<div><span style="font-style: italic; color: rgb(1, 168, 1);"></span> </div>
<div><span style="font-style: italic; color: rgb(1, 168, 1);"><font
color="#000000">Thank you in advance.</font></span></div>
<div><span style="font-style: italic; color: rgb(1, 168, 1);"></span> </div>
<div><span style="font-style: italic; color: rgb(1, 168, 1);"><font
color="#000000">Happy New Year 2011 !</font></span></div>
<div><span style="font-style: italic; color: rgb(1, 168, 1);"></span> </div>
<div><span style="font-style: italic; color: rgb(1, 168, 1);"><font
color="#000000">All best,</font></span></div>
<div><span style="font-style: italic; color: rgb(1, 168, 1);"><font
color="#000000">Reinaldo.</font></span></div>
<div><span style="font-style: italic; color: rgb(1, 168, 1);"></span> </div>
<div><span style="font-style: italic; color: rgb(1, 168, 1);"><font
color="#000000">PS: I hope in 2011 Scilab has some owner
LP functions. (smiles) </font></span></div>
</div>
<br>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Michaël Baudin
Ingénieur de développement
<a class="moz-txt-link-abbreviated" href="mailto:michael.baudin@scilab.org">michael.baudin@scilab.org</a>
-------------------------
Consortium Scilab - Digiteo
Domaine de Voluceau - Rocquencourt
B.P. 105 - 78153 Le Chesnay Cedex
Tel. : 01 39 63 56 87 - Fax : 01 39 63 55 94
</pre>
</body>
</html>