OpenOpt v0.35 is reliesed (free MATLAB/Octave optim toolbox)

View: New views
1 Messages — Rating Filter:   Alert me  

OpenOpt v0.35 is reliesed (free MATLAB/Octave optim toolbox)

by openopt@ukr.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,
so now OpenOpt 0.35, collection of some local non-smooth and some global solvers is available
Key features:
new functions: nonSmoothSolve() & ominsearch(), with same syntax as MATLAB fsolve & fminsearch;

now solver ralg() (non-smooth optimizer, fminsearch() analog, can handle ill-conditioned problems) can handle all types of linear & non-linear constraints, as long as their gradients/subgradients:

lb<=x<=ub, A*x<=b, Aeq*x=beq, c(x)<=0, h(x)=0; user-supplied dc/dx, dh/dx
(and ShorEllipsoid() too, however, usually (exception for some small-scale problems) ralg is much more better)
providing patterns to c, h, f (if no (sub)gradient is provided for c, h, f) also can greately speedup your code (this is valid for  nonSmoothSolve too).

prob.parallel.f=1 turnes on parallel calculation of objFun (sub)gradient via dfeval() (MDCE, jobmanagers, workers must be properly started). Octave users must provide func with similar to dfeval syntax in prob.parallel.fun, for example something like
function y=myDFeval(fun,x)
y = my_dfeval_engine(fun, x, 'jobmanager', 'jobmanager.cherkassy.ua', 'jobmanagerhost', '15.08.19.80', ...);
------------------------------------------------------------------------------------------------------------------------------
prob.parallel.fun = @myDFeval;

prob.parallel.c & prob.parallel.h will be (I hope) in future OpenOpt version.

+LOTS of minor changes;

graphics:
-new marker (right-pointing triangle), reporting that MaxTime, MaxCPUTime, MaxIter, MaxFunEvals or etc is exeeded;
(markers in Octave currently are absent)
-graphic output speed is increased.
(some problems in Octave graphics still remain, but it's because of temporary Octave incompabilities & problems with connecting to gnuplot)

examples: I recomend you starting with Examples/ooexample5.m, ooexample2.m, ooexample1.m, nonSmoothSolveEx.m. Try also using MATLAB fminsearch in objFun from examples ooexample2 & ooexample5 (even without any constraints, patterns and derivatives) - it can't solve but ralg can, it seems to be more powerfull than adsmax, fminsearchOS, fmins, even commercial nonsmooth solvers CONDOR & snopt (however, I can't say I tried enough number of problems). It is based on implementation of Naum Z. Shor r-alg with adaptive spase transformation. It has only 1 euristic (that speeds convergence up, but makes algorithm more unstable in particular, very seldom, cases) vs lots in SolvOpt (use web search) - so sometimes it is slower than SolvOpt but more stable - I know some examples where SolvOpt can't find optimum but OpenOpt ralg can, and noone wise versa (at least, for all UC problems - constraits are implemented in other ways). BTW SolvOpt can't work with Octave, has unconvinient interface, can't handle equality constraints & hasn't been upgraded since 2001.
If you know other free solver for MATLAB/Octave or Python, that can solve
fun(x) = @(x) sum(abs(x) .* 1.2 .^ (0:length(x)-1).'); % -> min
(x0=ones(N,1) (or better cos(1:N).'), N=60...75; x_opt = all-zeros)
please inform me, thank you in advance.
BTW for example now you can try
opts = optimset(@fminsearch);
opts.MaxIter = 1e4;
[x fv istop output] = fminsearch(fun, x0,opts);
[x2 fv2 istop2 output2] = ominsearch(fun, x0,opts);
as far as I remember fminsearch can't solve the one even for N=16; the same thing, of course, to fminunc, fmincon.
NB! ominsearch is just a wrapper for ralg with same syntax as MATLAB fminsearch (for compability), it can' handle any constraints, derivatives, patterns, graphic output.

Non-smooth & noisy problems often appear in different engeneer calculations, for example
fun(x) = x(1)+abs(x(2))+quad('exp(sqrt(x(3)))*abs(x5)', 0, 1),
where quad is obtained numerically with small calculation errors.
See also a comparison nonSmoothSolve vs MATLAB fsolve (in nonSmoothSolveEx.m.), that failes to solve non-smooth & noisy func cases even with very small noise; in Octave you should make small changes related to MATLAB/Octave fsolve other sintax. nonSmoothSolve is based on ralg (by default, can be changed) & tries to minimize sum(lambda(i)*abs(objfunval(i)), where lambda after some iterations are ajusting automatically, untill found x: all coords of objfun(x) are less than TolFun.

Note!! for solver ralg in some cases starting from infeasible x0 is better than from feasible. It's due to estimating first Lagrange multipliers lambda & mu, that initially (if user don't provide them in prob.lambda, prob.mu) are zeros, and problem can turn to be undounded (for example, fun(x)=c*x); or it can get very far from x0, yielding huge lagrange multipliers values, that will lead to unpresize answer (automatic updating of lagrange multipliers after some iterations is implemented, but I can't state it works very effective, at least for now). If you can implement a constraint both as eq or ineq, former is better for cputime (I don't need calculating gradient when c(x)<=0), but latter is sometimes better for preserving a problem to be unbounded (or close to unbounded) in several first iterations (as I mentioned above).
Since ralg is optimized for non-smooth problems, it of course will fail comparison to fminunc/fmincon when funcs are smooth. The same thing to nonSmoothSolve vs fsolve.

Global solvers (connected from others GPL sourses & some hand-turning to be able run in Octave): currently nothing special, "just works". global-local solver hPSO currently is very slow - it calls lots of ralg in each iter; anneal - global UC (need x0, maybe, lb-ub limits will be added in future), buscarnd - needs r0, can't handle lb-ub; GAConstrain - needs lb, ub, can handle Ax<=b, c(x)<=0 (but I can't state it is done very well).

License: GNU GPL2
(the only restriction that I want to underline: connecting to any packages with removing "randInfo" field from output struct is not allowed (at least, without OpenOpt developers permission), it will be treated as removing information about OpenOpt developers, which is not allowed in terms of GNU GPL2; the same thing to modifying of randInfo output content).
auto printing of randinfo field can be suppressed via setting prob.iterPrint<0

Download zip-archive (~200kB) is available in
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=13115&objectType=file
+ please download & replace ooIter.m from
http://www.box.net/public/6bsuq765t4
elseware a bug can appear (in ralg or ShorEllipsoid, when no (sub)gradient is provided for objFun)
(according to Matlabcentral rules I can't update files more than once per 2 monthes)

INSTALL: add to path recursively

I hope in future reliases MATLAB fmincon equivalent (at least with 1st derivatives, probably, 2nd will be added in future) & bintprog equivalent (even more powerfull (based on a GRASP modification of icyb workers Dr. Shilo & others)  than current MATLAB realization (based on branches) ) will be added.
Probably, future OpenOpt versions will be Python-based (there are some connecting tools from Python to MATLAB/Octave).
If you'll found OpenOpt usefull & want further OpenOpt development (or speedup that one; or Python version), please donate.

Leaving a good review at
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=13115&objectType=file
is also very apriciated, in future I could show that link to a someone who can donate further OpenOpt development.

WBR, Dmitrey
cybernetics instityte of Ukraine National Science Academy, optimization department