Expand description
§Rust SDK for OMMX (Open Mathematics prograMming eXchange)
This crate provides native Rust types and operations for mathematical optimization problems. It offers type-safe, high-performance implementations with convenient macros for expression building.
See doc::tutorial for a guided walkthrough of the public API, and
doc::migration_guide / doc::release_note for version-specific notes.
Re-exports§
Modules§
- annotation_
keys - Flat annotation keys defined by OMMX.
- artifact
- OMMX Artifact storage and exchange.
- dataset
- Dataset for mathematical programming problems distributed as OMMX Artifact.
- doc
- Supplementary documentation bundled with the crate.
- error
- Crate-wide error type and diagnostics-emitting macros.
- experiment
- Experiment / Run session model.
- mps
- Parse MPS format
- parse
- qplib
- Parser for the QPLIB format
- random
- Random generation and
proptestsupport for OMMX domain types - v1
- Module created from
ommx.v1proto files - v2
- Module created from
ommx.v2proto files.
Macros§
- assign
- Creates an
crate::AcyclicAssignmentsfrom assignment expressions. - bail
- Emit a
tracing::error!event and short-circuit the current function with ananyhow::Errorbuilt from the same format string. - coeff
- Creates a
crate::Coefficientfrom a floating-point expression. - ensure
- Short-circuit if
condis false. Mirrorscrate::bail!syntactically. - error
- Emit a
tracing::error!event and build ananyhow::Errorinline (for use in.ok_or_else(|| ...)and similar). - linear
- Creates a
crate::LinearMonomialfrom a variable ID expression. - monomial
- Creates a
crate::MonomialDynfrom variable ID expressions. - quadratic
- Creates a
crate::QuadraticMonomialfrom variable ID expressions. - variable_
ids - Creates a
crate::VariableIDSetfrom variable ID expressions.
Structs§
- ATol
- Absolute tolerance
- Acyclic
Assignments - Represents a set of assignment rules (
VariableID->Function) that has been validated to be free of any circular dependencies. - Binary
IdPair - ID pair for QUBO problems
- Binary
Ids - Bound
- Bound of a decision variable
- Coefficient
- Coefficient of polynomial terms.
- Constraint
- A constraint parameterized by its lifecycle stage.
- Constraint
Collection - A collection of active and removed constraints of the same type.
- Constraint
Context - Constraint context outside the intrinsic mathematical constraint.
- Constraint
Context Store - ID-keyed storage for constraint labels and transformation provenance.
- ConstraintID
- ID for constraint
- ConstraintID
Parameters - Constraint
Stats - Statistics about constraints in an instance.
- Created
- The created stage, before evaluation.
- Created
Data - Data carried by a regular constraint in the Created stage.
- Created
Decision Variable Columns - Definition-stage sparse columns.
- Decision
Variable - Row data for a decision variable table.
- Decision
Variable Stats - Statistics about decision variables in an instance.
- Decision
Variable Table - Owner of decision-variable rows, modeling labels, and stage-specific columns.
- Decision
Variable Usage - Reverse-usage view tied to the lifetime of an
Instance. - Decision
Variable Usage Entry - Reverse-usage entry for one used decision variable.
- Degree
- Duplicated
SampleID Error - A sample ID already present in a collection or repeated in one append input.
- Evaluated
- The evaluated stage, after evaluation against a single state.
- Evaluated
Collection - A collection of evaluated constraints of a single type.
- Evaluated
Data - Data carried by a constraint in the Evaluated stage.
- Evaluated
Decision Variable - Single evaluation result with data integrity guarantees
- Evaluated
Decision Variable Columns - Empty column set for evaluated decision-variable tables.
- Evaluated
Named Function ommx.v1.EvaluatedNamedFunctionwith validated, typed fields.- Exact
Integer Slack Unavailable - Signal returned when exact integer-slack conversion is structurally valid but cannot construct an exact finite encoding.
- Formatted
Function - Result of context-aware function formatting.
- Function
Format Options - Options for formatting a
Functionwith an instance-provided modeling context. - Inconsistent
Dependent Value - Signal that a dependent-variable assertion conflicts with its evaluated value.
- Indicator
Constraint - An indicator constraint:
indicator_variable = 1 → f(x) <= 0(or= 0). - Indicator
ConstraintID - ID for indicator constraints, independent from regular
ConstraintID. - Indicator
Evaluated Data - Data carried by an indicator constraint in the Evaluated stage.
- Indicator
Sampled Data - Data carried by an indicator constraint in the Sampled stage.
- Instance
- Instance, represents a mathematical optimization problem.
- Instance
Builder - Builder for creating
Instancewith validation. - Instance
Class - A set of
Instancevalues represented as a finite union ofInstanceClassClausevalues. - Instance
Class Clause - One conjunctive clause in an
InstanceClass. - Instance
Class Clause Report - Membership result for one conjunctive clause.
- Instance
Class Membership Report - Side-effect-free
InstanceClassmembership report. - Instance
Parameters - Parameters for
Instancegeneration. - Instance
Stats - Statistics about an optimization problem instance.
- Integer
Slack Preparation - Preparation that introduces Integer slack variables into active regular inequalities.
- Invalid
Degree Error - Invalid
Penalty Weight - Signal returned when a fixed penalty weight is outside its numeric domain.
- Kind
Parameters - Linear
Parameters - Memory
Profile - Logical memory profile of a value.
- Missing
State Entries - Signal that an evaluation state omits values required by the evaluated object.
- Modeling
Label - Structured label that preserves the element’s original modeling context.
- Modeling
Label Store - ID-keyed Struct-of-Arrays storage for
ModelingLabel. - Monomial
Dyn - A sorted list of decision variable and parameter IDs
- Named
Function - A named function represents an arbitrary mathematical function with an associated modeling label.
- Named
FunctionID - ID for named function
- Named
FunctionID Parameters - Named
Function Table - Owner of named-function rows and their modeling labels.
- OneHot
Constraint - A one-hot constraint: exactly one variable in
variablesmust be 1, the rest must be 0. - OneHot
ConstraintID - ID for one-hot constraints, independent from regular
ConstraintID. - OneHot
Created Data - Data carried by a one-hot constraint in the Created stage.
- OneHot
Evaluated Data - Data carried by a one-hot constraint in the Evaluated stage.
- OneHot
Sampled Data - Data carried by a one-hot constraint in the Sampled stage.
- ParameterID
Collision - Signal that a decision-variable ID is already owned by a parameter in a
ParametricInstance. - Parameter
Table - Owner of parameter IDs and their modeling labels.
- Parametric
Instance - Optimization problem instance with parameters
- Parametric
Instance Builder - Builder for creating
ParametricInstancewith validation. - Polynomial
Base - Base struct for
Linearand other polynomials - Polynomial
Parameters - Preparation
Policy - Optional Preparation phases interpreted by
Instance::prepare. - Preparation
Target NotReached - Signal returned when configured Preparation phases are exhausted before the
target
InstanceClasscontains theInstance. - Quadratic
Parameters - Removed
Reason - Reason why a constraint was removed/relaxed.
- SampleID
- Sample
Set - Multiple sample solution results with deduplication
- Sample
SetBuilder - Builder for creating
SampleSetwith validation. - Sampled
- Sampled
Collection - A collection of sampled constraints of a single type.
- Sampled
Data - Data carried by a constraint in the Sampled stage.
- Sampled
Decision Variable - Multiple sample evaluation results with deduplication
- Sampled
Decision Variable Columns - Empty column set for sampled decision-variable tables.
- Sampled
Named Function - Multiple sample evaluation results with deduplication.
- Sampled
Stage - The sampled stage, after evaluation against multiple samples.
- Solution
- Single solution result with data integrity guarantees
- Solution
Builder - Builder for creating
Solutionwith validation. - Sos1
Constraint - A SOS1 (Special Ordered Set type 1) constraint: at most one variable can be non-zero.
- Sos1
ConstraintID - ID for SOS1 constraints, independent from regular
ConstraintID. - Sos1
Created Data - Data carried by a SOS1 constraint in the Created stage.
- Sos1
Evaluated Data - Data carried by a SOS1 constraint in the Evaluated stage.
- Sos1
Sampled Data - Data carried by a SOS1 constraint in the Sampled stage.
- Term
- Unknown
State Entries - Signal that an evaluation state contains variables outside the evaluated instance.
- Unverifiable
Dependent Assertion - Signal that a dependent-variable assertion cannot yet be verified.
- VariableID
- ID for decision variable and parameter.
- VariableID
Pair - Variable
Stats ByKind - Statistics about decision variables categorized by kind.
- Variable
Stats ByUsage - Statistics about decision variables categorized by usage.
Enums§
- Atol
Error - Error produced when constructing an
ATolor updating its default. - Bound
Error - Coefficient
Error - Content
Factor Error - Failures while finding a factor that makes polynomial coefficients integers.
- Decision
Variable Error - Decision
Variable Role - Role of a decision variable in an
Instance. - Degree
Bound - Cumulative polynomial-degree bound in an
InstanceClassClause. - Equality
- Constraint equality.
- Fixed
Penalty Preparation - Fixed-weight penalty preparation of active regular constraints.
- Function
- A real-valued function of decision variables used for objective and constraint functions.
- Infeasible
Detected - Error type for when the instance is proofed to be infeasible
- Instance
Class Mismatch - One reason an
Instancedoes not belong to anInstanceClassClause. - Instance
Space - Integer
Encoding Preparation - Preparation of currently used Integer decision variables.
- Kind
- Linear
Monomial - Linear function only contains monomial of degree 1 or constant
- LogEncoding
Unavailable - Reason that
Instance::log_encodecannot construct an exact binary representation for an otherwise valid Integer encoding request. - OneHot
Constraint Error - Validation failures for one-hot constraints.
- Propagate
Outcome - Outcome of
Propagate::propagate. - Provenance
- One step in a constraint’s transformation history.
- Quadratic
Monomial - Quadratic
Parse Error - Sample
SetError - Error occurred during SampleSet validation
- Sense
- Sense
Preparation - Preparation of the optimization sense.
- Solution
Error - Error occurred during Solution validation
- Sos1
Constraint Error - Validation failures for SOS1 constraints.
- Special
Constraint Kind - A special constraint family that can be explicitly lowered to regular constraints.
- Special
Constraint Preparation - Preparation of active special constraints.
- Substitution
Error - Error types that can occur during substitution operations.
Constants§
- CURRENT_
FORMAT_ VERSION - The
format_versionthis SDK produces and the maximum it can read.
Traits§
- Constraint
Type - A type family for constraints, mapping each lifecycle stage to a concrete type.
- Decision
Variable Table Stage - Maps a lifecycle stage to
DecisionVariableTablerows and sidecar columns. - Evaluate
- Evaluate with a State
- Evaluated
Constraint Behavior - Common behavior for an evaluated constraint (single state evaluation result).
- Flat
Annotations - Domain-level view of OMMX flat annotations.
- IDType
- Marker trait for ID types used throughout the crate.
- Message
- A Protocol Buffers message.
- Monomial
- Monomial, without coefficient
- Propagate
- Unit propagation trait for constraint types.
- Sampled
Constraint Behavior - Common behavior for a sampled constraint (multi-sample evaluation result).
- Stage
- Trait that defines the stage-specific data a constraint carries at each lifecycle phase.
- Substitute
- A trait for substituting decision variables with other functions in mathematical expressions.
Functions§
- arbitrary_
constraints - arbitrary_
decision_ variables - arbitrary_
named_ functions - arbitrary_
unique_ variable_ ids - is_
reserved_ annotation_ key - Return true when an annotation key is reserved for OMMX-defined metadata.
- substitute
- In-place version of
Substitute::substitute. - substitute_
acyclic - In-place version of
Substitute::substitute_acyclic. - substitute_
one - In-place version of
Substitute::substitute_one.
Type Aliases§
- Bounds
- Bound for each decision variable
- Coefficient
Arithmetic Result - Result of coefficient arithmetic.
- Decision
Variable Label - Modeling label for decision variables.
- Evaluated
Constraint - Type alias for an evaluated constraint.
- Evaluated
Decision Variable Table - Evaluated-stage decision-variable table used by
crate::Solution. - Evaluated
Indicator Constraint - Evaluated
OneHot Constraint - Evaluated
Sos1 Constraint - Linear
- Named
Function Label - Modeling label for named functions.
- Named
Function Label Store - Parameter
Label - Modeling label for parametric-instance parameters.
- Parameter
Label Store - Per-parameter modeling-label store.
- Polynomial
- Quadratic
- SampleID
Set - Sampled
Constraint - Type alias for a sampled constraint.
- Sampled
Decision Variable Table - Sampled-stage decision-variable table used by
crate::SampleSet. - Sampled
Indicator Constraint - Sampled
OneHot Constraint - Sampled
Sos1 Constraint - Special
Constraint Kinds - A set of
SpecialConstraintKindtransformation selectors. - VariableID
Set - Variable
Label Store