Concepts
Features
Reference
Nonlinear expressions are built as a tree of operations, each with anassociated operation code (opcode). Each opcode has both a name andan integer value. Our programming language APIs provide predefinedconstants for all of these, which we recommend you use. Theseconstants are accessed by prepending a fixed prefix (which variesslightly by language) to the opcode name. To access theSQRToperation code (to define the square root function) from our variousAPIs, for example, you would use the following:
Language | Operation Code |
|---|---|
C |
|
C++ |
|
Java |
|
.NET |
|
Python[1] |
|
Note that in Python, we recommend you use arithmetic operators andour nonlinear function helpers to build nonlinear constraints (seeNLExpr for details). Using these operation codesdirectly is considered advanced usage.
The following table lists the available operation codes:
Opcode name | Value | Arity | Data |
|---|---|---|---|
| 0 | n/a | value of constant |
| 1 | n/a | index of variable (or variable object) |
| 2 | n-ary | \(-1.0\) |
| 3 | binary | \(-1.0\) |
| 4 | n-ary | \(-1.0\) |
| 5 | binary | \(-1.0\) |
| 6 | unary | \(-1.0\) |
| 7 | unary | \(-1.0\) |
| 8 | unary | \(-1.0\) |
| 9 | unary | \(-1.0\) |
| 10 | unary | \(-1.0\) |
| 11 | unary | \(-1.0\) |
| 12 | binary | \(-1.0\) |
| 13 | unary | \(-1.0\) |
| 14 | unary | \(-1.0\) |
| 15 | unary | \(-1.0\) |
| 16 | unary | \(-1.0\) |
| 17 | unary | \(-1.0\) |
| 18 | unary | \(-1.0\) |
| 19 | binary | \(-1.0\) |
These operation codes will also appear inMPS andLP files (using the names from the table above).
See our sectionOperation Codes for a detaileddescription of each operation code.
Help and Feedback