Question: Minimization Process

Hi all 

I have the following segment of maple program which belongs to time delay systems dynamic. here C=X-X0-G.Z-X.Dtau.P+X.Dtau.Z-U.P, is a matrix(vector) which comes from reordering the system terms and my goal is to minimizing J:=X.E.Transpose(X)+U.E.Transpose(U), subject to constraint C=0, but i don't know how to do so.

I will be so grateful if anyone can guide me

best wishes

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department


restart:
with(Optimization):
with(LinearAlgebra):
macro(LA= LinearAlgebra):
L:=1:  r:=2:  tau:= 1:
interface(rtablesize= 2*r+1):

Z:= Matrix(
     2*r+1, 2*r+1,
     [tau,
      seq(evalf((L/(2*(iz-1)*Pi))*sin(2*(iz-1)*Pi*tau/L)), iz= 2..r+1),
      seq(evalf((L/(2*(iz-1-r)*Pi))*(1-cos(2*(iz-1-r)*Pi*tau/L))), iz= r+2..2*r+1)
      ],
     scan= columns,
     datatype= float[8]
);
                        
Dtau00:= < 1 >:
Dtau01:= Vector[row](r):
Dtau02:= Vector[row](r):
Dtau10:= Vector(r):
Dtau20:= Vector(r):

Dtau1:= LA:-DiagonalMatrix([seq(evalf(cos(2*i*Pi*tau/L)), i= 1..r)]):
Dtau2:= LA:-DiagonalMatrix([seq(evalf(sin(2*i*Pi*tau/L)), i= 1..r)]):
Dtau3:= -Dtau2:
Dtau4:= copy(Dtau1):

Dtau:= < < Dtau00 | Dtau01 | Dtau02 >,
         < Dtau10 | Dtau1  | Dtau2  >,
         < Dtau20 | Dtau3  | Dtau4  > >;
 
P00:= < L/2 >:
P01:= Vector[row](r):
P02:= Vector[row](r, j-> evalf(-L/j/Pi), datatype= float[8]):
P10:= Vector(r):
P20:= Vector(r, i-> evalf(L/2/i/Pi)):
P1:= Matrix(r,r):
P2:= LA:-DiagonalMatrix(P20):
P3:= LA:-DiagonalMatrix(-P20):
P4:= Matrix(r,r):

P:= < < P00 | P01 | P02 >,
      < P10 | P1  | P2  >,
      < P20 | P3  | P4  > >;

interface(rtablesize=2*r+1):    # optionally
J:=Vector([L, L/2 $ 2*r]):      # Matrix([[...]]) would also work here

E:=DiagonalMatrix(J);

X:=  Vector[row](2*r+1,symbol=a);
U:=Vector[row](2*r+1,symbol=b);

X0:= Vector[row](2*r+1,[1]);
G:=Vector[row](2*r+1,[1]);
C:=simplify(X-X0-G.Z-X.Dtau.P+X.Dtau.Z-U.P);

Z := Matrix(5, 5, {(1, 1) = 1., (1, 2) = 0., (1, 3) = 0., (1, 4) = 0., (1, 5) = 0., (2, 1) = 0., (2, 2) = 0., (2, 3) = 0., (2, 4) = 0., (2, 5) = 0., (3, 1) = 0., (3, 2) = 0., (3, 3) = 0., (3, 4) = 0., (3, 5) = 0., (4, 1) = 0., (4, 2) = 0., (4, 3) = 0., (4, 4) = 0., (4, 5) = 0., (5, 1) = 0., (5, 2) = 0., (5, 3) = 0., (5, 4) = 0., (5, 5) = 0.})

Dtau := Matrix(5, 5, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (2, 1) = 0, (2, 2) = 1., (2, 3) = 0, (2, 4) = 0., (2, 5) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1., (3, 4) = 0, (3, 5) = 0., (4, 1) = 0, (4, 2) = -0., (4, 3) = -0., (4, 4) = 1., (4, 5) = 0, (5, 1) = 0, (5, 2) = -0., (5, 3) = -0., (5, 4) = 0, (5, 5) = 1.})

P := Matrix(5, 5, {(1, 1) = 1/2, (1, 2) = 0, (1, 3) = 0, (1, 4) = -.318309886100000, (1, 5) = -.159154943000000, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = .1591549430, (2, 5) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (3, 5) = 0.7957747152e-1, (4, 1) = .1591549430, (4, 2) = -.159154943000000, (4, 3) = 0, (4, 4) = 0, (4, 5) = 0, (5, 1) = 0.7957747152e-1, (5, 2) = 0, (5, 3) = -0.795774715200000e-1, (5, 4) = 0, (5, 5) = 0})

E := Matrix(5, 5, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (2, 1) = 0, (2, 2) = 1/2, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1/2, (3, 4) = 0, (3, 5) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 1/2, (4, 5) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = 1/2})

X := Vector[row](5, {(1) = a[1], (2) = a[2], (3) = a[3], (4) = a[4], (5) = a[5]})

U := Vector[row](5, {(1) = b[1], (2) = b[2], (3) = b[3], (4) = b[4], (5) = b[5]})

X0 := Vector[row](5, {(1) = 1, (2) = 0, (3) = 0, (4) = 0, (5) = 0})

G := Vector[row](5, {(1) = 1, (2) = 0, (3) = 0, (4) = 0, (5) = 0})

C := Vector[row](5, {(1) = 1.500000000*a[1]-2.-.1591549430*a[4]-0.7957747152e-1*a[5]-.5000000000*b[1]-.1591549430*b[4]-0.7957747152e-1*b[5], (2) = a[2]+.1591549430*a[4]+.1591549430*b[4], (3) = a[3]+0.7957747152e-1*a[5]+0.7957747152e-1*b[5], (4) = a[4]+.3183098861*a[1]-.1591549430*a[2]+.3183098861*b[1]-.1591549430*b[2], (5) = a[5]+.1591549430*a[1]-0.7957747152e-1*a[3]+.1591549430*b[1]-0.7957747152e-1*b[3]})

(1)

J:=X.E.Transpose(X)+U.E.Transpose(U);

J := a[1]^2+(1/2)*(a[2]^2)+(1/2)*(a[3]^2)+(1/2)*(a[4]^2)+(1/2)*(a[5]^2)+b[1]^2+(1/2)*(b[2]^2)+(1/2)*(b[3]^2)+(1/2)*(b[4]^2)+(1/2)*(b[5]^2)

(2)

Minimize(J,{C=0});






Error, (in Optimization:-NLPSolve) invalid arguments

 

#XP:=-.015+X[1]+add(X[l+1]*f1(l)+X[r+l+1]*f2(l), l= 1..r):
#plot([XP,T1], t= 0..1);#,legend= "Solution Of x(t) with r=50"):

 

 

 

 

 

 

Download work1.mwswork1.mws

Please Wait...