Skip to main content

Crate oximo_macros

Crate oximo_macros 

Source
Expand description

§oximo-macros

Internal procedural macros backing oximo’s modeling surface: variable!, constraint!, objective!, sum!, set!, and param!.

This crate is an implementation detail, do not depend on it directly. The macros are re-exported through oximo-core and oximo::prelude, which is the supported entry point:

use oximo::prelude::*;

The macros expand to the typed builder API in oximo-core (Model, Set, Expr, sum_over, …). See the oximo crate docs for the macro grammar and examples.

Macros§

constraint
constraint!(model, [name|name[idx]], lhs <op> rhs), register a constraint, an auto-named anonymous constraint, or an indexed family of constraints.
objective
objective!(model, Min|Max, expr), set the model objective and sense.
param
param!(model, name = value), declare a re-bindable scalar parameter and bind it to a local of the same name.
set
set!(name = domain), bind a local to an index Set. A plain right side (0..5, a * b) is normalized to an owned set (a top-level * is a borrowing Cartesian product). A pat in domain[ if cond] comprehension builds (and optionally filters) the set. See the crate docs.
sum
sum!(body for pat in domain[, pat in domain ...]), algebraic summation, lowered to nested sum_over folds.
variable
variable!(model, spec), declare a decision variable (or an indexed family) and bind it to a local of the same name. See the crate docs for the grammar.