Design Variables changing very little after going infeasible

57 views
Skip to first unread message

Joshua Fontana

unread,
Oct 26, 2023, 3:24:35 PM10/26/23
to SNOPT
Hi everyone,

I've been noticing something with my SNOPT optimizations, and I'm not sure why this is happening.

My optimization problem has 82 design variables, and 8 nonlinear constraints. I provide all of the gradients. What I am seeing is that as soon as the optimizer enters the infeasible region, it takes one last large step, and then begins to take only very small design steps, but sometimes a large step every so often. It has a very hard time getting out of the infeasible region, and seems to me to be wasting so many expensive function evaluations, since it is testing virtually the same design over and over again.

Attached is a plot of my normalized design variable history, objective history, and constraint history. Every design point after the vertical red line is infeasible. You can see in the design variable history that, after the vertical red line, it only makes very small changes, except for a few large "spikes", and similarly in the objective and constraint histories, the objective and constraint values changes very little. In the constraint history plot, a value > 0 means the constraint is violated.

The SNOPT Log is attached as well.

In a previous run with a smaller set of design variables, I was able to obtain a much better design than the one that this optimization obtained before going infeasible. I have verified that the previous design is attainable with this new set of design variables, so it should at least be able to do just as well.

Does anyone know what could be going on here? Are there any settings in SNOPT that could help with this?

I checked the constraint gradients against finite differencing (outside of SNOPT) and they were quite good.

Thanks,
Josh




Normalized_Dvars_Hist.jpg
Constraint_Hist.jpg
snoptprob.out
Objective_Hist.jpg

Joshua Fontana

unread,
Oct 31, 2023, 2:41:31 PM10/31/23
to SNOPT
Hi Everyone,

Just to update you on this: I found my problem. My constraint gradients were correct when I tested them outside of SNOPT, but I was putting them in the wrong places in the Jacobian. After fixing this, the optimization ran well. As soon as it went infeasible, it was able to get back to the feasible region on the next step.

Thanks,
Josh

Ömer Toktaş

unread,
Oct 31, 2023, 4:35:42 PM10/31/23
to SNOPT
Hello Josh!

I have one question about how did you plot your design variables through each iteration ? Can you share you e-mail address so that I can ask you a question? I am really stuck on this. Thank you for your help! 

Regards,
Omer

Joshua Fontana

unread,
Oct 31, 2023, 4:39:47 PM10/31/23
to SNOPT
Hi Omer,

I got the intermediate iterations of design variables by putting code in my "usrfun" to print the design variable values (and constraints, and gradients) to a file every time it executes. I don't know of a way to do this directly from SNOPT, but I guess this works well enough.

Thanks,
Josh

Ömer Toktaş

unread,
Oct 31, 2023, 5:50:48 PM10/31/23
to SNOPT
Josh,

Thank you for answering!

Very logical way! However, What if it calculates usrfun (design variable values (and constraints, and gradients)) more than one time if it is not converge on the first gradient calculation per iteration, in that case you have more than one design variable values (and constraints, and gradients) per iteration right?

Regards,
Omer

Joshua Fontana

unread,
Oct 31, 2023, 9:05:09 PM10/31/23
to SNOPT
Hi Omer,

Yes. You'll have one entry per function evaluation (which is why I labeled my x-axis "Number of Function Evaluations").

The "nCon" number in the major iterations log tells you how many function evaluations SNOPT has performed, so that should help you find which numbers from your output go with that major iteration. I think if you don't have any constraints, "nCon" is written "nObj" instead.

Best,
Josh

Ömer Toktaş

unread,
Oct 31, 2023, 9:33:50 PM10/31/23
to SNOPT
Josh,

Thank you such a good explanation!

Regards,
Omer

Reply all
Reply to author
Forward
0 new messages