forum.alglib.nethttp://forum.alglib.net/ Nonlinear Constraint Optimization Confusionhttp://forum.alglib.net/viewtopic.php?f=2&t=4607 Page 1 of 1

 Author: whackamadoodle3000 [ Mon Jun 03, 2024 6:51 pm ] Post subject: Nonlinear Constraint Optimization Confusion Hello,I am trying to do optimization with nonlinear constraints where an algebraic representation of the function is unknown (every time it calls the function, it triggers a physical process with the given input and measurement of this process). I am trying to use the following two functions in C++, as I don't think I can get a Jacobian in this case: void minnlcsetnlc(minnlcstate &state, const ae_int_t nlec, const ae_int_t nlic, const xparams _xparams = alglib::xdefault);and void minnlcoptimize(minnlcstate &state, void (*fvec)(const real_1d_array &x, real_1d_array &fi, void *ptr), void (*rep)(const real_1d_array &x, double func, void *ptr) = NULL, void *ptr = NULL, const xparams _xparams = alglib::xdefault);However, I do not see where I can put in my nonlinear constraints in minnlcsetnlc, or anywhere in minnlcoptimize for a callback for the nonlinear constraints. How do I specify the nonlinear constraints?Thanks for your help

 Author: Sergey.Bochkanov [ Tue Jun 04, 2024 12:29 pm ] Post subject: Re: Nonlinear Constraint Optimization Confusion Hi!The minnlcsetnlc/minnlcsetnlc2 pair of functions does not accept constraints themselves, merely their count and bounds/types. You should pass constraint callbacks as a part of the problem Jacobian or function vector. The first vector component / Jacobian row is an objective, the rest are constraints.If your problem has no derivatives available, you can use numerical differentiation optimizer mode, minnlccreatef(). However, you problem is likely to be expensive to evaluate, given what you said about performing some real-world measurements every time you want to evaluate the function. ALGLIB will still work, but probably it may take too much time because every gradient evaluation means 4N physical measurements to perform.There are other approaches, like building an RBF model of the function every time you perform a measurement, and optimize that model to determine where to evaluate the target. It allows to save a lot of time. However, presently ALGLIB does not support it.

 Author: whackamadoodle3000 [ Fri Jun 28, 2024 8:51 pm ] Post subject: Re: Nonlinear Constraint Optimization Confusion Hi Sergey,Thank you for the detailed answer! I have gotten it to work, but you are right that 4N is very expensive. Is there any way alglib could do a gradient evaluation with 2N physical measurements like fmincon does in matlab? My company already has a commercial alglib license and would likely be willing to pay for this feature, or one that would use another method like building a model like you said. If alglib cannot offer this, do you know of any other package that could in C++? I was also wondering if there is a setting to increase how much alglib changes it estimates each time -- currently the behavior I am seeing is one large change at the start and then mostly small changes (there is currently not much "exploration" of the solution space compared to fmincon on the same problem). Thanks again for your help!

 Author: Sergey.Bochkanov [ Mon Jul 01, 2024 11:10 am ] Post subject: Re: Nonlinear Constraint Optimization Confusion Hi!I've replied directly to your email (one that was used for registration), because some questions may require you to reveal private data about your problem. Feel free to repost answers here, if you want!

 Page 1 of 1 All times are UTC Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Grouphttp://www.phpbb.com/