forum.alglib.net http://forum.alglib.net/ |
|
equality condition not respected http://forum.alglib.net/viewtopic.php?f=2&t=4432 |
Page 1 of 2 |
Author: | morfeus80 [ Sun Feb 13, 2022 12:09 am ] |
Post subject: | equality condition not respected |
I am trying to solve an optimization problem with "minnlc". The problem has 3 variables with 2 equality nonlinear conditions and boundary conditions too. I get the solution with exit code = 2, that should be the correct exit flag, but with the given results, one of the equality conditions is not zero. Can you explain me why this is happening? |
Author: | Sergey.Bochkanov [ Mon Feb 14, 2022 7:41 pm ] |
Post subject: | Re: equality condition not respected |
1. How large is constraint violation? Small violations about 1.0E-6 in magnitude are possible and not an error. 2. What exactly solver was used? SLP, SQP, AUL? |
Author: | morfeus80 [ Tue Feb 15, 2022 5:52 pm ] |
Post subject: | Re: equality condition not respected |
The constraint violation is big, more than 1000. The solver is SLP. |
Author: | Sergey.Bochkanov [ Tue Feb 15, 2022 9:35 pm ] |
Post subject: | Re: equality condition not respected |
Would you like to activate logging with alglib::trace_file("SLP,SQP","trace.log") call and: 1. try running SLP 2. try running SQP solver (just want to take a look from the other angle) 3. send me trace.log by email or post it here (the log does not contain sensitive information about problem being solved) |
Author: | morfeus80 [ Wed Feb 16, 2022 10:18 pm ] | ||
Post subject: | Re: equality condition not respected | ||
Hi, I have followed your instruction and uploaded here the trace file for SLP. I am not an expert but in this file I don't see anything wrong, while from the following code: Code: minnlcresults(state, x0, report); cout << report.terminationtype << endl; cout << "condition: " << report.nlcidx << "\t" << report.nlcerr << endl; I get in the console: Quote: 2 condition: 0 21365.6 That mean my first nonlinear equality condition has been violated (by far).
|
Author: | Sergey.Bochkanov [ Thu Feb 17, 2022 1:25 pm ] |
Post subject: | Re: equality condition not respected |
Hi! I see sudden spike in constraint violation between iterations #28 and #29, and the optimizer does not recover from it. There are several possible reasons why it may happen, and some of these possibilities include flaws in optimization strategy used by SLP solver. However, I wonder why such huge constraint violation occured in the first place. How much variables do you have? Depending on variables count, would you like to define the following trace tags and run optimization again: * if <=1000, define "SLP.DETAILED,SLP.PROBING" * if more than 1000 variables, define "SLP.PROBING" The SLP.DETAILED tag activates reports of locations visited and search directions. It can produce quite a long log when we have more than 1000 variables, that's why I don't ask you to define it on high-dimensional problems. The SLP.PROBING inserts additional function evaluations that allow to visualize function behavior. |
Author: | morfeus80 [ Thu Feb 17, 2022 2:28 pm ] | ||
Post subject: | Re: equality condition not respected | ||
Hi, I only have 3 variables, so I could use the detailed probing. Here the output.
|
Author: | Sergey.Bochkanov [ Thu Feb 17, 2022 10:32 pm ] |
Post subject: | Re: equality condition not respected |
1. Can you tell me more about your constraints? They behave strangely - like at some points they are perfectly linear, and at other points nonlinearities creep in. Do you have things like min(), max(), abs() in your constraints? Or maybe if/then/else branches when computing constraint value? 2. From your log I conclude that you used ALGLIB for C++, right? (the C# uses slightly different formatting). I will prepare a modified version of SLP with better logging and one potential stability fix tomorrow and send you to e-mail that you used to register at the forum. |
Author: | morfeus80 [ Fri Feb 18, 2022 12:01 am ] |
Post subject: | Re: equality condition not respected |
Hi Sergey, thanks for your help! 1.My constraints are partially calculated in another class and honestly quite complex. There is an abs(), but the value inside should always be positive close the solution, it could become negative only if one iteration goes very far from the solution and the initial guess. 2.Yes, I am using Alglib for C++ |
Author: | Sergey.Bochkanov [ Fri Feb 18, 2022 2:46 pm ] |
Post subject: | Re: equality condition not respected |
sent! |
Page 1 of 2 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |