Enc: [Ticket#2012053010000018] Optimization on Scilab 5.4.0 (for Mac OS X Lion)
Reinaldo
rei.listas at yahoo.com
Sat Jun 16 01:00:29 CEST 2012
Dear Scilab Developers,
I think that Scilab (version 5.4.0 - alpha - 1) for Mac OS X Lion 10.7.x has bug because it shows error message for linpro function (see below).
I really want to run this code on my Mac OS X Lion. It works properly in Scilab 5.3 (for Windows).
In case you wish the code file, I could send to you.
Thank you in advance.
Best Regards,
Dr. Reinaldo.
----- Mensagem encaminhada -----
De: Scilab Support <scilab.support at scilab.org>
Para: Reinaldo <rei.listas at yahoo.com>
Enviadas: Quarta-feira, 13 de Junho de 2012 11:13
Assunto: Re: [Ticket#2012053010000018] Optimization on Scilab 5.4.0 (for Mac OS X Lion)
Dear Reinaldo,
You should ask your question on the Scilab mailing list:
http://www.scilab.org/communities/developer_zone/tools/mailing_list
Regards,
Scilab Team
--
===================================================
The Scilab Consortium
Digiteo
Domaine de Voluceau
Rocquencourt - B.P. 105
78153 Le Chesnay Cedex France
===================================================
01.06.2012 08:53 - Reinaldo a écrit:
Hi Scilab Support,
I typed at Scilab console:
-> atomsInstall("quapro")
And re-started again Scilab. The result is shown as follows:
scilab-5.4.0-alpha-1
Consórcio Scilab (DIGITEO)
Copyright (c) 1989-2011 (INRIA)
Direitos reservados (c) 1989-2007 (ENPC)
___________________________________________
Loading the inicialization:
carregando o ambiente inicial
-->
-->atomsInstall("quapro")
ans =
!quapro 1.1-2 allusers SCI/contrib/quapro/1.1-2 I !
So, seems that quapro is installed without any problem (or warning) !
The first time I compile that example10, appears the message like:
->
-->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)
!--error 4
Invalid variable: linpro
-->
-->[clean(x1) clean(xopt(1:size(p,1)))]
!--error 4
Invalid variable: x1
-->a=0;for i=1:size(p,1); a=a+x1(i);end;a
!--error 4
Invalid variable: x1
-->b=0;for i=1:size(p,1); b=b+xopt(i);end;b
b =
3.4913266
Then, when I re-start the Scilab, the result changes as following described:
___________________________________________
scilab-5.4.0-alpha-1
Consórcio Scilab (DIGITEO)
Copyright (c) 1989-2011 (INRIA)
Direitos reservados (c) 1989-2007 (ENPC)
___________________________________________
Execução de iniciação:
carregando o ambiente inicial
Start Quapro toolbox
Load macros
Load gateways
Load help
Load demos
-->
-->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
Incoherence column / row 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
So, it's this ! :-(((
Seems that "quapro" is not so compatible to Scilab 5.4.0-alpha1 for Mac OS X Lion 10.7.4 (XCode 4.2) :-(
However, it did not show any error message when it was installed !
Thank you in advance !
All best,
Reinaldo.
PS: The same file run properly using Scilab 5.3.3 for Windows.
________________________________
De: Scilab Support <scilab.support at scilab.org>
Para: rei.listas at yahoo.com
Enviadas: Quarta-feira, 30 de Maio de 2012 4:01
Assunto: Re: [Ticket#2012053010000018] Optimization on Scilab 5.4.0 (for Mac OS X Lion)
Dear Reinaldo,
Linpro is now part of an ATOMS module: http://atoms.scilab.org/toolboxes/quapro
Scilab Team
--
===================================================
The Scilab Consortium
Digiteo
Domaine de Voluceau
Rocquencourt - B.P. 105
78153 Le Chesnay Cedex France
===================================================
De : Reinaldo [mailto:rei.listas at yahoo.com]
Envoyé : vendredi 25 mai 2012 14:06
À : SABIRON William
Objet : Re: Optimization on Scilab 5.4.0 (for Mac OS X Lion)
Hi William,
I sent a mail to Michaël, but he didn't work on Scilab. That''s a pity ! :-(
He's good guy and helps me on my doubts on optimization function.
I would like to know if we could discuss about this issue freely.
If positive, please answer me why "linpro function" does not work on Scilab 5.4.
I wrote a program and it ran well on Scilab previous version (i.e., 5.3). However, using Scilab 5.4,
the same program has "errors", as follows:
// Example 10 - page 80 - "Operations Research: applications and algorithms" (Winston)
// PROJECT SELECTION PROBLEM: find the optimum value of following LP model.
// Maximize 13*x1 + 16*x2 + 16*x3 + 14*x4 + 39*x5
// such as
// 11*x1 + 53*x2 + 5*x3 + 5*x4 + 29*x5 <= 40
// 3*x1 + 6*x2 + 5*x3 + x4 + 34*x5 <= 20
// x1 <= 1
// x2 <= 1
// x3 <= 1
// x4 <= 1
// x5 <= 1
// xi >= 0 (i = 1,...,5)
// Converting to min LP problem
// Minimize -13*x1 - 16*x2 - 16*x3 - 14*x4 - 39*x5
// such as
// 11*x1 + 53*x2 + 5*x3 + 5*x4 + 29*x5 <= 40
// 3*x1 + 6*x2 + 5*x3 + x4 + 34*x5 <= 20
// x1 <= 1
// x2 <= 1
// x3 <= 1
// x4 <= 1
// x5 <= 1
// xi >= 0 (i = 1,...,5)
// First resolution of LP problem: (THIS RESOLUTION WORKED !)
// You can try the karmarkar function built in Scilab :
// Use slack variables:
// Minimize -13*x1 - 16*x2 - 16*x3 - 14*x4 - 39*x5
// such as
// 11*x1 + 53*x2 + 5*x3 + 5*x4 + 29*x5 + e1 = 40
// 3*x1 + 6*x2 + 5*x3 + x4 + 34*x5 + e2 = 20
// x1 + e3 = 1
// x2 + e4 = 1
// x3 + e5 = 1
// x4 + e6 = 1
// x5 + e7 = 1
// xi, ej >= 0 (i = 1,...,5) (j = 1,..., 7)
// The following script solves the problem. Here, the initial guess x0 is given.
Aeq =[
115355291000000
3 651340100000
1 000 00010000
0 100 00001000
0 010 00000100
0 001 00000010
0 000 10000001
]; // coefficients of constraint matrix
beq =[402011111]'; // vector of independent terms
c =[-13-16-16-14-390000000]'; // coefficients of objective function
[n,p]=size(Aeq);
// Now, assume that the initial guess x0 is unknown.
// To find a feasible point, we solve the following problem :
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)
x0=zopt(1:p) // This gives a very small value of zopt(p+1)
// The previous script allows to produces the initial guess: x0
// We now plug the initial guess x0 into the original problem and get:
xopt=karmarkar(Aeq,beq,c,x0,1.e-10,0.999) // optimization result
// where the components xopt(1:4) are the original variables and xopt(5:) are slack variables.
f =c'*xopt // result of objetive function
// Second resolution of LP problem: (THIS RESOLUTION WORKED !)
// You can also try the "quapro" module and the linpro function.
// Minimize -13*x1 - 16*x2 - 16*x3 - 14*x4 - 39*x5
// such as
// 11*x1 + 53*x2 + 5*x3 + 5*x4 + 29*x5 <= 40
// 3*x1 + 6*x2 + 5*x3 + x4 + 34*x5 <= 20
// x1 <= 1
// x2 <= 1
// x3 <= 1
// x4 <= 1
// x5 <= 1
// xi >= 0 (i = 1,...,5)
p =[-13-16-16-14-39]'; // coefficients of objective function
C = [
11535529
3 65134
1 000 0
0 100 0
0 010 0
0 001 0
0 000 1
]; // coefficients of constraint matrix
b =[402011111]'; // vector of independent terms
ci=[00000]'; // initial values (boundary condition)
cs=[%inf%inf%inf%inf%inf]'; // final values
[x1,lagr,f]=linpro(p,C,b,ci,cs) // x1 represents the optimum solution
// PS:
// [x,lagr,f]=linpro(p,C,b,ci,cs [,x0]) when minimize p'*x under the constraints C*x <= b
// [x,lagr,f]=linpro(p,-C,-b,ci,cs [,x0]) when minimize p'*x under the constraints C*x >= b
[clean(x1)clean(xopt(1:size(p,1)))]
a=0;fori=1:size(p,1); a=a+x1(i);end;a //sum of optimal values using linpro
b=0;fori=1:size(p,1); b=b+xopt(i);end;b //sum of optimal values using Karmarkar
However, seems that some functions are modified in Scilab 5.4, aren't they ?
Before, that program runs correctly ! Now, in Scilab 5.4, the result is:
->
-->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)
!--error 4
Variável indefinida: linpro
-->
-->[clean(x1) clean(xopt(1:size(p,1)))]
!--error 4
Variável indefinida: x1
-->a=0;for i=1:size(p,1); a=a+x1(i);end;a
!--error 4
Variável indefinida: x1
-->b=0;for i=1:size(p,1); b=b+xopt(i);end;b
b =
3.4913266
Do you know why this program has errors ?
Please update me about the optimization functions (if there are modified in Scilab 5.4).
Thank you so much, Willian !!!
All best.
Reinaldo Golmia Dante.
PS: this program is attached in this mail in case you wish run it !
________________________________
De:"michael.baudin-noreply at scilab.org" <michael.baudin-noreply at scilab.org>
Para: rei.listas at yahoo.com
Enviadas: Sexta-feira, 25 de Maio de 2012 8:33
Assunto: Re: Optimization on Scilab 5.4.0 (for Mac OS X Lion)
From: Michaël BAUDIN <michael.baudin at scilab.org>
Bonjour,
Je ne fais plus partie des effectifs de la Fondation Scilab Digiteo.
Merci de contacter scilab.support at scilab.org pour toute question relative à Scilab,
William SABIRON (william.sabiron at fcs-digiteotrianglephysique.fr) sinon.
Merci de ne plus utiliser cette adresse mail.
Cordialement,
Michaël BAUDIN
-------- Original Message --------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20120615/7d2fe525/attachment.htm>
More information about the dev
mailing list