Global Optimization Questions and Posts

These are Posts and Questions associated with the product, Global Optimization

Does global optimization toolbox has randomization option it gives same value every time

Does Maplesoft provide success percentage of this toolbox on benchmark functions?. I cannot see much options in the global solve command (from maple help page) other than population size etc. 

I would like to know whether a local optimizer is combined with the present global optimization toolbox?. I read that toolbox has differential evolution and surrogate optimization techniques etc. These methods guarantee near-optimal solutions and it is often recommended to use a local optimization technique in conjunction with global optimization techniques. 

Dear Friends,

My present problem is to calculate the coefficients  

of ODES based on the experiment data. In order to simulate the actual experiment, a set of  is given with . Then the experiment data (yexp) can be calculated. Finally, the least-squares method (lsq) is used to calculate the coefficient values. Now the NLPSolve function can be used. However, the globalsolve cant run.

 

If it is convenient for you, wish you can solve it.

 

Code:

 

restart;
cdm_ode := diff(y1(t), t) = c0*(y6(t)*(1-y3(t))/(s0*(1-y4(t)*(1-y5(t)))))^n/(1-y2(t)), diff(y2(t), t) = ks*y2(t)^(1/3)*(1-y2(t)), diff(y3(t), t) = h1*(1-y3(t)/h2)*c0*(y6(t)*(1-y3(t))/(s0*(1-y4(t)*(1-y5(t)))))^n/(sigma*(1-y2(t))), diff(y4(t), t) = (1/3)*kp*(1-y4(t))^4, diff(y5(t), t) = A*B*y1(t)^(B-1)*c0*(y6(t)*(1-y3(t))/(s0*(1-y4(t)*(1-y5(t)))))^n/(1-y2(t)), diff(y6(t), t) = y6(t)*c0*(y6(t)*(1-y3(t))/(s0*(1-y4(t)*(1-y5(t)))))^n/(1-y2(t));

 

tol_t := 3600;
sol := dsolve([cdm_ode, y1(0) = 0, y2(0) = 0, y3(0) = 0, y4(0) = 0, y5(0) = 0, y6(0) = 175], numeric, range = 0 .. tol_t, output = listprocedure, parameters = [c0, n, sigma, s0, ks, h1, h2, kp, A, B]);

sol(parameters = [5.7*10^(-6), 10.186, 175, 200, 5*10^(-8), 10000, .269, 1.5*10^(-7), 1.5, 2]);

t := [seq(i^2, i = 0 .. 50, 1)];

y1data := subs(sol, y1(t));
 
y1exp := [seq(y1data(t[i]), i = 1 .. 51)];

err := proc (c0, n, s0, ks, h1, h2, kp, A, B) local y1cal, y1val, lsq; sol(parameters = [c0, n, 175, s0, ks, h1, h2, kp, A, B]); y1cal := subs(sol, y1(t)); y1val := [seq(y1cal(t[i]), i = 1 .. 51)]; lsq := add((y1val[i]-y1exp[i])^2, i = 1 .. 51); lsq end proc;

with(Optimization);
val := NLPSolve(err, 10^(-8) .. 10^(-4), 2 .. 20, 150 .. 250, 10^(-2) .. 1, 100 .. 20000, 10^(-5) .. .4, 10^(-5) .. 1, .5 .. 2, 1 .. 10);
GlobalSolve(err, 10^(-10) .. 10^(-4), 2 .. 20, 150 .. 250, 0 .. 1, 100 .. 15000, 0 .. .5, 0 .. 1, .5 .. 2, 1 .. 5);


Error, (in GlobalOptimization:-GlobalSolve) `InertForms` does not evaluate to a module

 

 

 

 

 

Data.xlsx

XY.mw

XYZ.mw

 

Hello,

I'm using the Global Optimization Toolbox to solve some examples and fit equations to a given data, finding "unknown" parameters. I generated the data on Excel, and I already know the values of these parameters.

The XY case is (there is no problem here, I just put as a example I follow):

> with(GlobalOptimization);
> with(plots);

> X := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "I5:I25");
> Y := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "J5:J25");

> XY := zip( (X, Y) -> [X, Y] , X, Y);
> fig1 := plot(XY, style = point, view = [.9 .. 3.1, 6 .. 40]);


> Model := A+B*x+C*x^2+D*cos(x)+E*exp(x):
> VarInterv := [A = 0 .. 10, B = 0 .. 10, C = -10 .. 10, D = 0 .. 10, E = 0 .. 10];

> ModelSubs := proc (x, val)

    subs({x = val}, Model)

    end proc;


> SqEr := expand(add((ModelSubs(x, X(i))-Y(i))^2, i = 1 .. 21));
> CoefList := GlobalSolve(SqEr, op(VarInterv), timelimit = 5000);

> Model := subs(CoefList[2], Model):

 

I could find the right values of A, B, C, D and E. 

 

My problem is in the XYZ case, where I don't know how to "write" the right instruction. My last attempt was:

> with(GlobalOptimization);
> with(plots);

> X := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "Q5:Q25"); X2 := convert(X, list);
> Y := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "R5:R25"); Y2 := convert(Y, list);
> Z := ExcelTools:-Import("F:\\Data.xlsx", "Plan1", "S5:S25"); Z2 := convert(Z, list);
> NElem := numelems(X);

> pointplot3d(X2, Y2, Z2, axes = normal, labels = ["X", "Y", "Z"], symbol = box, color = red);

 

> Model := A*x+B*y+C*sin(x*y)+D*exp(x/y);

> VarInterv := [A = 0 .. 10, B = 0 .. 10, C = 0 .. 10, D = 0 .. 10];

> ModelSubs:=proc({x,y},val)

subs({(x,y)=val},Model)

end proc:
Error, missing default value for option(s)

> SqEr := expand(add((ModelSubs(x, y, X(i), Y(i))-Z(i))^2, i = 1 .. NElem));
> CoefList := GlobalSolve(SqEr, op(Range), timelimit = 5000);
Error, (in GlobalOptimization:-GlobalSolve) finite bounds must be provided for all variables

 

My actual problem involves six equations, six parameters and four or five independent variables on each equation, but I alread developed a way to solve two or more equations simultaneously.

Thanks

Hi,

   The error showed up whenever I tried to do the Maximum Likelihood Estimation with Global Optimization Toolbox.My objective (likelihood ) function f is defined as follows(A1 to A5 are intermediate variables; parameters  are x[1] to x[12]):

   f := 0;

   for j from 1 by 1 to 21 do

       A1 := exp(x[1]+x[2]*c[j]);

       A2 := exp(x[3]+x[4]*c[j]);

Page 1 of 1