cobyla



   Date: Sat, 27 Jul 2013 15:03:38 +0200
   From: "jfr.maurel at gmail.com" <jfr.maurel at gmail.com>

   Hi,

   I cannot find a solution with cobyla of the following problem. I can 
   solve it with python libraries.
   I played with rhobeg, rhoend and maxfun without luck.

   windows 7
   wxMaxima 13.04.2
   wxWidgets: 2.8.12
   Support unicode: no
   Version de Maxima:5.30.0
   Lisp: GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL)

   Could you please tell me what I am doing wrong ?

   reset()$
   kill(all)$
   ratprint:false$
   load(fmin_cobyla)$
   ini:[1e-3,-1e-3,1.0e-3]$
   var:[u,v,%gamma]$
   cost_value:-(v+140*%gamma)/sqrt(2)-u/sqrt(2)$
   constraints_value:[v^2+u^2<=0.0025,(v+100*%gamma)^2+u^2<=0.01]$
   display(cost_value,constraints_value,var,ini)$
   sol:fmin_cobyla(cost_value,var,ini,constraints = constraints_value, 
   iprint = 1)$
   u_opt:rhs(sol[1][1])$
   v_opt:rhs(sol[1][2])$
   %gamma_opt:rhs(sol[1][3])$
   display(u_opt,v_opt,%gamma_opt)$
   /* constraints checking python sol = (0.036999999999999998, 
   -0.034000000000000002, 0.001) */
   subst([u=u_opt,v=v_opt,%gamma=%gamma_opt],constraints_value);

I can't see what is wrong, but I do note that if I rescale your variables and cost function,
I do get a reasonable answer:

(%i1) (cost_value:-14*?-u-v, vars:[u,v,?], ini:[0,0,0], constraint_values:[v^2+u^2-1/4 <= 0,(v+10*?)^2+u^2-1 <= 0])$

(%i2) fmin_cobyla(cost_value,vars,ini,constraints=constraint_values);

(%o2) [[u = .3705397448810745,v = -.3357086496732666,? = .1264525260993555],
       -1.805166460598785,111,0]
(%i3) subst(first(%),constraint_values);

(%o3) [1.979819086450618e-12 <= 0,1.034838881253108e-12 <= 0]

This solution is quite close to the one I obtain when solving the problem explicity.

Leo