forum.alglib.net

ALGLIB forum
 It is currently Mon May 27, 2024 6:51 pm

 All times are UTC

Forum rules

1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.

 Page 1 of 2 [ 12 posts ] Go to page 1, 2  Next
 Print view Previous topic | Next topic
Author Message
 Post subject: equality condition not respectedPosted: Sun Feb 13, 2022 12:09 am

Joined: Sun Feb 06, 2022 6:24 pm
Posts: 13
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?

Top

 Post subject: Re: equality condition not respectedPosted: Mon Feb 14, 2022 7:41 pm

Joined: Fri May 07, 2010 7:06 am
Posts: 915
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?

Top

 Post subject: Re: equality condition not respectedPosted: Tue Feb 15, 2022 5:52 pm

Joined: Sun Feb 06, 2022 6:24 pm
Posts: 13
The constraint violation is big, more than 1000.
The solver is SLP.

Top

 Post subject: Re: equality condition not respectedPosted: Tue Feb 15, 2022 9:35 pm

Joined: Fri May 07, 2010 7:06 am
Posts: 915
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)

Top

 Post subject: Re: equality condition not respectedPosted: Wed Feb 16, 2022 10:18 pm

Joined: Sun Feb 06, 2022 6:24 pm
Posts: 13
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).

Top

 Post subject: Re: equality condition not respectedPosted: Thu Feb 17, 2022 1:25 pm

Joined: Fri May 07, 2010 7:06 am
Posts: 915
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.

Top

 Post subject: Re: equality condition not respectedPosted: Thu Feb 17, 2022 2:28 pm

Joined: Sun Feb 06, 2022 6:24 pm
Posts: 13
Hi, I only have 3 variables, so I could use the detailed probing. Here the output.

Top

 Post subject: Re: equality condition not respectedPosted: Thu Feb 17, 2022 10:32 pm

Joined: Fri May 07, 2010 7:06 am
Posts: 915
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.

Top

 Post subject: Re: equality condition not respectedPosted: Fri Feb 18, 2022 12:01 am

Joined: Sun Feb 06, 2022 6:24 pm
Posts: 13
Hi Sergey,

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++

Top

 Post subject: Re: equality condition not respectedPosted: Fri Feb 18, 2022 2:46 pm

Joined: Fri May 07, 2010 7:06 am
Posts: 915
sent!

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 2 [ 12 posts ] Go to page 1, 2  Next

 All times are UTC

Who is online

Users browsing this forum: No registered users and 4 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for: