API reference#
Models#
- class jumpy.Model(backend: str = 'juliac')#
A JuMPy optimization model.
- Example:
m = jp.Model() x = m.variables(100, lower=0)
i = m.iterator(range(99)) m.constraint_group(x[i] + x[i + 1] <= 10)
m.objective = jp.minimize(x[0] + x[1]) m.optimize()
- constraint(con: Constraint) None#
Add a single constraint (MOI.add_constraint).
- constraint_group(con: Constraint) None#
Add a constraint group: one constraint per combination of the values of the iterators appearing in the template.
- Example:
i = m.iterator(range(99)) m.constraint_group(x[i] + x[i + 1] <= 10)
- iterator(values) Node#
An index set for constraint groups (a GenOpt iterator).
Used in expressions, it is a symbolic placeholder that GenOpt expands over its values when the group constraint is added.
- parameter(values, name: str | None = None) Parameter#
A vector of constant data, symbolically indexable in templates.
Expressions#
- class jumpy.Variable(ops, index: int, name: str | None = None)#
A single decision variable; keeps its column for solution lookup.
- class jumpy.VariableVector(ops, start: int, count: int, name: str | None = None)#
A block of decision variables returned by Model.variables().
Concrete indexing (x[0]) returns a Variable; symbolic indexing (x[i] with an expression) builds a getindex template node over the contiguous block.
- class jumpy.Parameter(ops, values, name: str | None = None)#
A vector of constant data returned by Model.parameter().
Concrete indexing (costs[0]) returns a float; symbolic indexing (costs[i]) builds a getindex template node over the data vector.
Nonlinear functions#
- jumpy.sin(x)#
- jumpy.cos(x)#
- jumpy.exp(x)#
- jumpy.log(x)#
- jumpy.sqrt(x)#
- jumpy.jp_abs(x)#