Nonlinear constraints and squaring

26 views
Skip to first unread message

TD

unread,
Nov 24, 2023, 11:15:08 AM11/24/23
to Artelys Knitro forum
Hi there

I want to inquire about the bounds on nonlinear constraints.

Let's say I have the following (two-sided) nonlinear constraint:
glb <= g(x) <= gub ....... (1)
Assume my bounds are symmetric in the sense that
gb := -glb = gub.
In that case, I can also write the (one-sided) nonlinear constraint:
[g(x)]^2 <= gb^2 ....... (2)

Would there be any implications to using (2) instead of (1)? As a rule of thumb, what would Knitro prefer? I once heard a saying that "if you don't need to square, don't do it".

Also, on the same topic, when I have two-sided constraints,
glb <= g(x) <= gub,
instead of two one-sided constraints
g(x) <= gub
-g(x) <= -glb,
does Knitro do something different internally?

Thank you!


 

Richard Waltz

unread,
Nov 24, 2023, 11:17:50 AM11/24/23
to kni...@googlegroups.com
Hi,

You definitely should NOT square the constraint.  This formulation will generally be more difficult.

You should formulate it as either a two-sided constraint:
glb <= g(x) <= gub,
or two one-sided constraints:
g(x) <= gub
-g(x) <= -glb.

It shouldn't really matter which of the above you choose - they should be handled the same internally.

Regards,
-Richard Waltz



From: kni...@googlegroups.com <kni...@googlegroups.com> on behalf of TD <tinusd...@gmail.com>
Sent: Thursday, November 23, 2023 2:43 PM
To: Artelys Knitro forum <kni...@googlegroups.com>
Subject: [Knitro] Nonlinear constraints and squaring
 
--
You received this message because you are subscribed to the Artelys "Knitro Nonlinear Optimization Solver" google group.
To post to this group, send email to kni...@googlegroups.com
To unsubscribe from this group, send email to knitro-un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/knitro?hl=en
Thank You,
Artelys
http://www.artelys.com/en/optimization-tools/knitro
---
You received this message because you are subscribed to the Google Groups "Artelys Knitro forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knitro+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/knitro/499ceb68-53f9-49cd-bcbc-e3e1098af024n%40googlegroups.com.

TD

unread,
Nov 24, 2023, 1:04:31 PM11/24/23
to Artelys Knitro forum
Thanks for the answer! Noted.

Then I have a question on what do with the following. 

I have the following 2-norm of a two-dimensional vector function:
g(x) = sqrt([a(x)]^2 + [b(x)]^2).
Since the norm is by definition positive, I only need an upper bound.
g(x) <= gub.

However, I assume the sqrt() comes with its own difficulties? In this case, would it be beter to use
[g(x)]^2 = [a(x)]^2 + [b(x)]^2  <= gub^2?

I know it's difficult to give general advice that applies anywhere, but it is good to know what is (usually) bad formulations.

Kind regards

Richard Waltz

unread,
Nov 24, 2023, 1:07:28 PM11/24/23
to kni...@googlegroups.com
Generally, squaring the constraint so that it has the form:

  [g(x)]^2 = [a(x)]^2 + [b(x)]^2  <= gub^2

would be best, since it makes it smooth.  It might be worth trying both forms, however.

Regards,
-Richard

Sent: Friday, November 24, 2023 9:41 AM

To: Artelys Knitro forum <kni...@googlegroups.com>
Subject: Re: [Knitro] Nonlinear constraints and squaring
 
Reply all
Reply to author
Forward
0 new messages