Problem of NUMERICAL constraints (Ndsolve) with Nminimize
- To: mathgroup at smc.vnet.net
- Subject: [mg100759] Problem of NUMERICAL constraints (Ndsolve) with Nminimize
- From: Anh Ngoc LAI <laianhngoc at yahoo.com>
- Date: Sat, 13 Jun 2009 06:02:42 -0400 (EDT)
Hello everybody,
I have to optimize an function with numerical constraints using Nminimize.
To construct the constraints, i have to solve a system of ODEs (type):
Sol=NDSolve[{{B'[
t] == -(t6 + t13) B[t] -(t7 + t15 + t14*t11) F[
t] +(1/2)*(B[t] B[t] + t11*F[t] F[t] + t12*GG[t] GG[t]) - t2,
F'[t] == -t8*F[t] - t3,
GG'[t] == -(t9 + t16) F[t] - (t10 + t17) GG[t] - t4,
A'[t] ==
t5 B[t] +((t5*t7/t6) - t14) F[
t] +(1/2)*(F[t] F[t] + GG[t] GG[t]) - t1}, {B[0] == F[0] ==
GG[0] == A[0] == 0}}, {B, F, GG, A}, {t, 0, 10}][[1]]
where t1,...,t17 are parameters to obtain.
and then i have to use A,B,F,GG and my data to construct this constraints.
So i use WITH (or Block) commend for it:
f[t1_?NumericQ, t2_?NumericQ, t3_?NumericQ, t4_?NumericQ,
t5_?NumericQ, t6_?NumericQ, t7_?NumericQ, t8_?NumericQ,
t9_?NumericQ, t10_?NumericQ, t11_?NumericQ, t12_?NumericQ,
t13_?NumericQ, t14_?NumericQ, t15_?NumericQ, t16_?NumericQ,
t17_?NumericQ] := With[{...}, C]
Here C are constraints to put on Nminimize optimization.
I don't know how to deal with this, if C is only one constraint i have no problem with, but
here C is a list. For Mathematica,
f1[t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17] is only one
element and not a List.
I think to another way to solve this problem which is to get A,B,F,GG by defining functions
directly with Ndsolve (then construct constraints with Data without using WITH) but i have
to evaluate a lot of time NDSOLVE on my procedure, and it take a much of time.
That will be great if someone could give an idea.
Thanks.