Contype in API

28 views
Skip to first unread message

TD

unread,
Jul 4, 2023, 3:01:46 AM7/4/23
to Artelys Knitro forum
Hi there

In the oldAPI (10.x and earlier), it is clearly shown how the array cType can be used to describe the type of constraints of the constraint function. This used to be done in KTR_init_problem().

Is this still possible in the latest API? (And if so, how would this now be done?)

Kind regards
TD

Richard Waltz

unread,
Jul 4, 2023, 3:09:05 AM7/4/23
to kni...@googlegroups.com
Hi,

In the current API, the cType array is no longer used -- rather, the constraint type is automatically determined based on the API functions used to specify the constraint.  For example, linear constraints should be loaded using the API function "KN_add_con_linear_struct()"


Quadratic constraints should be loaded using the function above to load the linear terms and "KN_add_con_quadratic_struct()" for the quadratic terms:


General, nonlinear (beyond quadratic) constraints/structures should be handled through a callback function in the same way as the 10.x and earlier old API.  Anything specified through a callback is automatically treated as general nonlinear so it is always best to use the specified API functions for loading linear and quadratic structures in your model so that Knitro can be aware of, and exploit these special structures whenever possible.

Kind regards,
-Richard


From: kni...@googlegroups.com <kni...@googlegroups.com> on behalf of TD <tinusd...@gmail.com>
Sent: Monday, July 3, 2023 7:47 AM
To: Artelys Knitro forum <kni...@googlegroups.com>
Subject: [Knitro] Contype in API
 
--
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/0c5f862c-bbe6-4dc5-a593-640dcfbe26e2n%40googlegroups.com.

TD

unread,
Jul 4, 2023, 3:27:00 AM7/4/23
to Artelys Knitro forum
Thanks, Richard!
Reply all
Reply to author
Forward
0 new messages