[scilab-Users] Problem on optimization function (Scilab 5.4)

Reinaldo rei.listas at yahoo.com
Fri May 25 14:59:51 CEST 2012


Hi Adrien,

Thank you for your answer and suggestion. I install it. Then I run it again and the results is shown, as follows:

-->Aeq = [
-->       11 53 5 5 29 1 0 0 0 0 0 0
-->        3  6 5 1 34 0 1 0 0 0 0 0
-->        1  0 0 0  0 0 0 1 0 0 0 0
-->        0  1 0 0  0 0 0 0 1 0 0 0
-->        0  0 1 0  0 0 0 0 0 1 0 0
-->        0  0 0 1  0 0 0 0 0 0 1 0
-->        0  0 0 0  1 0 0 0 0 0 0 1
-->      ];  
 
-->
 
-->beq = [40 20 1 1 1 1 1]';    
 
-->c = [-13 -16 -16 -14 -39 0 0 0 0 0 0 0]';     
 
-->[n,p]=size(Aeq);
 
-->
 
-->
 
-->
 
-->cc = [zeros(p,1);1];
 
-->AAeq = [Aeq,beq-Aeq*ones(p,1)];
 
-->bbeq = beq;
 
-->z0 = ones(p+1,1);
 
-->zopt=karmarkar(AAeq,bbeq,cc,z0,0,0.99)
 zopt  =
 
    0.4651227  
    0.3447924  
    0.4790839  
    0.4846474  
    0.3723201  
    0.9937153  
    0.9969277  
    0.5348773  
    0.6552076  
    0.5209161  
    0.5153526  
    0.6276799  
    1.00D-162  
 
-->x0=zopt(1:p)  
 x0  =
 
    0.4651227  
    0.3447924  
    0.4790839  
    0.4846474  
    0.3723201  
    0.9937153  
    0.9969277  
    0.5348773  
    0.6552076  
    0.5209161  
    0.5153526  
    0.6276799  
 
-->
 
-->
 
-->xopt=karmarkar(Aeq,beq,c,x0,1.e-10,0.999)  
 xopt  =
 
    1.0017139  
    0.2009097  
    0.9994057  
    1.0011172  
    0.2881802  
    1.034D-13  
    3.512D-13  
    5.532D-16  
    0.7990812  
    8.466D-15  
    8.225D-14  
    0.7119165  
 
-->
 
-->f = c'*xopt  
 f  =
 
  - 57.481994  
 
-->
 
-->p = [-13 -16 -16 -14 -39]'; 
 
-->
 
-->C =  [
-->       11 53 5 5 29
-->        3  6 5 1 34
-->        1  0 0 0  0
-->        0  1 0 0  0
-->        0  0 1 0  0
-->        0  0 0 1  0
-->        0  0 0 0  1
-->      ];  
 
-->
 
-->     
 
-->b = [40 20 1 1 1 1 1]';  
 
-->
 
-->ci=[0 0 0 0 0]';  
 
-->
 
-->cs=[%inf %inf %inf %inf %inf]'; 
 
-->
 
-->[x1,lagr,f]=linpro(p,C,b,ci,cs)  
Warning:
/Applications/scilab-5.4.0-alpha-1.app/Contents/MacOS/share/scilab/contrib/quapro/1.1-2/macros/quapro.bin

 f  =
 
    1.  
 lagr  =
 
    0.  
 x1  =
 
    0.  
 
Warning: stack problem..., solved

-->
 
-->
 
-->
 
-->
 
-->
 
-->
 
-->[clean(x1) clean(xopt(1:size(p,1)))]
                                    !--error 5 
Incoerente rows/columns  dimension.
 
 
-->a=0;for i=1:size(p,1); a=a+x1(i);end;a 
                                 !--error 21 
Invalid index.
 
 
-->b=0;for i=1:size(p,1); b=b+xopt(i);end;b 
 b  =
 
    3.4913266  
 
In case you want, I could send to you the code in your mail.

All best,
Reinaldo.

PS: Interesting that it worked properly on previous version of Scilab.


________________________________
 De: Adrien Vogt-Schilb <vogt at centre-cired.fr>
Para: users at lists.scilab.org 
Enviadas: Sexta-feira, 25 de Maio de 2012 9:29
Assunto: Re: [scilab-Users] Problem on optimization function (Scilab 5.4)
 

On 25/05/2012 14:19, Reinaldo wrote: 
-->[x1,lagr,f]=linpro(p,C,b,ci,cs)   !--error 4 
Variável indefinida: linpro
Hi

you have to install the quapro module on your new scilab
you can do so from the scilab console

atomsInstall('quapro') 


http://atoms.scilab.org/toolboxes/quapro

Hope this helps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20120525/63d2a616/attachment.htm>


More information about the users mailing list