       Re: Problem of NUMERICAL constraints (Ndsolve) with Nminimize

• To: mathgroup at smc.vnet.net
• Subject: [mg100856] Re: Problem of NUMERICAL constraints (Ndsolve) with Nminimize
• From: dh <dh at metrohm.com>
• Date: Tue, 16 Jun 2009 21:52:15 -0400 (EDT)
• References: <h0vtgs\$71d\$1@smc.vnet.net>

```
Hi Anh,

if I understand correctly, you want minimize a function using NMinimize

and several constrains.

Here is an example:

======================

fun=x^2 - (y - 1)^2

cons={x^2 + y^2 <= 4, x > 1}

NMinimize[Prepend[cons, fun], {x, y}]

=======================

Daniel

Anh Ngoc LAI wrote:

> 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 == F ==

>       GG == A == 0}}, {B, F, GG, A}, {t, 0, 10}][]

>

> 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.

>

>

```

• Prev by Date: Re: Extracting contour values from ContourPlot
• Next by Date: Re: mergeSort with ReplaceRepeated
• Previous by thread: Problem of NUMERICAL constraints (Ndsolve) with Nminimize
• Next by thread: Re: Problem of NUMERICAL constraints (Ndsolve) with Nminimize