Update demo system
Pierre Marechal [Mon, 9 Jun 2008 14:12:19 +0000 (14:12 +0000)]
33 files changed:
scilab/modules/optimization/Makefile.am
scilab/modules/optimization/Makefile.in
scilab/modules/optimization/demos/datafit/datafit.dem.sce [moved from scilab/modules/optimization/demos/datafit/datafit.dem with 63% similarity]
scilab/modules/optimization/demos/datafit/demo_datafit.sci
scilab/modules/optimization/demos/lmitool/bigM.sci
scilab/modules/optimization/demos/lmitool/dscr_lyap.sci
scilab/modules/optimization/demos/lmitool/dscr_lyap2.sci
scilab/modules/optimization/demos/lmitool/fullstate.sci
scilab/modules/optimization/demos/lmitool/h2hinf.sci
scilab/modules/optimization/demos/lmitool/linprog.sci
scilab/modules/optimization/demos/lmitool/lmi.dem.sce [moved from scilab/modules/optimization/demos/lmitool/lmi.dem with 97% similarity]
scilab/modules/optimization/demos/lmitool/lmidem.sci
scilab/modules/optimization/demos/lmitool/norminf.sci
scilab/modules/optimization/demos/lmitool/normopt.sci
scilab/modules/optimization/demos/lmitool/normopt2.sci
scilab/modules/optimization/demos/lmitool/normoptd.sci
scilab/modules/optimization/demos/lmitool/of.sci
scilab/modules/optimization/demos/lmitool/phase1.sci
scilab/modules/optimization/demos/lmitool/ric_dscr.sci
scilab/modules/optimization/demos/lmitool/sylvester.sci
scilab/modules/optimization/demos/lmitool/test.sci
scilab/modules/optimization/demos/lmitool/testdscr_lyap
scilab/modules/optimization/demos/lmitool/testh2hinf
scilab/modules/optimization/demos/lmitool/testlinprog
scilab/modules/optimization/demos/lmitool/testnorminf
scilab/modules/optimization/demos/lmitool/testnormopt
scilab/modules/optimization/demos/lmitool/tset.sci [deleted file]
scilab/modules/optimization/demos/multiflow/multiflow.dem.sce [moved from scilab/modules/optimization/demos/multiflow/multiflow.dem with 70% similarity]
scilab/modules/optimization/demos/optimization.dem [deleted file]
scilab/modules/optimization/demos/optimization.dem.gateway.sce [new file with mode: 0644]
scilab/modules/optimization/demos/optloc/demo_optloc.sci
scilab/modules/optimization/demos/optloc/optloc.dem.sce [moved from scilab/modules/optimization/demos/optloc/optloc.dem with 79% similarity]
scilab/modules/optimization/etc/optimization.start

index d8889a8..7b1748e 100644 (file)
@@ -171,66 +171,67 @@ libscioptimization_la_rootdir = $(mydatadir)
 libscioptimization_la_root_DATA = changelog.txt license.txt readme.txt version.xml
 
 
-#### optimization : init scripts ####
+####�optimization : init scripts ####
 libscioptimization_la_etcdir = $(mydatadir)/etc
 libscioptimization_la_etc_DATA = etc/optimization.quit etc/optimization.start
 
-#### optimization : gateway declaration ####
+####�optimization : gateway declaration ####
 libscioptimization_la_sci_gatewaydir = $(mydatadir)/sci_gateway
 libscioptimization_la_sci_gateway_DATA = sci_gateway/optimization_gateway.xml
-#### optimization : include files ####
+####�optimization : include files ####
 libscioptimization_la_includedir=$(pkgincludedir)/optimization
 libscioptimization_la_include_HEADERS = includes/gw_optim.h \
 includes/spd.h
 
 
-#### optimization : demos files ####
+####�optimization : demos files ####
 libscioptimization_la_demosdir=$(mydatadir)
-nobase_libscioptimization_la_demos_DATA = demos/lmitool/normoptd.sci \
+nobase_libscioptimization_la_demos_DATA = demos/datafit/datafit.dem.sce \
+demos/datafit/demo_datafit.sci \
+demos/datafit/demo_datafit_fr.htm \
+demos/icse/icob.sci \
+demos/icse/icot.sci \
+demos/icse/icse.contexte \
+demos/icse/icse.sci \
+demos/icse/icsegen.sci \
+demos/icse/icseinit.sce \
+demos/icse/icsu.sci \
+demos/icse/icsua.sci \
+demos/icse/icsuq.sci \
+demos/icse/icsvisu.sci \
+demos/icse/lqv.sce \
+demos/icse/navet.sce \
+demos/icse/README \
+demos/icse/sero.mes \
+demos/icse/seros.sce \
+demos/lmitool/bigM.sci \
+demos/lmitool/dscr_lyap.sci \
 demos/lmitool/dscr_lyap2.sci \
 demos/lmitool/fullstate.sci \
-demos/lmitool/testdscr_lyap \
-demos/lmitool/of.sci \
+demos/lmitool/h2hinf.sci \
+demos/lmitool/linprog.sci \
+demos/lmitool/lmi.dem.sce \
 demos/lmitool/lmidem.sci \
 demos/lmitool/norminf.sci \
-demos/lmitool/lmi.dem \
-demos/lmitool/linprog.sci \
-demos/lmitool/h2hinf.sci \
-demos/lmitool/bigM.sci \
-demos/lmitool/test.sci \
-demos/lmitool/tset.sci \
+demos/lmitool/normopt.sci \
 demos/lmitool/normopt2.sci \
-demos/lmitool/dscr_lyap.sci \
+demos/lmitool/normoptd.sci \
+demos/lmitool/of.sci \
 demos/lmitool/phase1.sci \
-demos/lmitool/testnormopt \
 demos/lmitool/ric_dscr.sci \
-demos/lmitool/testnorminf \
-demos/lmitool/testlinprog \
-demos/lmitool/normopt.sci \
 demos/lmitool/sylvester.sci \
+demos/lmitool/test.sci \
+demos/lmitool/testdscr_lyap \
 demos/lmitool/testh2hinf \
-demos/multiflow/ex3.graph \
+demos/lmitool/testlinprog \
+demos/lmitool/testnorminf \
+demos/lmitool/testnormopt \
 demos/multiflow/demo_multiflow.sci \
-demos/multiflow/multiflow.dem \
 demos/multiflow/demo_multiflow_fr.htm \
-demos/icse/icse.sci \
-demos/icse/icseinit.sce \
-demos/icse/icsu.sci \
-demos/icse/icsua.sci \
-demos/icse/icsuq.sci \
-demos/icse/icsvisu.sci \
-demos/icse/seros.sce \
-demos/icse/navet.sce \
-demos/icse/icob.sci \
-demos/icse/icsegen.sci \
-demos/icse/icot.sci \
-demos/icse/icse.contexte \
-demos/icse/lqv.sce \
-demos/icse/sero.mes \
-demos/icse/README \
-demos/datafit/datafit.dem \
-demos/datafit/demo_datafit.sci \
-demos/datafit/demo_datafit_fr.htm \
-demos/optimization.dem
+demos/multiflow/ex3.graph \
+demos/multiflow/multiflow.dem.sce \
+demos/optimization.dem.gateway.sce \
+demos/optloc/demo_optloc.sci \
+demos/optloc/optloc.dem.sce
 
 include $(top_srcdir)/Makefile.incl.am
index d931b89..1d937c0 100644 (file)
@@ -524,67 +524,68 @@ modulename = optimization
 libscioptimization_la_rootdir = $(mydatadir)
 libscioptimization_la_root_DATA = changelog.txt license.txt readme.txt version.xml
 
-#### optimization : init scripts ####
+####�optimization : init scripts ####
 libscioptimization_la_etcdir = $(mydatadir)/etc
 libscioptimization_la_etc_DATA = etc/optimization.quit etc/optimization.start
 
-#### optimization : gateway declaration ####
+####�optimization : gateway declaration ####
 libscioptimization_la_sci_gatewaydir = $(mydatadir)/sci_gateway
 libscioptimization_la_sci_gateway_DATA = sci_gateway/optimization_gateway.xml
-#### optimization : include files ####
+####�optimization : include files ####
 libscioptimization_la_includedir = $(pkgincludedir)/optimization
 libscioptimization_la_include_HEADERS = includes/gw_optim.h \
 includes/spd.h
 
 
-#### optimization : demos files ####
+####�optimization : demos files ####
 libscioptimization_la_demosdir = $(mydatadir)
-nobase_libscioptimization_la_demos_DATA = demos/lmitool/normoptd.sci \
+nobase_libscioptimization_la_demos_DATA = demos/datafit/datafit.dem.sce \
+demos/datafit/demo_datafit.sci \
+demos/datafit/demo_datafit_fr.htm \
+demos/icse/icob.sci \
+demos/icse/icot.sci \
+demos/icse/icse.contexte \
+demos/icse/icse.sci \
+demos/icse/icsegen.sci \
+demos/icse/icseinit.sce \
+demos/icse/icsu.sci \
+demos/icse/icsua.sci \
+demos/icse/icsuq.sci \
+demos/icse/icsvisu.sci \
+demos/icse/lqv.sce \
+demos/icse/navet.sce \
+demos/icse/README \
+demos/icse/sero.mes \
+demos/icse/seros.sce \
+demos/lmitool/bigM.sci \
+demos/lmitool/dscr_lyap.sci \
 demos/lmitool/dscr_lyap2.sci \
 demos/lmitool/fullstate.sci \
-demos/lmitool/testdscr_lyap \
-demos/lmitool/of.sci \
+demos/lmitool/h2hinf.sci \
+demos/lmitool/linprog.sci \
+demos/lmitool/lmi.dem.sce \
 demos/lmitool/lmidem.sci \
 demos/lmitool/norminf.sci \
-demos/lmitool/lmi.dem \
-demos/lmitool/linprog.sci \
-demos/lmitool/h2hinf.sci \
-demos/lmitool/bigM.sci \
-demos/lmitool/test.sci \
-demos/lmitool/tset.sci \
+demos/lmitool/normopt.sci \
 demos/lmitool/normopt2.sci \
-demos/lmitool/dscr_lyap.sci \
+demos/lmitool/normoptd.sci \
+demos/lmitool/of.sci \
 demos/lmitool/phase1.sci \
-demos/lmitool/testnormopt \
 demos/lmitool/ric_dscr.sci \
-demos/lmitool/testnorminf \
-demos/lmitool/testlinprog \
-demos/lmitool/normopt.sci \
 demos/lmitool/sylvester.sci \
+demos/lmitool/test.sci \
+demos/lmitool/testdscr_lyap \
 demos/lmitool/testh2hinf \
-demos/multiflow/ex3.graph \
+demos/lmitool/testlinprog \
+demos/lmitool/testnorminf \
+demos/lmitool/testnormopt \
 demos/multiflow/demo_multiflow.sci \
-demos/multiflow/multiflow.dem \
 demos/multiflow/demo_multiflow_fr.htm \
-demos/icse/icse.sci \
-demos/icse/icseinit.sce \
-demos/icse/icsu.sci \
-demos/icse/icsua.sci \
-demos/icse/icsuq.sci \
-demos/icse/icsvisu.sci \
-demos/icse/seros.sce \
-demos/icse/navet.sce \
-demos/icse/icob.sci \
-demos/icse/icsegen.sci \
-demos/icse/icot.sci \
-demos/icse/icse.contexte \
-demos/icse/lqv.sce \
-demos/icse/sero.mes \
-demos/icse/README \
-demos/datafit/datafit.dem \
-demos/datafit/demo_datafit.sci \
-demos/datafit/demo_datafit_fr.htm \
-demos/optimization.dem
+demos/multiflow/ex3.graph \
+demos/multiflow/multiflow.dem.sce \
+demos/optimization.dem.gateway.sce \
+demos/optloc/demo_optloc.sci \
+demos/optloc/optloc.dem.sce
 
 
 # Where all the Scilab stuff is installed (macros, help, ...)
@@ -5,7 +5,8 @@
 // This file is distributed under the same license as the Scilab package.
 //
 
-mode(-1)
-path=get_absolute_file_path('datafit.dem');
-getf(path+'demo_datafit.sci')
-demo_datafit()
+mode(-1);
+
+path=get_absolute_file_path('datafit.dem.sce');
+exec(path+'demo_datafit.sci');
+demo_datafit();
index 0b3f91f..78f0fe4 100644 (file)
@@ -14,8 +14,8 @@ function demo_datafit()
   for x=0:.1:3, Y=[Y,FF(x)+100*(rand()-.5)];X=[X,x];end
   Z=[Y;X];
   //show the data points
-  clf()
-  xselect();
+  my_handle             = scf(100001);
+  clf(my_handle,"reset");
   plot(X,Y,'+')
   l=legend('Experimental data',2)
   realtimeinit(0.1);for k=1:20,realtime(k),end
index aed6c4c..25880a3 100644 (file)
 //
 
 function [x,Z,z,ul,iters]=bigM(F,blck_szs,c,x0,M,nu,abstol,reltol,tv,maxiters);
-// [x,Z,z,ul,iters]=bigM(F,blck_szs,c,x0,M,nu,abstol,reltol,tv,maxiters);
-//
-// minimize    c^T x 
-// subject to  F(x) = F0 + x1*F1 + ... + xm*Fm >= 0 
-//             Tr F(x) <= M
-//
-// maximize    -Tr F0*(Z-zI) - Mz
-// subject to  Tr Fi*(Z-zI) = c_i
-//             Z >= 0, z>= 0
-//
-// Convergence criteria:
-// (1) maxiters is exceeded
-// (2) duality gap is less than abstol
-// (3) primal and dual objective are both positive and
-//     duality gap is less than (reltol * dual objective)
-//     or primal and dual objective are both negative and
-//     duality gap is less than (reltol * minus the primal objective)
-// (4) reltol is negative and
-//     primal objective is less than tv or dual objective is greater
-//     than tv
-//
-// Input arguments:
-// F:         (sum_i n_i^2) times (m+1) matrix
-//            [ F_0^1(:) F_1^1(:) ... F_m^1(:) ]
-//            [ F_0^2(:) F_1^2(:) ... F_m^2(:) ]
-//                ...      ...          ...
-//            [ F_0^L(:) F_1^L(:) ... F_m^L(:) ]
-//            F_i^j: jth block of F_i, size n_i times n_i.
-// blck_szs:  L-vector [n_1 ... n_L], dimensions of diagonal blocks.
-// c:         m-vector.  Specifies primal objective.
-// x0:        m-vector.  The primal starting point.  F(x0) > 0.  
-// M:         scalar. M > Tr F(x0).    
-// nu:        >= 1.0.  Controls the rate of convergence.
-// abstol:    absolute tolerance.
-// reltol:    relative tolerance.  Has a special meaning when negative.
-// tv:        target value.
-// maxiters:  maximum number of iterations.
-//
-// Output arguments:
-// x:         m-vector; last primal iterate.
-// Z:         last dual iterate; block-diagonal matrix stored as 
-//            [ Z^1(:);  Z^2(:); ... ; Z^L(:) ].
-// z:         scalar part of last dual iterate.  
-// ul:        ul(1): primal objective, ul(1): dual objective.
-// iters:     number of iterations taken.
-
-
-[rowf,colf]=size(F);
-m = colf-1;
-if (rowf ~= sum(blck_szs.*blck_szs))
-    error('Dimensions of F do not match blck_szs.');
-end;
-
-[rowx0,colx0]=size(x0);
-if (rowx0 ~= m) | (colx0 ~= 1)
-   error('x0 must be an m-vector.'); 
-end;
-
-if (prod(size(x0)) ~= m), 
-   error('c must be an m-vector.'); 
-end;
-
-// I is the identity
-I = zeros(rowf,1);
-blck_szs=matrix(blck_szs,1,prod(size(blck_szs)));
-k=0;  for n=blck_szs,
-   I(k+[1:n*n]) = matrix(eye(n,n),n*n,1);   // identity
-   k = k+n*n;   // k = sum n_i*n_i
-end;
-
-// Z0 = projection of I on dual feasible space 
-
-Z0 = I-F(:,2:m+1) * ...
-     ( (F(:,2:m+1)'*F(:,2:m+1)) \ ( F(:,2:m+1)'*I - c ) );
-
-// mineigZ is the smallest eigenvalue of Z0
-mineigZ = 0.0;
-k=0; for n=blck_szs,
-  mineigZ = min(mineigZ, min(real(spec(matrix(Z0(k+[1:n*n]),n,n)))));
-  k=k+n*n;
-end;
-
-// z = max( 1e-5, -1.1*mineigZ )
-Z0(k+1) = max( 1e-5, -1.1*mineigZ);  
-Z0(1:k) = Z0(1:k) + Z0(k+1)*I; 
-
-if (M < I'*F*[1;x0] + 1e-5), 
-   error('M must be strictly greater than trace of F(x0).'); 
-end;
-
-// add scalar block Tr F(x) <= M
-F = [F; M-I'*F(:,1),-I'*F(:,2:m+1)]; 
-blck_szs = [blck_szs,1];
-[x,Z,ul,info]=...
-  semidef(x0,pack(Z0),pack(F),blck_szs,c,[nu,abstol,reltol,tv,maxiters]);
-iters = info(2);
-nz=prod(size(Z))
-z=Z(nz)
-Z=unpack(Z(1:nz-1),blck_szs(1:prod(size(blck_szs))-1))
-Z = Z(1:k);
-
-
+       // [x,Z,z,ul,iters]=bigM(F,blck_szs,c,x0,M,nu,abstol,reltol,tv,maxiters);
+       //
+       // minimize    c^T x 
+       // subject to  F(x) = F0 + x1*F1 + ... + xm*Fm >= 0 
+       //             Tr F(x) <= M
+       //
+       // maximize    -Tr F0*(Z-zI) - Mz
+       // subject to  Tr Fi*(Z-zI) = c_i
+       //             Z >= 0, z>= 0
+       //
+       // Convergence criteria:
+       // (1) maxiters is exceeded
+       // (2) duality gap is less than abstol
+       // (3) primal and dual objective are both positive and
+       //     duality gap is less than (reltol * dual objective)
+       //     or primal and dual objective are both negative and
+       //     duality gap is less than (reltol * minus the primal objective)
+       // (4) reltol is negative and
+       //     primal objective is less than tv or dual objective is greater
+       //     than tv
+       //
+       // Input arguments:
+       // F:         (sum_i n_i^2) times (m+1) matrix
+       //            [ F_0^1(:) F_1^1(:) ... F_m^1(:) ]
+       //            [ F_0^2(:) F_1^2(:) ... F_m^2(:) ]
+       //                ...      ...          ...
+       //            [ F_0^L(:) F_1^L(:) ... F_m^L(:) ]
+       //            F_i^j: jth block of F_i, size n_i times n_i.
+       // blck_szs:  L-vector [n_1 ... n_L], dimensions of diagonal blocks.
+       // c:         m-vector.  Specifies primal objective.
+       // x0:        m-vector.  The primal starting point.  F(x0) > 0.  
+       // M:         scalar. M > Tr F(x0).    
+       // nu:        >= 1.0.  Controls the rate of convergence.
+       // abstol:    absolute tolerance.
+       // reltol:    relative tolerance.  Has a special meaning when negative.
+       // tv:        target value.
+       // maxiters:  maximum number of iterations.
+       //
+       // Output arguments:
+       // x:         m-vector; last primal iterate.
+       // Z:         last dual iterate; block-diagonal matrix stored as 
+       //            [ Z^1(:);  Z^2(:); ... ; Z^L(:) ].
+       // z:         scalar part of last dual iterate.  
+       // ul:        ul(1): primal objective, ul(1): dual objective.
+       // iters:     number of iterations taken.
+       
+       
+       [rowf,colf]=size(F);
+       m = colf-1;
+       if (rowf ~= sum(blck_szs.*blck_szs))
+               error('Dimensions of F do not match blck_szs.');
+       end;
+       
+       [rowx0,colx0]=size(x0);
+       if (rowx0 ~= m) | (colx0 ~= 1)
+               error('x0 must be an m-vector.'); 
+       end;
+       
+       if (prod(size(x0)) ~= m), 
+               error('c must be an m-vector.'); 
+       end;
+       
+       // I is the identity
+       I = zeros(rowf,1);
+       blck_szs=matrix(blck_szs,1,prod(size(blck_szs)));
+       k=0;  for n=blck_szs,
+       I(k+[1:n*n]) = matrix(eye(n,n),n*n,1);   // identity
+       k = k+n*n;   // k = sum n_i*n_i
+       end;
+       
+       // Z0 = projection of I on dual feasible space 
+       
+       Z0 = I-F(:,2:m+1) * ...
+               ( (F(:,2:m+1)'*F(:,2:m+1)) \ ( F(:,2:m+1)'*I - c ) );
+       
+       // mineigZ is the smallest eigenvalue of Z0
+       mineigZ = 0.0;
+       k=0; for n=blck_szs,
+       mineigZ = min(mineigZ, min(real(spec(matrix(Z0(k+[1:n*n]),n,n)))));
+       k=k+n*n;
+       end;
+       
+       // z = max( 1e-5, -1.1*mineigZ )
+       Z0(k+1) = max( 1e-5, -1.1*mineigZ);  
+       Z0(1:k) = Z0(1:k) + Z0(k+1)*I; 
+       
+       if (M < I'*F*[1;x0] + 1e-5), 
+               error('M must be strictly greater than trace of F(x0).'); 
+       end;
+       
+       // add scalar block Tr F(x) <= M
+       F = [F; M-I'*F(:,1),-I'*F(:,2:m+1)]; 
+       blck_szs = [blck_szs,1];
+       [x,Z,ul,info]=...
+       semidef(x0,pack(Z0),pack(F),blck_szs,c,[nu,abstol,reltol,tv,maxiters]);
+       iters = info(2);
+       nz=prod(size(Z))
+       z=Z(nz)
+       Z=unpack(Z(1:nz-1),blck_szs(1:prod(size(blck_szs))-1))
+       Z = Z(1:k);
 
+endfunction
index a77e53e..23d370a 100644 (file)
@@ -5,27 +5,28 @@
 // This file is distributed under the same license as the Scilab package.
 //
 
- function [X,Y]=dscr_lyap(E,A,C)
-// Generated by lmitool on Wed Feb 01 09:40:57 MET 1995
- Mbound = 1e3;
- abstol = 1e-6;
- nu = 10;
- maxiters = 100;
- reltol = 1e-6;
- options=[Mbound,abstol,nu,maxiters,reltol];
- /////////////////DO NOT REMOVE THIS LINE
- X_init=zeros(A)
- Y_init=zeros(A)
- /////////////////DO NOT REMOVE THIS LINE
- XLIST0=list(X_init,Y_init)
- XLIST=lmisolver(XLIST0,dscr_lyap_eval,options)
- [X,Y]=XLIST(:)
- /////////////////EVALUATION FUNCTION////////////////////////////
- function [LME,LMI,OBJ]=dscr_lyap_eval(XLIST)
- [X,Y]=XLIST(:)
- /////////////////DO NOT REMOVE THIS LINE
- LME=list(A'*X+Y'*A+C'*C,E'*X-Y'*E)
- LMI=E'*X
- OBJ=[]
+function [X,Y]=dscr_lyap(E,A,C)
+       // Generated by lmitool on Wed Feb 01 09:40:57 MET 1995
+       Mbound = 1e3;
+       abstol = 1e-6;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1e-6;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       /////////////////DO NOT REMOVE THIS LINE
+       X_init=zeros(A)
+       Y_init=zeros(A)
+       /////////////////DO NOT REMOVE THIS LINE
+       XLIST0=list(X_init,Y_init)
+       XLIST=lmisolver(XLIST0,dscr_lyap_eval,options)
+       [X,Y]=XLIST(:)
+endfunction
+
+/////////////////EVALUATION FUNCTION////////////////////////////
+function [LME,LMI,OBJ]=dscr_lyap_eval(XLIST)
+       [X,Y]=XLIST(:)
+       /////////////////DO NOT REMOVE THIS LINE
+       LME=list(A'*X+Y'*A+C'*C,E'*X-Y'*E)
+       LMI=E'*X
+       OBJ=[]
+endfunction
index 09eb15a..24f9c06 100644 (file)
@@ -5,24 +5,27 @@
 // This file is distributed under the same license as the Scilab package.
 //
 
- function [X]=dscr_lyap2(E,A)
-// Generated by lmitool on Tue Jan 31 21:58:20 MET 1995
- Mbound = 1e3;
- abstol = 1e-10;
- nu = 10;
- maxiters = 100;
- reltol = 1e-10;
- options=[Mbound,abstol,nu,maxiters,reltol];
- /////////////////DO NOT REMOVE THIS LINE
- X_init=zeros(A)
- /////////////////DO NOT REMOVE THIS LINE
- XLIST0=list(X_init)
- XLIST=lmisolver(XLIST0,dscr_lyap2_eval,options)
- [X]=XLIST(:)
- /////////////////EVALUATION FUNCTION////////////////////////////
- function [LME,LMI,OBJ]=dscr_lyap2_eval(XLIST)
- [X]=XLIST(:)
- /////////////////DO NOT REMOVE THIS LINE
- LME=E'*X-X'*E
- LMI=list(-A'*X-X'*A-eye(),E'*X)
- OBJ=[]
+function [X]=dscr_lyap2(E,A)
+       // Generated by lmitool on Tue Jan 31 21:58:20 MET 1995
+       Mbound = 1e3;
+       abstol = 1e-10;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1e-10;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       /////////////////DO NOT REMOVE THIS LINE
+       X_init=zeros(A)
+       /////////////////DO NOT REMOVE THIS LINE
+       XLIST0=list(X_init)
+       XLIST=lmisolver(XLIST0,dscr_lyap2_eval,options)
+       [X]=XLIST(:)
+endfunction
+
+function [LME,LMI,OBJ]=dscr_lyap2_eval(XLIST)
+       /////////////////EVALUATION FUNCTION////////////////////////////
+       [X]=XLIST(:)
+       /////////////////DO NOT REMOVE THIS LINE
+       LME=E'*X-X'*E
+       LMI=list(-A'*X-X'*A-eye(),E'*X)
+       OBJ=[]
+endfunction
index 0d0b7a6..755d037 100644 (file)
@@ -5,37 +5,34 @@
 // This file is distributed under the same license as the Scilab package.
 //
 
- function [X,Y,gama]=fullstate(A,B1,B2,C1,D12,D11)
-// Generated by lmitool on Thu Feb 09 11:30:44 MET 1995
-   
-   Mbound = 1e3;
-   abstol = 1e-10;
-   nu = 10;
-   maxiters = 100;
-   reltol = 1e-10;
-   options=[Mbound,abstol,nu,maxiters,reltol];
-    
- ///////////DEFINE INITIAL GUESS AND PRELIMINARY CALCULATIONS BELOW
- X_init=eye(A)                                                     
- Y_init=zeros(B2');                                                
- gama_init=1                                                       
- I1=eye(B1'*B1);I2=eye(C1*C1');                                    
- /////////// 
-  
- XLIST0=list(X_init,Y_init,gama_init)
- XLIST=lmisolver(XLIST0,fullstate_eval,options)
- [X,Y,gama]=XLIST(:)
-  
-  
-  
- /////////////////EVALUATION FUNCTION////////////////////////////
-  
- function [LME,LMI,OBJ]=fullstate_eval(XLIST)
- [X,Y,gama]=XLIST(:)
-  
- /////////////////DEFINE LME, LMI and OBJ BELOW
- LME=X-X' ;                                                        
- LMI=-[A*X+X*A'+B2*Y+Y'*B2',B1,X*C1'+Y'*D12';                      
- B1',-gama*I1,D11';                                                
- C1*X+D12*Y,D11,-gama*I2]                                          
- OBJ=gama                                                          
+function [X,Y,gama]=fullstate(A,B1,B2,C1,D12,D11)
+       // Generated by lmitool on Thu Feb 09 11:30:44 MET 1995
+       Mbound = 1e3;
+       abstol = 1e-10;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1e-10;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       
+       ///////////DEFINE INITIAL GUESS AND PRELIMINARY CALCULATIONS BELOW
+       X_init=eye(A)                                                     
+       Y_init=zeros(B2');                                                
+       gama_init=1                                                       
+       I1=eye(B1'*B1);I2=eye(C1*C1');                                    
+       
+       XLIST0=list(X_init,Y_init,gama_init)
+       XLIST=lmisolver(XLIST0,fullstate_eval,options)
+       [X,Y,gama]=XLIST(:)
+endfunction
+
+/////////////////EVALUATION FUNCTION////////////////////////////
+
+function [LME,LMI,OBJ]=fullstate_eval(XLIST)
+       [X,Y,gama]=XLIST(:)
+       /////////////////DEFINE LME, LMI and OBJ BELOW
+       LME=X-X';
+       LMI=-[A*X+X*A'+B2*Y+Y'*B2',B1,X*C1'+Y'*D12';
+       B1',-gama*I1,D11';
+       C1*X+D12*Y,D11,-gama*I2]
+       OBJ=gama
+endfunction
index e3c65b4..ba6c310 100644 (file)
@@ -6,26 +6,27 @@
 //
 
  function [X,Y,L]=h2hinf(A,B1,B2,C1,C2,D11,D12,D22,gama)
-// Generated by lmitool on Mon Feb 06 17:09:19 MET 1995
- Mbound = 1e3;
- abstol = 1e-10;
- nu = 10;
- maxiters = 100;
- reltol = 1e-10;
- options=[Mbound,abstol,nu,maxiters,reltol];
- /////////////////DO NOT REMOVE THIS LINE
- X_init=eye(A)
- Y_init=zeros(C2*C2')
- L_init=zeros(B2')
- /////////////////DO NOT REMOVE THIS LINE
- XLIST0=list(X_init,Y_init,L_init)
- XLIST=lmisolver(XLIST0,h2hinf_eval,options)
- [X,Y,L]=XLIST(:)
- /////////////////EVALUATION FUNCTION////////////////////////////
- function [LME,LMI,OBJ]=h2hinf_eval(XLIST)
- [X,Y,L]=XLIST(:)
- /////////////////DO NOT REMOVE THIS LINE
- LME=list(X-X',Y-Y');
- LMI=list(-[A*X+B2*L+(A*X+B2*L)'+B1*B1',X*C1'+L'*D12'+B1*D11';...
- (X*C1'+L'*D12'+B1*D11')',-gama^2*eye()+D11*D11'],[Y,C2*X+D22*L;(C2*X+D22*L)',X])
- OBJ=trace(Y);
+       // Generated by lmitool on Mon Feb 06 17:09:19 MET 1995
+       Mbound = 1e3;
+       abstol = 1e-10;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1e-10;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       /////////////////DO NOT REMOVE THIS LINE
+       X_init=eye(A)
+       Y_init=zeros(C2*C2')
+       L_init=zeros(B2')
+       /////////////////DO NOT REMOVE THIS LINE
+       XLIST0=list(X_init,Y_init,L_init)
+       XLIST=lmisolver(XLIST0,h2hinf_eval,options)
+       [X,Y,L]=XLIST(:)
+       /////////////////EVALUATION FUNCTION////////////////////////////
+       function [LME,LMI,OBJ]=h2hinf_eval(XLIST)
+       [X,Y,L]=XLIST(:)
+       /////////////////DO NOT REMOVE THIS LINE
+       LME=list(X-X',Y-Y');
+       LMI=list(-[A*X+B2*L+(A*X+B2*L)'+B1*B1',X*C1'+L'*D12'+B1*D11';...
+       (X*C1'+L'*D12'+B1*D11')',-gama^2*eye()+D11*D11'],[Y,C2*X+D22*L;(C2*X+D22*L)',X])
+       OBJ=trace(Y);
+endfunction
index 0a4a2cb..5423876 100644 (file)
@@ -5,25 +5,28 @@
 // This file is distributed under the same license as the Scilab package.
 //
 
- function [x,cout]=linprog(A,b,C,d,c,x0)
-// Generated by lmitool on Thu Feb 02 16:32:14 MET 1995
- Mbound = 1e3;
- abstol = 1e-10;
- nu = 10;
- maxiters = 100;
- reltol = 1.e-10;
- options=[Mbound,abstol,nu,maxiters,reltol];
- /////////////////DO NOT REMOVE THIS LINE
- x_init=x0;
- [nx,nx]=size(A);
- /////////////////DO NOT REMOVE THIS LINE
- XLIST0=list(x_init)
- [XLIST,cout]=lmisolver(XLIST0,linprog_eval,options)
- [x]=XLIST(:)
- /////////////////EVALUATION FUNCTION////////////////////////////
- function [LME,LMI,OBJ]=linprog_eval(XLIST)
- [x]=XLIST(:)
- /////////////////DO NOT REMOVE THIS LINE
- LME=C*x+d
- LMI=vec2list(A*x+b,[ones(nx,1),ones(nx,1)])
- OBJ=c'*x
+function [x,cout]=linprog(A,b,C,d,c,x0)
+       // Generated by lmitool on Thu Feb 02 16:32:14 MET 1995
+       Mbound = 1e3;
+       abstol = 1e-10;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1.e-10;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       /////////////////DO NOT REMOVE THIS LINE
+       x_init=x0;
+       [nx,nx]=size(A);
+       /////////////////DO NOT REMOVE THIS LINE
+       XLIST0=list(x_init)
+       [XLIST,cout]=lmisolver(XLIST0,linprog_eval,options)
+       [x]=XLIST(:)
+endfunction
+
+/////////////////EVALUATION FUNCTION////////////////////////////
+function [LME,LMI,OBJ]=linprog_eval(XLIST)
+       [x]=XLIST(:)
+       /////////////////DO NOT REMOVE THIS LINE
+       LME=C*x+d
+       LMI=vec2list(A*x+b,[ones(nx,1),ones(nx,1)])
+       OBJ=c'*x
+endfunction
@@ -5,9 +5,11 @@
 // This file is distributed under the same license as the Scilab package.
 //
 
-path=get_absolute_file_path('lmi.dem')
-getf(path+'lmidem.sci');
 mode(-1);
+
+path=get_absolute_file_path('lmi.dem.sce')
+exec(path+'lmidem.sci');
+
 x_message(['      ';
           'LMITOOL is a Scilab package for LMI optimization';
           '           ';
@@ -78,5 +80,5 @@ while %t
     disp(X, 'X found is:')
     disp(A*X+X*B-C ,'Check: A*X+X*B-C =')
     mode(-1)
-  end   
+  end
 end
index ba7893e..0adedba 100644 (file)
-//
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) ????-2008 - INRIA
-//
-// This file is distributed under the same license as the Scilab package.
-//
-
 function [txtdo]=lmidem(PROBNAME,XNAME,DNAME) 
-[LHS,RHS]=argn(0);
-txtdo=[]
-
-if RHS ~=3 then
-  PROBNAME1='foo';
-  XNAME1='X1,X2,...';
-  DNAME1='D1,D2,...';
-
-  if RHS==1 then
-    tt=read(PROBNAME,-1,1,'(a)');
-    tt=stripblanks(tt);
-    mat=str2vec(tt);
-
-    [q1,p1]=find(mat'=='[');
-    [q2,p2]=find(mat'==']');
-
-    XNAME1=mat(p1(1),q1(1)+1:q2(1)-1);
-    XNAME1=strcat(XNAME1);
-    [q1,p1]=find(mat'=='(');
-    [q2,p2]=find(mat'==')');
-    DNAME1=mat(p1(1),q1(1)+1:q2(1)-1);
-    DNAME1=strcat(DNAME1);
-    [q2,p2]=find(mat'=='=');
-    PROBNAME1=mat(p2(1),q2(1)+1:q1(1)-1);
-    PROBNAME1=strcat(PROBNAME1);
-  end
-
-  labels=['LMI problem name: ';'Names of unknown matrices: ';...
-          'Names of data matrices: '];
-//  [ok,PROBNAME,XNAME,DNAME]=getvalue(['Problem definition';
-//      'LMITOOL will generate for you a skeleton of the functions needed';
-//        ' (see User''s Guide for details). For that, you need to specify:';
-//        '1- Name of you problem which will be given to the solver function,';
-//        '2- Names of unknown matrices or list of unknown matrices,';
-//        '3- Names of data matrices or list of data matrices.'],labels,...
-//        list('str',1,'str',1,'str',1),...
-//        [PROBNAME1+'            ',XNAME1+'           ',DNAME1+'         ']);
-  ok=%t
-  PROBNAME=PROBNAME1;XNAME=XNAME1;DNAME=DNAME1;
-    if ok==%f then 
-        txtdo='Try again';return;
-      end
-    end      
-//    PROBNAME=stripblanks(PROBNAME);
-//    XNAME=stripblanks(XNAME);
-//    DNAME=stripblanks(DNAME);
-
-
-      pathname=getcwd();
-      fname = pathname+'/'+PROBNAME+'.sci';
-      txt0='function ['+XNAME+']='+PROBNAME+'('+DNAME+')'
-      txt0=[txt0;'/'+'/ Generated by lmitool on ';'  '];
-
-      txt0=[txt0;
-          '  Mbound = 1e3;';
-          '  abstol = 1e-10;';
-          '  nu = 10;';
-          '  maxiters = 100;';
-          '  reltol = 1e-10;';
-          '  options=[Mbound,abstol,nu,maxiters,reltol];'
-          '   ']
-
-      nv=length(XNAME);
-      index_commas=[];
-      for k=1:nv
-        if part(XNAME,k)==',' then index_commas=[index_commas,k],end
-      end
-      vnum = length(index_commas)+1;
-      index_commas = [0 index_commas length(XNAME)+1];
-
-      txt1=[];txt2=[];
-      for i = 1:vnum,
-        vname = part(XNAME,index_commas(i)+1:index_commas(i+1)-1);
-        if RHS<>1 then  
-          txt1 = [txt1;
-              vname+'_init=...']
-        end
-        txt2=[txt2,vname+'_init'];
-      end
-
-
-
-      txts1=['function [LME,LMI,OBJ]='+PROBNAME+'_eval(XLIST)';
-          '['+XNAME+']=XLIST(:)']
-      if RHS ~= 1 then
-        txts2=['LME=...';'LMI=...';'OBJ=...']
-      else
-        [p,q]=size(mat);
-        ind=[]
-        for i=1:p
-          if mat(i,2:7)==['/','/','/','/','/','/']  then
-            ind=[ind i];
-          end
-        end
-        if prod(size(ind))<>4 then 
-          error('File not generated by lmitool or badly modified');
-        end
-        txt1=[];
-        for i=ind(1)+1:ind(2)-1
-          txt1=[txt1;strcat(mat(i,:))];
-        end
-        txts2=[];
-        for i=ind(4)+1:p
-          txts2=[txts2;strcat(mat(i,:))];
-        end
-      end
-
-      sep11=['/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'...
-              +'/'+'INITIAL GUESS']
-      sep12=['/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'...
-              +'/'+' ']
-      sep13=['/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'...
-              +'/'+'LME, LMI and OBJ']
-
-      sep2=['/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'...
-              +'/'+'EVALUATION FUNCTION'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/']
-
-      txt2=[
-          'XLIST0=list('+strcat(txt2,',')+')';
-          'XLIST=lmisolver(XLIST0,'+PROBNAME+'_eval,options)';
-          '['+XNAME+']=XLIST(:)'];
-
-      txt4=[txt0;sep11;txt1;sep12;' ';txt2;' ';' ';' ';...
-              sep2;' ';txts1;' ';sep13;txts2];
+       [LHS,RHS]=argn(0);
+       txtdo=[]
+       
+       if RHS ~=3 then
+       PROBNAME1='foo';
+       XNAME1='X1,X2,...';
+       DNAME1='D1,D2,...';
+       
+       if RHS==1 then
+               tt=read(PROBNAME,-1,1,'(a)');
+               tt=stripblanks(tt);
+               mat=str2vec(tt);
+       
+               [q1,p1]=find(mat'=='[');
+               [q2,p2]=find(mat'==']');
+       
+               XNAME1=mat(p1(1),q1(1)+1:q2(1)-1);
+               XNAME1=strcat(XNAME1);
+               [q1,p1]=find(mat'=='(');
+               [q2,p2]=find(mat'==')');
+               DNAME1=mat(p1(1),q1(1)+1:q2(1)-1);
+               DNAME1=strcat(DNAME1);
+               [q2,p2]=find(mat'=='=');
+               PROBNAME1=mat(p2(1),q2(1)+1:q1(1)-1);
+               PROBNAME1=strcat(PROBNAME1);
+       end
+       
+       labels=['LMI problem name: ';'Names of unknown matrices: ';...
+                       'Names of data matrices: '];
+       //  [ok,PROBNAME,XNAME,DNAME]=getvalue(['Problem definition';
+       //      'LMITOOL will generate for you a skeleton of the functions needed';
+       //        ' (see User''s Guide for details). For that, you need to specify:';
+       //        '1- Name of you problem which will be given to the solver function,';
+       //        '2- Names of unknown matrices or list of unknown matrices,';
+       //        '3- Names of data matrices or list of data matrices.'],labels,...
+       //        list('str',1,'str',1,'str',1),...
+       //        [PROBNAME1+'            ',XNAME1+'           ',DNAME1+'         ']);
+       ok=%t
+       PROBNAME=PROBNAME1;XNAME=XNAME1;DNAME=DNAME1;
+               if ok==%f then 
+                       txtdo='Try again';return;
+               end
+               end      
+       //    PROBNAME=stripblanks(PROBNAME);
+       //    XNAME=stripblanks(XNAME);
+       //    DNAME=stripblanks(DNAME);
+       
+       
+               pathname=getcwd();
+               fname = pathname+'/'+PROBNAME+'.sci';
+       
+               txt0='function ['+XNAME+']='+PROBNAME+'('+DNAME+')'
+               txt0=[txt0;'/'+'/ Generated by lmitool on ';'  '];
+       
+               txt0=[txt0;
+                       '  Mbound = 1e3;';
+                       '  abstol = 1e-10;';
+                       '  nu = 10;';
+                       '  maxiters = 100;';
+                       '  reltol = 1e-10;';
+                       '  options=[Mbound,abstol,nu,maxiters,reltol];'
+                       '   ']
+       
+               nv=length(XNAME);
+               index_commas=[];
+               for k=1:nv
+                       if part(XNAME,k)==',' then index_commas=[index_commas,k],end
+               end
+               vnum = length(index_commas)+1;
+               index_commas = [0 index_commas length(XNAME)+1];
+       
+               txt1=[];txt2=[];
+               for i = 1:vnum,
+                       vname = part(XNAME,index_commas(i)+1:index_commas(i+1)-1);
+                       if RHS<>1 then  
+                       txt1 = [txt1;
+                               vname+'_init=...']
+                       end
+                       txt2=[txt2,vname+'_init'];
+               end
+       
+       
+       
+               txts1=['function [LME,LMI,OBJ]='+PROBNAME+'_eval(XLIST)';
+                       '['+XNAME+']=XLIST(:)']
+               if RHS ~= 1 then
+                       txts2=['LME=...';'LMI=...';'OBJ=...']
+               else
+                       [p,q]=size(mat);
+                       ind=[]
+                       for i=1:p
+                               if mat(i,2:7)==['/','/','/','/','/','/']  then
+                                       ind=[ind i];
+                               end
+                       end
+                       if prod(size(ind))<>4 then 
+                               error('File not generated by lmitool or badly modified');
+                       end
+                       txt1=[];
+                       for i=ind(1)+1:ind(2)-1
+                               txt1=[txt1;strcat(mat(i,:))];
+                       end
+                       txts2=[];
+                       for i=ind(4)+1:p
+                               txts2=[txts2;strcat(mat(i,:))];
+                       end
+               end
+       
+               sep11=['/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'INITIAL GUESS']
+               sep12=['/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+' ']
+               sep13=['/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'LME, LMI and OBJ']
+       
+               sep2=['/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'EVALUATION FUNCTION'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/'+'/']
+       
+               txt2=[
+                       'XLIST0=list('+strcat(txt2,',')+')';
+                       'XLIST=lmisolver(XLIST0,'+PROBNAME+'_eval,options)';
+                       '['+XNAME+']=XLIST(:)'];
+       
+               txt4=[          ..
+               txt0;    ..
+               sep11;   ..
+               txt1;    ..
+               sep12;   ..
+               ' ';     ..
+               txt2;    ..
+               ' ';     ..
+               ' ';     ..
+               ' ';     ..
+               sep2;    ..
+               ' ';     ..
+               txts1;   ..
+               ' ';     ..
+               sep13;   ..
+               txts2    ..
+            ];
+       
+               if RHS==0|RHS==1 then
+                       select %demo_
+                       case 1 
+                       txtdem=['The problem is here:';
+                                       'Minimize gama  under the constraints:'
+                                       '    X''-X = 0';
+                                       '    and '
+                                       '[A X + X A'''+', B, X C'']';
+                                       '[ B'''+', -gama I, D'']';
+                                       '[C X, D, -gama I] < 0';
+                                       '   '; 
+                                       'This problem is solved by the function below (do not edit)'
+                                       ]
+                       
+                       case 2 
+                               txtdem=['The problem is here:';
+                                       'Minimize trace(P+Q)  under the constraints:'
+                                       '    P''-P = 0';
+                                       '    Q''-Q = 0';
+                                       '    and '
+                                       '    NB'' (A Q + Q A'' + Q) NB < 0';
+                                       '    NC'' (A P + P A'' + P) NC < 0';
+                                       '    [P I; I Q] > 0'
+                                       ' where NB=kernel(B) and NC=kernel(C'')'
+                                       '   '; 
+                                       'This problem is solved by the function below (do not edit)'
+                                       ]
+                       case 3
+                       txtdem=['The problem is here:';
+                               'Find X such that A*X+X*B-C (continuous time)'
+                               'or Find X such that A*X*B-C (discrete time)'
+                               ]
+                       end
+                       [txt4]=x_dialog(txtdem,[txt4]);
+                       end
+               if txt4==[] then txtdo='Try again';return;end
+                       txt=[txt4];
+                       n=1;
+endfunction
 
-      if RHS==0|RHS==1 then
-        select %demo_
-        case 1 
-          txtdem=['The problem is here:';
-                  'Minimize gama  under the constraints:'
-                  '    X''-X = 0';
-                  '    and '
-                  '[A X + X A'''+', B, X C'']';
-                  '[ B'''+', -gama I, D'']';
-                  '[C X, D, -gama I] < 0';
-                '   '; 
-                'This problem is solved by the function below (do not edit)'
-                ]
-          
-          case 2 
-            txtdem=['The problem is here:';
-                  'Minimize trace(P+Q)  under the constraints:'
-                  '    P''-P = 0';
-                  '    Q''-Q = 0';
-                  '    and '
-                  '    NB'' (A Q + Q A'' + Q) NB < 0';
-                  '    NC'' (A P + P A'' + P) NC < 0';
-                  '    [P I; I Q] > 0'
-                  ' where NB=kernel(B) and NC=kernel(C'')'
-                '   '; 
-                'This problem is solved by the function below (do not edit)'
-                ]
-          case 3
-           txtdem=['The problem is here:';
-               'Find X such that A*X+X*B-C (continuous time)'
-               'or Find X such that A*X*B-C (discrete time)'
-               ]
-          end
-        [txt4]=x_dialog(txtdem,[txt4]);
-        end
-      if txt4==[] then txtdo='Try again';return;end
-        txt=[txt4];
-        n=1;
 function [vec]=str2vec(str)
-w=length(str);
-[p,q]=size(w);ma=max(w);
-vec=[];
-for i=1:ma
-  vec=[vec part(str,i)]
-end
+       w=length(str);
+       [p,q]=size(w);ma=max(w);
+       vec=[];
+       for i=1:ma
+               vec=[vec part(str,i)]
+       end
+endfunction
index 80bb1bd..84d805c 100644 (file)
@@ -6,24 +6,26 @@
 //
 
  function [X,cost]=norminf(E,A,B,C,D,gama)
-// Generated by lmitool on Mon Feb 06 11:12:51 MET 1995
- Mbound = 1e3;
- abstol = 1e-10;
- nu = 10;
- maxiters = 100;
- reltol = 1e-10;
- options=[Mbound,abstol,nu,maxiters,reltol];
- /////////////////DO NOT REMOVE THIS LINE
- X_init=eye(A);Ib=eye(B'*B);Ic=eye(C*C');
- /////////////////DO NOT REMOVE THIS LINE
- XLIST0=list(X_init)
- [XLIST,cost]=lmisolver(XLIST0,norminf_eval,options)
- [X]=XLIST(:)
- /////////////////EVALUATION FUNCTION////////////////////////////
- function [LME,LMI,OBJ]=norminf_eval(XLIST)
- [X]=XLIST(:)
- /////////////////DO NOT REMOVE THIS LINE
- LME=X-X'
- LMI=-[A*X*E'+E*X*A',B,E*X*C';B',-gama*Ib,D';C*X*E',D,-gama*Ic]
- OBJ=trace(X)
+       // Generated by lmitool on Mon Feb 06 11:12:51 MET 1995
+       Mbound = 1e3;
+       abstol = 1e-10;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1e-10;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       /////////////////DO NOT REMOVE THIS LINE
+       X_init=eye(A);Ib=eye(B'*B);Ic=eye(C*C');
+       /////////////////DO NOT REMOVE THIS LINE
+       XLIST0=list(X_init)
+       [XLIST,cost]=lmisolver(XLIST0,norminf_eval,options)
+       [X]=XLIST(:)
+endfunction
+
+/////////////////EVALUATION FUNCTION////////////////////////////
+function [LME,LMI,OBJ]=norminf_eval(XLIST)
+       [X]=XLIST(:)
+       /////////////////DO NOT REMOVE THIS LINE
+       LME=X-X'
+       LMI=-[A*X*E'+E*X*A',B,E*X*C';B',-gama*Ib,D';C*X*E',D,-gama*Ic]
+       OBJ=trace(X)
+endfunction
index 3d0b7e8..41cb8d5 100644 (file)
@@ -6,35 +6,36 @@
 //
 
  function [X,c]=normopt(A,B,C,D)
-// Generated by lmitool on Wed Feb 08 16:17:01 MET 1995
-   
-   Mbound = 1e3;
-   abstol = 1e-10;
-   nu = 10;
-   maxiters = 100;
-   reltol = 1e-10;
-   options=[Mbound,abstol,nu,maxiters,reltol];
-    
- ///////////DEFINE INITIAL GUESS BELOW
- X_init=eye(A);Ib=eye(B'*B);Ic=eye(C*C');c_init=10;                
- /////////// 
-  
- XLIST0=list(X_init,c_init)
- XLIST=lmisolver(XLIST0,normopt_eval,options)
- [X,c]=XLIST(:)
-  
-  
-  
- /////////////////EVALUATION FUNCTION////////////////////////////
-  
- function [LME,LMI,OBJ]=normopt_eval(XLIST)
- [X,gama]=XLIST(:)
-  
- /////////////////DEFINE LME, LMI and OBJ BELOW
- LME=X'-X                                                          
- LMI=-[A*X+X*A', B, X*C';
-       B', -gama*Ib, D';
-       C*X, D, -gama*Ic]              
- OBJ=gama                                                          
-                                                                   
-                                                                   
+       // Generated by lmitool on Wed Feb 08 16:17:01 MET 1995
+       
+       Mbound = 1e3;
+       abstol = 1e-10;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1e-10;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       
+       ///////////DEFINE INITIAL GUESS BELOW
+       X_init=eye(A);
+       Ib=eye(B'*B);
+       Ic=eye(C*C');
+       c_init=10;
+       ///////////
+       
+       XLIST0=list(X_init,c_init)
+       XLIST=lmisolver(XLIST0,normopt_eval,options)
+       [X,c]=XLIST(:)
+endfunction
+
+
+/////////////////EVALUATION FUNCTION////////////////////////////
+function [LME,LMI,OBJ]=normopt_eval(XLIST)
+       [X,gama]=XLIST(:)
+       
+       /////////////////DEFINE LME, LMI and OBJ BELOW
+       LME=X'-X
+       LMI=-[A*X+X*A', B, X*C';
+               B', -gama*Ib, D';
+               C*X, D, -gama*Ic]
+       OBJ=gama
+endfunction
index 8a9a61e..06330f9 100644 (file)
@@ -6,35 +6,33 @@
 //
 
  function [X,c]=normopt2(sys)
-// Generated by lmitool on Wed Feb 08 14:55:43 MET 1995
-   
-   Mbound = 1e3;
-   abstol = 1e-10;
-   nu = 10;
-   maxiters = 100;
-   reltol = 1e-10;
-   options=[Mbound,abstol,nu,maxiters,reltol];
-    
- ///////////DEFINE INITIAL GUESS BELOW
- [A,B,C,D]=abcd(sys)
- X_init=eye(A);Ib=eye(B'*B);Ic=eye(C*C');                          
- /////////// 
-  
- XLIST0=list(X_init,c_init)
- XLIST=lmisolver(XLIST0,normopt2_eval,options)
- [X,c]=XLIST(:)
-  
-  
-  
- /////////////////EVALUATION FUNCTION////////////////////////////
-  
- function [LME,LMI,OBJ]=normopt2_eval(XLIST)
- [X,c]=XLIST(:)
-  
- /////////////////DEFINE LME, LMI and OBJ BELOW
- LME=X'-X                                                          
- LMI=-[A*X+X*A',B,X*C';B',-gama*Ib,D';C*X,D,-gama*Ic]              
- //  LMI=-[A*X*E'+E*X*A',B,E*X*C';B',-gama*Ib,D';C*X*E',D,-gama*Ic]
- OBJ=gama                                                          
-                                                                   
-                                                                   
+       // Generated by lmitool on Wed Feb 08 14:55:43 MET 1995
+       
+       Mbound = 1e3;
+       abstol = 1e-10;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1e-10;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       
+       ///////////DEFINE INITIAL GUESS BELOW
+       [A,B,C,D]=abcd(sys)
+       X_init=eye(A);Ib=eye(B'*B);Ic=eye(C*C');                          
+       ///////////
+       
+       XLIST0=list(X_init,c_init)
+       XLIST=lmisolver(XLIST0,normopt2_eval,options)
+       [X,c]=XLIST(:)
+endfunction
+
+/////////////////EVALUATION FUNCTION////////////////////////////
+
+function [LME,LMI,OBJ]=normopt2_eval(XLIST)
+       [X,c]=XLIST(:)
+       
+       /////////////////DEFINE LME, LMI and OBJ BELOW
+       LME=X'-X
+       LMI=-[A*X+X*A',B,X*C';B',-gama*Ib,D';C*X,D,-gama*Ic]
+       //  LMI=-[A*X*E'+E*X*A',B,E*X*C';B',-gama*Ib,D';C*X*E',D,-gama*Ic]
+       OBJ=gama
+endfunction
index f83f6fb..4092434 100644 (file)
@@ -6,27 +6,28 @@
 //
 
  function [X,c]=normoptd(A,B,C,D)
-// Generated by lmitool on Mon Feb 06 11:12:51 MET 1995
- Mbound = 1e3;
- abstol = 1e-10;
- nu = 10;
- maxiters = 100;
- reltol = 1e-10;
- options=[Mbound,abstol,nu,maxiters,reltol];
- /////////////////DO NOT REMOVE THIS LINE
- X_init=eye(A);Ib=eye(B'*B);
- /////////////////DO NOT REMOVE THIS LINE
- XLIST0=list(X_init,10)
- [XLIST,cost]=lmisolver(XLIST0,normoptd_eval,options)
- [X,c]=XLIST(:)
- /////////////////EVALUATION FUNCTION////////////////////////////
- function [LME,LMI,OBJ]=normoptd_eval(XLIST)
- [X,g2]=XLIST(:)
- /////////////////DO NOT REMOVE THIS LINE
- LME=X'-X;
- LMI= -[A'*X*A+C'*C-X, A'*X*B+C'*D; 
-        D'*C+B'*X*A , D'*D+B'*X*B-g2*Ib]
- OBJ=g2
-  
+       // Generated by lmitool on Mon Feb 06 11:12:51 MET 1995
+       Mbound = 1e3;
+       abstol = 1e-10;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1e-10;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       /////////////////DO NOT REMOVE THIS LINE
+       X_init=eye(A);Ib=eye(B'*B);
+       /////////////////DO NOT REMOVE THIS LINE
+       XLIST0=list(X_init,10)
+       [XLIST,cost]=lmisolver(XLIST0,normoptd_eval,options)
+       [X,c]=XLIST(:)
+endfunction
+
+/////////////////EVALUATION FUNCTION////////////////////////////
+
+function [LME,LMI,OBJ]=normoptd_eval(XLIST)
+       [X,g2]=XLIST(:)
+       /////////////////DO NOT REMOVE THIS LINE
+       LME=X'-X;
+       LMI= -[A'*X*A+C'*C-X, A'*X*B+C'*D;
+                       D'*C+B'*X*A , D'*D+B'*X*B-g2*Ib]
+       OBJ=g2
+endfunction
index 18823eb..cc89be2 100644 (file)
@@ -6,36 +6,35 @@
 //
 
  function [P,Q]=of(A,B,C)
-// Generated by lmitool on Thu Feb 09 11:22:01 MET 1995
-   
-   Mbound = 1e3;
-   abstol = 1e-10;
-   nu = 10;
-   maxiters = 100;
-   reltol = 1e-10;
-   options=[Mbound,abstol,nu,maxiters,reltol];
-    
- ///////////DEFINE INITIAL GUESS AND PRELIMINARY CALCULATIONS BELOW
- P_init=zeros(A)                                                   
- Q_init=zeros(A)                                                   
- NB=kernel(B');                                                    
- NC=kernel(C);                                                     
- I=eye(A);                                                         
- /////////// 
-  
- XLIST0=list(P_init,Q_init)
- XLIST=lmisolver(XLIST0,of_eval,options)
- [P,Q]=XLIST(:)
-  
-  
-  
- /////////////////EVALUATION FUNCTION////////////////////////////
-  
- function [LME,LMI,OBJ]=of_eval(XLIST)
- [P,Q]=XLIST(:)
-  
- /////////////////DEFINE LME, LMI and OBJ BELOW
- LME=list(P-P',Q-Q')                                               
- LMI= list(-NB'*(A*Q+Q*A'+Q)*NB,-NC'*(A'*P+P*A+P)*NC,[P I; I Q]);  
- OBJ=trace(P+Q);                                                   
-                                                                   
+       // Generated by lmitool on Thu Feb 09 11:22:01 MET 1995
+       
+       Mbound = 1e3;
+       abstol = 1e-10;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1e-10;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       
+       ///////////DEFINE INITIAL GUESS AND PRELIMINARY CALCULATIONS BELOW
+       P_init=zeros(A);
+       Q_init=zeros(A);
+       NB=kernel(B');
+       NC=kernel(C);
+       I=eye(A);
+       ///////////
+       
+       XLIST0=list(P_init,Q_init)
+       XLIST=lmisolver(XLIST0,of_eval,options)
+       [P,Q]=XLIST(:)
+endfunction
+
+/////////////////EVALUATION FUNCTION////////////////////////////
+
+function [LME,LMI,OBJ]=of_eval(XLIST)
+       [P,Q]=XLIST(:)
+       
+       /////////////////DEFINE LME, LMI and OBJ BELOW
+       LME = list(P-P',Q-Q')
+       LMI = list(-NB'*(A*Q+Q*A'+Q)*NB,-NC'*(A'*P+P*A+P)*NC,[P I; I Q]);
+       OBJ = trace(P+Q);
+endfunction
index 7c32516..9983ba8 100644 (file)
 //
 
 function [x,Z,z,ul,iters] = phase1(F,blck_szs,M,nu,abstol,maxiters);
-// [x,Z,z,ul,iters] = phase1(F,blck_szs,M,nu,abstol,maxiters);
-//
-// Find an x s.t. F(x) > 0 and Tr F(x) < M 
-//    or prove that no such x exists.
-
-// minimize    t 
-// subject to  F(x) + t*I = F_0 + x_1*F_1 + ... + x_m*F_m + t*I >= 0 
-//             Tr F(x) <= M
-//
-// maximize    -Tr F_0*(Z-z*I) - M*z
-// subject to  0 = Tr F_i*(Z - z*I)
-//             1 = Tr Z 
-//             Z >= 0, z >= 0
-//
-// Convergence criterion:
-// (1) maxiters is exceeded
-// (2) duality gap is less than abstol
-// (3) primal objective is less than zero or dual objective is greater
-//     than zero
-//  
-// Input arguments:
-// F:         (sum_i n_i^2) x (m+1) matrix
-//            [ vec(F_0(1)) vec(F_1(1)) ... vec(F_m(1)) ]
-//            [ vec(F_0(2)) vec(F_1(2)) ... vec(F_m(2)) ]
-//                ...        ...              ...
-//            [ vec(F_0(L)) vec(F_1(L)) ... vec(F_m(L)) ]
-//            where F_i(j) denotes the jth block of F_i, 
-//            F_i(j) has size n_i x n_i
-// blck_szs:  L-vector [n_1 ... n_L], contains dimensions of blocks
-// M:         scalar
-// nu:        >= 1.0
-// abstol:    absolute tolerance
-// maxiters:  maximum number of iterations
-//
-// Output arguments:
-// x:         m-vector: 
-// Z:         block-diagonal matrix stored as 
-//            [ vec(Z(1)); vec(Z(2)); ... ; vec(Z(L)) ]
-//            where Z(i) is the ith block
-// z:         scalar part of last dual iterate, 
-// ul:        2-vector, primal and dual objective
-// iters:     scalar
-if type(F)==5 then F=full(F);end
-[mf,nf]=size(F)
-m = nf-1;
-if (mf ~= sum(blck_szs^2)) 
-   error('Dimensions of F do not match blck_szs.');
-end;
-
-// mineigF is the smallest eigenvalue of F_0
-mineigF = 0.0;
-blck_szs=matrix(blck_szs,1,prod(size(blck_szs)));
-k=0; for n=blck_szs,
-   mineigF = min(mineigF, min(real(spec(matrix(F(k+[1:n*n],1),n,n)))));
-   k=k+n*n;   // k = sum n_i*n_i 
-end;
-
-// I is the identity
-I = zeros(mf,1);  
-k=0; for n=blck_szs,
-   I(k+[1:n*n]) = matrix(eye(n,n),n*n,1);   // identity
-   k=k+n*n;   // k = sum n_i*n_i 
-end;
-
-if (M < I'*F(:,1)+1e-5), 
-   error('M must be strictly greater than the trace of F_0.'); 
-end;
-
-// initial x0 
-x0 = [zeros(m,1); max(-1.1*mineigF, 1e-5)];
-
-// Z0 is the projection of I on the space Tr F_i*Z = 0
-Z0 = I - F(:,2:m+1) * ( F(:,2:m+1) \ I );
-// mineigZ is the smallest eigenvalue of Z0
-mineigZ = 0.0;
-k=0; for n=blck_szs,
-   mineigZ = min( mineigZ, min(real(spec(matrix(Z0(k+[1:n*n]),n,n)))) );
-   k=k+n*n;   // k = sum n_i*n_i 
-end;
-
-// z = max ( 1e-5, -1.1*mineigZ)
-Z0(k+1) = max( -1.1 * mineigZ, 1e-5 );  // z  
-Z0(1:k) = Z0(1:k) + Z0(k+1)*I; 
-Z0 = Z0 / (I'*Z0(1:k));    // make Tr Z0 = 1
-// add scalar block Tr F(x) <= M
-
-F = [F, I; M-I'*F(:,1), -I'*F(:,2:m+1), 0]; 
-blck_szs = [blck_szs,1];
-c = [zeros(m,1); 1];
-//Pack Z0 and F
-Z0=pack(Z0,blck_szs);F=pack(F,blck_szs);
-//pause;
-[x,Z,ul,info]=semidef(x0,Z0,F,blck_szs,c,[nu,abstol,-1,0,maxiters]);
-nz=prod(size(Z))
-z=Z(nz)
-Z=unpack(Z(1:nz-1),blck_szs(1:prod(size(blck_szs))-1))
-Z = Z(1:k);
-x = x(1:m);
-iters = info(2);
-select info(1)
-case 1
-     error('Max. iters. exeeded');
-case 2 then
-     disp('Absolute accuracy reached');
-case 3 then
-     disp('relative accuracy reached');
-case 4 then
-     disp('target value reached');
-case 5 then
-     error('target value not achievable');
-       else
-     error('semidef fails');
-end
+       // [x,Z,z,ul,iters] = phase1(F,blck_szs,M,nu,abstol,maxiters);
+       //
+       // Find an x s.t. F(x) > 0 and Tr F(x) < M 
+       //    or prove that no such x exists.
+       
+       // minimize    t 
+       // subject to  F(x) + t*I = F_0 + x_1*F_1 + ... + x_m*F_m + t*I >= 0 
+       //             Tr F(x) <= M
+       //
+       // maximize    -Tr F_0*(Z-z*I) - M*z
+       // subject to  0 = Tr F_i*(Z - z*I)
+       //             1 = Tr Z 
+       //             Z >= 0, z >= 0
+       //
+       // Convergence criterion:
+       // (1) maxiters is exceeded
+       // (2) duality gap is less than abstol
+       // (3) primal objective is less than zero or dual objective is greater
+       //     than zero
+       //  
+       // Input arguments:
+       // F:         (sum_i n_i^2) x (m+1) matrix
+       //            [ vec(F_0(1)) vec(F_1(1)) ... vec(F_m(1)) ]
+       //            [ vec(F_0(2)) vec(F_1(2)) ... vec(F_m(2)) ]
+       //                ...        ...              ...
+       //            [ vec(F_0(L)) vec(F_1(L)) ... vec(F_m(L)) ]
+       //            where F_i(j) denotes the jth block of F_i, 
+       //            F_i(j) has size n_i x n_i
+       // blck_szs:  L-vector [n_1 ... n_L], contains dimensions of blocks
+       // M:         scalar
+       // nu:        >= 1.0
+       // abstol:    absolute tolerance
+       // maxiters:  maximum number of iterations
+       //
+       // Output arguments:
+       // x:         m-vector: 
+       // Z:         block-diagonal matrix stored as 
+       //            [ vec(Z(1)); vec(Z(2)); ... ; vec(Z(L)) ]
+       //            where Z(i) is the ith block
+       // z:         scalar part of last dual iterate, 
+       // ul:        2-vector, primal and dual objective
+       // iters:     scalar
+       
+       if type(F)==5 then F=full(F);end
+       [mf,nf]=size(F)
+       m = nf-1;
+       if (mf ~= sum(blck_szs^2)) 
+               error('Dimensions of F do not match blck_szs.');
+       end;
+       
+       // mineigF is the smallest eigenvalue of F_0
+       mineigF = 0.0;
+       blck_szs=matrix(blck_szs,1,prod(size(blck_szs)));
+       k=0;
+       for n=blck_szs,
+               mineigF = min(mineigF, min(real(spec(matrix(F(k+[1:n*n],1),n,n)))));
+               k=k+n*n;   // k = sum n_i*n_i 
+       end;
+       
+       // I is the identity
+       I = zeros(mf,1);  
+       k=0; for n=blck_szs,
+       I(k+[1:n*n]) = matrix(eye(n,n),n*n,1);   // identity
+       k=k+n*n;   // k = sum n_i*n_i 
+       end;
+       
+       if (M < I'*F(:,1)+1e-5), 
+               error('M must be strictly greater than the trace of F_0.'); 
+       end;
+       
+       // initial x0 
+       x0 = [zeros(m,1); max(-1.1*mineigF, 1e-5)];
+       
+       // Z0 is the projection of I on the space Tr F_i*Z = 0
+       Z0 = I - F(:,2:m+1) * ( F(:,2:m+1) \ I );
+       // mineigZ is the smallest eigenvalue of Z0
+       mineigZ = 0.0;
+       k=0; for n=blck_szs,
+       mineigZ = min( mineigZ, min(real(spec(matrix(Z0(k+[1:n*n]),n,n)))) );
+       k=k+n*n;   // k = sum n_i*n_i 
+       end;
+       
+       // z = max ( 1e-5, -1.1*mineigZ)
+       Z0(k+1) = max( -1.1 * mineigZ, 1e-5 );  // z  
+       Z0(1:k) = Z0(1:k) + Z0(k+1)*I; 
+       Z0 = Z0 / (I'*Z0(1:k));    // make Tr Z0 = 1
+       // add scalar block Tr F(x) <= M
+       
+       F = [F, I; M-I'*F(:,1), -I'*F(:,2:m+1), 0]; 
+       blck_szs = [blck_szs,1];
+       c = [zeros(m,1); 1];
+       //Pack Z0 and F
+       Z0=pack(Z0,blck_szs);F=pack(F,blck_szs);
+       //pause;
+       [x,Z,ul,info]=semidef(x0,Z0,F,blck_szs,c,[nu,abstol,-1,0,maxiters]);
+       nz=prod(size(Z))
+       z=Z(nz)
+       Z=unpack(Z(1:nz-1),blck_szs(1:prod(size(blck_szs))-1))
+       Z = Z(1:k);
+       x = x(1:m);
+       iters = info(2);
+       select info(1)
+       case 1
+               error('Max. iters. exeeded');
+       case 2 then
+               disp('Absolute accuracy reached');
+       case 3 then
+               disp('relative accuracy reached');
+       case 4 then
+               disp('target value reached');
+       case 5 then
+               error('target value not achievable');
+       else
+               error('semidef fails');
+       end
+endfunction
index e76f0c7..bea91c2 100644 (file)
@@ -6,31 +6,31 @@
 //
 
  function [P]=ric_dscr(E,A,C,Q,R)
-// Generated by lmitool on Thu Feb 09 15:59:05 MET 1995
-   
-   Mbound = 1e3;
-   abstol = 1e-10;
-   nu = 10;
-   maxiters = 100;
-   reltol = 1e-10;
-   options=[Mbound,abstol,nu,maxiters,reltol];
-    
- ///////////DEFINE INITIAL GUESS AND PRELIMINARY CALCULATIONS BELOW
- P_init=zeros(A'*A)
- /////////// 
-  
- XLIST0=list(P_init)
- XLIST=lmisolver(XLIST0,ric_dscr_eval,options)
- [P]=XLIST(:)
-  
-  
-  
+       // Generated by lmitool on Thu Feb 09 15:59:05 MET 1995
+       
+       Mbound = 1e3;
+       abstol = 1e-10;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1e-10;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       
+       ///////////DEFINE INITIAL GUESS AND PRELIMINARY CALCULATIONS BELOW
+       P_init=zeros(A'*A)
+       ///////////
+       
+       XLIST0=list(P_init)
+       XLIST=lmisolver(XLIST0,ric_dscr_eval,options)
+       [P]=XLIST(:)
+endfunction
+
+
  /////////////////EVALUATION FUNCTION////////////////////////////
-  
- function [LME,LMI,OBJ]=ric_dscr_eval(XLIST)
- [P]=XLIST(:)
-  
- /////////////////DEFINE LME, LMI and OBJ BELOW
- LME=P-P'
- LMI=[A*P*A'+Q,zeros(A*C'),E*P;zeros(C*A'),R,C*P;P*E',P*C',P]
- OBJ=-trace(P)
+
+function [LME,LMI,OBJ]=ric_dscr_eval(XLIST)
+       [P]=XLIST(:)
+       /////////////////DEFINE LME, LMI and OBJ BELOW
+       LME=P-P'
+       LMI=[A*P*A'+Q,zeros(A*C'),E*P;zeros(C*A'),R,C*P;P*E',P*C',P]
+       OBJ=-trace(P)
+endfunction
index b9a46ed..4419a9f 100644 (file)
@@ -6,37 +6,33 @@
 //
 
  function [X]=sylvester(A,B,C,flag)
-// Generated by lmitool on Thu Feb 09 11:55:34 MET 1995
-   
-   Mbound = 1e3;
-   abstol = 1e-10;
-   nu = 10;
-   maxiters = 100;
-   reltol = 1e-10;
-   options=[Mbound,abstol,nu,maxiters,reltol];
-    
- ///////////DEFINE INITIAL GUESS AND PRELIMINARY CALCULATIONS BELOW
- [na,ma]=size(A);[nb,mb]=size(B)                                   
- if ma<>na|mb<>nb then error("invalid dimensions");end             
- X_init=zeros(ma,nb)                                               
- /////////// 
-  
- XLIST0=list(X_init)
- XLIST=lmisolver(XLIST0,sylvester_eval,options)
- [X]=XLIST(:)
-  
-  
-  
+       // Generated by lmitool on Thu Feb 09 11:55:34 MET 1995
+       Mbound = 1e3;
+       abstol = 1e-10;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1e-10;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       
+       ///////////DEFINE INITIAL GUESS AND PRELIMINARY CALCULATIONS BELOW
+       [na,ma]=size(A);[nb,mb]=size(B)                                   
+       if ma<>na|mb<>nb then error("invalid dimensions");end             
+       X_init=zeros(ma,nb)                                               
+       
+       ///////////
+       XLIST0=list(X_init)
+       XLIST=lmisolver(XLIST0,sylvester_eval,options)
+       [X]=XLIST(:)
+endfunction
+
  /////////////////EVALUATION FUNCTION////////////////////////////
-  
- function [LME,LMI,OBJ]=sylvester_eval(XLIST)
- [X]=XLIST(:)
-  
- /////////////////DEFINE LME, LMI and OBJ BELOW
- if flag=='c' then LME=A*X+X*B-C                                   
- else LME=A*X*B-C                                                  
- end                                                               
- LMI=[]                                                            
- OBJ=[]                                                            
-                                                                   
-                                                                   
+function [LME,LMI,OBJ]=sylvester_eval(XLIST)
+       [X]=XLIST(:)
+       
+       /////////////////DEFINE LME, LMI and OBJ BELOW
+       if flag=='c' then LME=A*X+X*B-C
+       else LME=A*X*B-C
+       end
+       LMI=[]
+       OBJ=[]
+endfunction
index 7c06e6a..163902d 100644 (file)
@@ -6,31 +6,31 @@
 //
 
  function [X]=test(A1,A2,Q1,Q2)
- // Generated by lmitool on Thu Feb 09 17:48:51 MET 1995
-   
-   Mbound = 1e3;
-   abstol = 1e-10;
-   nu = 10;
-   maxiters = 100;
-   reltol = 1e-10;
-   options=[Mbound,abstol,nu,maxiters,reltol];
-    
- ///////////DEFINE INITIAL GUESS AND PRELIMINARY CALCULATIONS BELOW
- X_init=zeros(A1)
- /////////// 
-  
- XLIST0=list(X_init)
- XLIST=lmisolver(XLIST0,test_eval,options)
- [X]=XLIST(:)
-  
-  
-  
- /////////////////EVALUATION FUNCTION////////////////////////////
-  
- function [LME,LMI,OBJ]=test_eval(XLIST)
- [X]=XLIST(:)
-  
- /////////////////DEFINE LME, LMI and OBJ BELOW
- LME=X-diag(diag(X))
- LMI=list(-(A1'*X+X*A1+Q1),-(A2'*X+X*A2+Q2))
- OBJ=-trace(X)
+       // Generated by lmitool on Thu Feb 09 17:48:51 MET 1995
+       
+       Mbound = 1e3;
+       abstol = 1e-10;
+       nu = 10;
+       maxiters = 100;
+       reltol = 1e-10;
+       options=[Mbound,abstol,nu,maxiters,reltol];
+       
+       ///////////DEFINE INITIAL GUESS AND PRELIMINARY CALCULATIONS BELOW
+       X_init=zeros(A1)
+       ///////////
+       
+       XLIST0=list(X_init)
+       XLIST=lmisolver(XLIST0,test_eval,options)
+       [X]=XLIST(:)
+endfunction
+
+/////////////////EVALUATION FUNCTION////////////////////////////
+
+function [LME,LMI,OBJ]=test_eval(XLIST)
+       [X]=XLIST(:)
+       
+       /////////////////DEFINE LME, LMI and OBJ BELOW
+       LME=X-diag(diag(X))
+       LMI=list(-(A1'*X+X*A1+Q1),-(A2'*X+X*A2+Q2))
+       OBJ=-trace(X)
+endfunction
index d618049..afa3cc4 100644 (file)
@@ -1,18 +1,30 @@
-// Copyright INRIA
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+// This file is distributed under the same license as the Scilab package.
+//
+
+path = get_absolute_file_path('testdscr_lyap');
+
+
 n=3;
-rand('seed',0)
-rand('normal')
-E=rand(n,1)*rand(1,n)
-A=-rand(n,n)-eye()
-C=rand(n,n);
-getf(SCI+'/demos/lmitool/dscr_lyap.sci','c')
-[X,Y]=dscr_lyap(E,A,C)
+rand('seed',0);
+rand('normal');
+E = rand(n,1)*rand(1,n);
+A = -rand(n,n)-eye();
+C = rand(n,n);
+
+// ===================================
+
+exec(path+"/dscr_lyap.sci");
+[X,Y]=dscr_lyap(E,A,C);
 A'*X+Y'*A+C'*C
 E'*X-Y'*E
 spec(E'*X)
 
-
-getf(SCI+'/demos/lmitool/dscr_lyap2.sci','c') 
+// ===================================
+exec(path+"/dscr_lyap2.sci");
 X=dscr_lyap2(E,A)
 E'*X-Y'*E
 spec(E'*X)
index 8acac0d..6cd1efa 100644 (file)
@@ -1,5 +1,13 @@
-// Copyright INRIA
-getf(SCI+'/demos/lmitool/h2hinf.sci','c');
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+// This file is distributed under the same license as the Scilab package.
+//
+
+path = get_absolute_file_path('testh2hinf');
+exec(path+"/h2hinf.sci");
+
 n=4;m1=1;m2=2;n1=2;n2=2;
 A=rand(n,n);
 B2=rand(n,m2);
@@ -11,4 +19,3 @@ D12=rand(n1,m2);
 D22=rand(n2,m2);
 gama=10;
 [X,Y,L]=h2hinf(A,B1,B2,C1,C2,D11,D12,D22,gama)
-
index 87715a8..9394094 100644 (file)
@@ -1,5 +1,13 @@
-// Copyright INRIA
-getf(SCI+'/demos/lmitool/linprog.sci','c')
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+// This file is distributed under the same license as the Scilab package.
+//
+
+path = get_absolute_file_path('testlinprog');
+exec(path+"/linprog.sci");
+
 rand('seed',0);
 //rand('normal')
 n=10;nc=6;
index 1d7d2df..1996437 100644 (file)
@@ -1,5 +1,13 @@
-// Copyright INRIA
-getf(SCI+'/demos/lmitool/norminf.sci','c')
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+// This file is distributed under the same license as the Scilab package.
+//
+
+path = get_absolute_file_path('testnorminf');
+exec(path+"/norminf.sci");
+
 n=4;nu=2;ny=2;
 E=eye(n,n);
 rand('seed',0)
index 8e1727e..2d6f3d7 100644 (file)
@@ -1,5 +1,13 @@
-// Copyright INRIA
-getf(SCI+'/demos/lmitool/normopt.sci','c')
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+// This file is distributed under the same license as the Scilab package.
+//
+
+path = get_absolute_file_path('testnormopt');
+exec(path+"/normopt.sci");
+
 n=5;nu=2;ny=2;
 //rand('seed',0)
 A=rand(n,n);
diff --git a/scilab/modules/optimization/demos/lmitool/tset.sci b/scilab/modules/optimization/demos/lmitool/tset.sci
deleted file mode 100644 (file)
index 8114f3e..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) ????-2008 - INRIA
-//
-// This file is distributed under the same license as the Scilab package.
-//
-
- function [X]=tset(A1,A2,Q1,Q2)
- // Generated by lmitool on Thu Feb 09 17:48:51 MET 1995
-   
-   Mbound = 1e3;
-   abstol = 1e-10;
-   nu = 10;
-   maxiters = 100;
-   reltol = 1e-10;
-   options=[Mbound,abstol,nu,maxiters,reltol];
-    
- ///////////DEFINE INITIAL GUESS AND PRELIMINARY CALCULATIONS BELOW
- X_init=zeros(A1)
- /////////// 
-  
- XLIST0=list(X_init)
- XLIST=lmisolver(XLIST0,tset_eval,options)
- [X]=XLIST(:)
-  
-  
-  
- /////////////////EVALUATION FUNCTION////////////////////////////
-  
- function [LME,LMI,OBJ]=tset_eval(XLIST)
- [X]=XLIST(:)
-  
- /////////////////DEFINE LME, LMI and OBJ BELOW
- LME=X-diag(diag(X))
- LMI=list(-(A1'*X+X*A1+Q1),-(A2'*X+X*A2+Q2))
- OBJ=-trace(X)
@@ -5,7 +5,8 @@
 // This file is distributed under the same license as the Scilab package.
 //
 
-mode(-1)
-path=get_absolute_file_path('multiflow.dem');
-getf(path+'demo_multiflow.sci')
+mode(-1);
+
+path=get_absolute_file_path('multiflow.dem.sce');
+exec(path+'demo_multiflow.sci')
 demo_multiflow(path+'ex3.graph')
diff --git a/scilab/modules/optimization/demos/optimization.dem b/scilab/modules/optimization/demos/optimization.dem
deleted file mode 100644 (file)
index 6434381..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) ????-2008 - INRIA
-//
-// This file is distributed under the same license as the Scilab package.
-//
-
-mode(-1)
-path=get_absolute_file_path('optimization.dem');
-oldln=lines();lines(0);
-
-
-demolist=['LMITOOL',                       'lmitool/lmi.dem'
-         'Multiflow problem'              'multiflow/multiflow.dem'
-          'Non linear data fitting'        'datafit/datafit.dem'
-         'Optimal ressource allocation'   'optloc/optloc.dem']
-
-
-deff('[]=demoex(num)','exec(path+demolist(num,2),-1)')
-
-//xbasc();
-while %t then
-  num=x_choose(demolist(:,1),'Choose a demo');
-  if num==0 then 
-     lines(oldln(1))
-     return
-  else
-     demoex(num)
-  end,
-end
diff --git a/scilab/modules/optimization/demos/optimization.dem.gateway.sce b/scilab/modules/optimization/demos/optimization.dem.gateway.sce
new file mode 100644 (file)
index 0000000..96d8a13
--- /dev/null
@@ -0,0 +1,16 @@
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+// This file is distributed under the same license as the Scilab package.
+//
+
+
+demopath = get_absolute_file_path("optimization.dem.gateway.sce");
+
+subdemolist = ["LMITOOL"                       , "lmitool/lmi.dem.sce"           ; ..
+               "Multiflow problem"             , "multiflow/multiflow.dem.sce"   ; ..
+               "Non linear data fitting"       , "datafit/datafit.dem.sce"       ; ..
+               "Optimal ressource allocation"  , "optloc/optloc.dem.sce"         ]
+
+subdemolist(:,2) = demopath + subdemolist(:,2)
index 561c663..fe1a3dd 100644 (file)
@@ -12,9 +12,8 @@ function demo_optloc()
   //The coordinates of the points
   Alpha=round(99*rand(n,1))+1;
   Beta=round(99*rand(n,1))+1;
-  
-  clf();
-  xselect();
+  my_handle             = scf(100001);
+  clf(my_handle,"reset");
   drawlater();
   plot(Alpha,Beta,'*')
   e=gce();e=e.children;e.mark_size=10;
@@ -33,7 +32,7 @@ function demo_optloc()
   e=gce();e=e.children;e.mark_size=10;
   delete(l)
   l=legend([_('Customer locations');
-           msprintf(_('Service %d locations'),1)])
+  msprintf(_('Service %d locations'),1)])
   drawnow()
   [ic,jc]=find(X1>0);
   xsegs([Alpha(ic) Alpha(jc)]',[Beta(ic),Beta(jc)]',12)
@@ -42,7 +41,7 @@ function demo_optloc()
 
   [X1,Y1]=optloc(Alpha,Beta,C);
   kf=find(Y1>0);
-  
+
   drawlater();
   plot(Alpha(kf),Beta(kf),'go')
   e=gce();e=e.children;e.mark_size=14;
@@ -5,7 +5,8 @@
 // This file is distributed under the same license as the Scilab package.
 //
 
-mode(-1)
-path=get_absolute_file_path('optloc.dem');
+mode(-1);
+
+path=get_absolute_file_path('optloc.dem.sce');
 exec(path+'demo_optloc.sci');
 demo_optloc()
index ff5cd4c..171eb76 100644 (file)
@@ -11,7 +11,7 @@ add_module_help_chapter('optimization');
 //add demos
 path = get_absolute_file_path('optimization.start');
 path = getshortpathname(path);
-pathdemos = pathconvert(part(path,1:(length(path)-5))+'/demos/optimization.dem',%f,%f);
+pathdemos = pathconvert(part(path,1:(length(path)-5))+'/demos/optimization.dem.gateway.sce',%f,%f);
 
 add_demo("Optimization and Simulation",pathdemos);