forum.alglib.net
http://forum.alglib.net/

Nonlinear Constraint Optimization Confusion
http://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.

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