Movatterモバイル変換


[0]ホーム

URL:


ContentsMenuExpandLight modeDark modeAuto light/dark mode
Gurobi Optimizer Reference Manual
Light LogoDark Logo

Concepts

Features

Reference

Gurobi
Back to top

Nonlinear Operation Codes#

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

GRB_OPCODE_SQRT

C++

GRB_OPCODE_SQRT

Java

GRB.OPCODE_SQRT

.NET

GRB.OPCODE_SQRT

Python[1]

GRB.OPCODE_SQRT

[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

CONSTANT

0

n/a

value of constant

VARIABLE

1

n/a

index of variable (or variable object)

PLUS

2

n-ary

\(-1.0\)

MINUS

3

binary

\(-1.0\)

MULTIPLY

4

n-ary

\(-1.0\)

DIVIDE

5

binary

\(-1.0\)

UMINUS

6

unary

\(-1.0\)

SQUARE

7

unary

\(-1.0\)

SQRT

8

unary

\(-1.0\)

SIN

9

unary

\(-1.0\)

COS

10

unary

\(-1.0\)

TAN

11

unary

\(-1.0\)

POW

12

binary

\(-1.0\)

EXP

13

unary

\(-1.0\)

LOG

14

unary

\(-1.0\)

LOG2

15

unary

\(-1.0\)

LOG10

16

unary

\(-1.0\)

LOGISTIC

17

unary

\(-1.0\)

TANH

18

unary

\(-1.0\)

SIGNPOW

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


[8]
ページ先頭

©2009-2025 Movatter.jp