63c1210aeacd1234428bd54a0e31bba2251fe9ad
[scilab.git] / scilab / modules / optimization / demos / icse / icseinit.sce
1 //
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) ????-2008 - INRIA
4 // Copyright (C) 2010 - DIGITEO - Yann COLLETTE
5 //
6 // This file is distributed under the same license as the Scilab package.
7 //
8
9 // icse.init.bas : initialization and tests for icse
10 //**************************************************
11 //
12
13 // creation of y0 (initial state)
14 if exists("y0")==0 then
15     y0 = ones(1,ny);
16 end
17 // creation of b,fy and fu and transformation to line vectors
18 if exists("b")==0 then
19     b = ones(1,ny);
20 end
21 if exists("fy")==0 then
22     fy1 = ones(1,ny*ny);
23 else
24     fy1 = matrix(fy,1,ny*ny);
25 end
26 if exists("fu")==0 then
27     fu1 = ones(1,ny*(nuc+nuv));
28 else
29     fu1 = matrix(fu,1,ny*(nuc+nuv));
30 end
31
32 format("e");
33 iu(5) = 0;
34 [xx,nitu] = size(itu);
35 [yy,ndtu] = size(dtu);
36
37 if xx+yy>2 then
38     error("itu and / or dtu is not a line vector");
39 end
40 u = [];
41 if nuc>0 then u = uc; end;
42 if nuv>0 then u = [u,uv]; end;
43 nu = nuc+nuv*(nti+ntf+1);
44
45 if size(u)<>[1,nu] then
46     error("dimensions of the control are incompatible");
47 end
48 clear xx yy;
49
50 //    initialisation du common icsez
51 [nitv,nrtv,ndtv]=fort("icse0",nu,1,"i",t0,2,"d",tf,3,"d",dti,4,"d",..
52 dtf,5,"d",ermx,6,"d",iu,7,"i",nuc,8,"i",nuv,9,"i",ilin,10,"i",nti,..
53 11,"i",ntf,12,"i",ny,13,"i",nea,14,"i",itmx,15,"i",nex,16,"i",nob,..
54 17,"i",ntob,18,"i",ntobi,19,"i",nitu,20,"i",ndtu,21,"i","sort",..
55 [1,1],22,"i",[1,1],23,"i",[1,1],24,"i");
56