next up previous contents
Next: Specific parameters for the Up: Optimization Previous: Introduction   Contents


Examples

Let consider the following example:

 
Minimize([cos(x)+y*cos(y)^2-0.2,x^2+y^2],[x,y],[[-Pi,Pi],[-Pi,Pi]],Min);
will return the value of $x,y$ in the range $[-\pi,\pi]$ which minimize the value of $x^2+y^2$ under the constraint $\cos(x)+y*\cos(y)^2-0.2=0$ and Min will contain the minimal value. In the previous example we will get the following result:
 
>Minimize([cos(x)+y*cos(y)^2-0.2,x^2+y^2],[x,y],[[-Pi,Pi],[-Pi,Pi]],Min);
[[[-.957582, -.957582], [-.474626, -.474626]],

    [[-.957582, -.957582], [-.474626, -.474626]]]
>Min;
                              [[1.14223, 1.14223]]
You may notice that Min is a range and that Minimize returns two solutions for x,y. This is so because Minimize may deal with function having interval coefficients: hence the procedure will return a range for the minimal value of the function and the values of x,y at which the lower and upper bound have been obtained. Hence we may change the previous example with:
 
Minimize([cos(x)+y*cos(y)^2-0.2,(x+INTERVAL(0..0.01))^2+y^2],[x,y],[[-Pi,Pi],[-Pi,Pi]],Min);
[[[-.958271, -.958271], [-.473241, -.473241]],

    [[-.957582, -.957582], [-.474626, -.474626]]]

> Min;
                              [[1.12307, 1.14233]]
Note that for this example we may have generated a simplification procedure with:
 
HullIConsistency([x^2+y^2-(Optimum-`ALIAS/eepsilon`)<=0],[x,y],0,"Simp");
Minimize([cos(x)+y*cos(y)^2-0.2,x^2+y^2],[x,y],[[-Pi,Pi],[-Pi,Pi]],Min,"Simp");
which allows to decrease almost by half the computation time.



Jean-Pierre Merlet 2012-12-20