mathematical optimization - Wrappers for solvers of general nonconvex/nonlinear constrained problems (NLP) for Matlab -
i have general nonconvex function general nonconvex inequality constraints. have feasible starting point, , i'd minimize energy under constraints. solver should never leave feasible domain (i.e. barrier method) , should never increase energy. far used fmincon failed on both accounts, , i'd easy way try other solvers such ipopt, knitro, , snopt. speaking of which, won't mind recommendation specific solver accomplish i'm looking (nonincreasing , stays in feasible area).
i'd try other solvers, i'm looking modeling problem once @ wrapper (e.g. yalmip , cvx convex optimization; ampl?), translate other solvers (or call functions , convert output required each solver - i.e. i'd work single interface). flexible possible in terms of code, i'd prefer supply callback functions (written in matlab) objective , constraints functions , gradient, return real values. of course, if there option use internal variables provide things auto-diff without compromising code flexibility, nice (i have complex code, , making friendly special variable type hassle). didn't try it, if it's flexible enough, won't mind using .nl file, though i'll need tips on pipeline interface matlab code (running app request solve problem - i.e. provides input , expects solution solver function fmincon).
btw, problem fmincon() @ point starts increase function , can end worse point (larger objective), compromise constraints if terminated prematurely (it doesn't seem converge).
i played of solvers , modeling packages, emphasis on matlab.
- first, seems definition of interior point method quite relaxed. solvers allow enter infeasible area (i.e. behaving penalty methods), while wiki describes barrier method quite log function wrapping constraints:
https://en.wikipedia.org/wiki/interior_point_method
therefore, when wanted strict problem (to stay withing feasible domain), defined own f_aggregate() wrapping constraints log, , used solvers bound variables range (or used unconstrained solver).
yalmip quite convenient. define nlp problem same way define convex problem using sdpvar, tracks operations, , assume creates model similar auto-diff packages. drawbacks:
- the code needs compatible sdpvar, effort needed, example, replacing bsxfun() calls or replacing assignments double matrix. on other hand, no need supply derivatives.
- it doesn't scale well. on tiny problem worked fine, on small problem ran hour, half of time spent on formulation (e.g. processing power operation seems costly). implies me unlike supplying model mosek, supplies slow callback (similar auto-diff) ipopt (but might wrong). couldn't see iterations ipopt did. related post: https://groups.google.com/forum/?fromgroups#!searchin/yalmip/zohar/yalmip/ejidajgi9ec/0kqi-kp4lwaj
optitoolbox more low level, allowing callbacks, , it's more looking for. seems interesting supported solver nlp ipopt. fair, other interesting solvers commercial. can write .gms file using scip can executed gams or exported gams ampl. unfortunately, specific problem wasn't written correctly, , both packages produced same wrong result on exported problem.
i played ampl bit (and gams looks similar). it's not intuitive, problem formulation rather low level (e.g. no norm function or other sweeteners), , seems pain convert matlab code or generate problem based on ampl (by myself). also, demo version limits problem 10 variables interesting solvers.
there couple of commercial solvers out there, such knitro , snopt, try out. both have trial period of 6 months, limited 300 variables. i'm not sure how can test solver on large scale problem limited 300 variables. update: knitro has full month trial may try.
tomlab looks interesting. it's commercial package similar optitoolbox can interface commercial solvers. i'm waiting them reply license, limited 21 days.
i think there online servers, 1 try commercial solvers. i'll need exporter (e.g.) gams or ampl formats.
all in all, matlab's fmincon doesn't seem bad. while interior point can handle large scale problems, seems @ least ipopt (which seems have bug when objective function returns inf reject solution). since nlp problems in general hard, think shouldn't expect magic solver mosek.
update: happen try knitro , snopt (full versions). knitro's matlab interface superb. it's fmincon, implementing sparse more robust version of same algorithms. snopt's fmincon interface clunky. had patch add jacobian sparsity, , returned jacobian transposed, , took me time grips on since crashed matlab every little mistake. in terms of performance on problem, knitro surprisingly failed once on 1 of tiny problems, , both solvers in general didn't better others (running hours without converging).
update2: tried erwin kalvelagen below add variable each inequality constraint, replace inequality constraint equality constraint (ineq = new var), , bound var. fmincon respected these bounds, wasn't magic solution , solver got stuck early; ipopt , knitro didn't respect eq bounds , entered infeasible area.
Comments
Post a Comment