Jij-Inc
ommx
BlogDocsChangelog

Performance History

Latest Results

Start developing OMMX Python SDK 2.3.1 (#682) Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action Co-authored-by: termoshtt <1238153+termoshtt@users.noreply.github.com>
main
2 days ago
Add constraint violation calculation methods (#680) ## Summary Adds methods to calculate constraint violations for individual constraints and aggregate violations across all constraints in a solution. ## Changes ### Rust SDK **`EvaluatedConstraint::violation()` method** (`rust/ommx/src/constraint.rs`): - Calculates individual constraint violation: - For `f(x) = 0`: returns `|f(x)|` - For `f(x) ≤ 0`: returns `max(0, f(x))` - Returns `0.0` if the constraint is satisfied **`Solution` methods** (`rust/ommx/src/solution.rs`): - `total_violation_l1()`: L1 norm (sum of absolute violations) - `total_violation_l2()`: L2 norm squared (sum of squared violations) - Both methods include all constraints (including removed constraints) ### Python SDK **PyO3 bindings**: - Exposed `violation()` method for `EvaluatedConstraint` - Exposed `total_violation_l1()` and `total_violation_l2()` methods for `Solution` **Python wrapper methods** (`python/ommx/ommx/v1/__init__.py`): - Added wrapper methods with proper type hints and documentation - Regenerated stub files for type checking ### Tests Added comprehensive test suite (`python/ommx-tests/tests/test_violation.py`): - Individual constraint violation tests (equality and inequality) - Total violation L1 and L2 tests - Tests with mixed satisfied/violated constraints - Tests with empty constraint sets All tests passing (115 passed, 1 warning). ## Test plan - [x] Rust SDK unit tests pass (326 tests) - [x] Python SDK tests pass (115 tests) - [x] Type checking passes (pyright) - [x] Linting passes (ruff) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
main
2 days ago
Add pyodide (wasm32-unknown-emscripten) support (#679) This PR adds support for building and running OMMX in pyodide (WebAssembly) by making network-related features optional while preserving local OCI artifact operations. ## Changes ### 1. Infrastructure - Add `task rust:check:wasm32-emscripten` for local testing - Add GitHub Actions CI jobs for wasm32-emscripten target testing (Rust and Python) - Consolidate WASM environment setup in shared action - Integrate pyodide build into release workflow ### 2. Dependency Updates - Update to ocipkg 0.4.0 with conditional remote features - Update to oci-spec 0.7.1: - `Digest::new()` → `digest.parse()` - Updated digest/size return types - Import `MediaType` from `oci_spec::image` directly ### 3. Rust SDK - Add `remote-artifact` feature (enabled by default) - Make network-dependent code conditional: - `Artifact::push()` for OciArchive and OciDir - `Artifact::from_remote()` and `Artifact::pull()` - `dataset` module - `ommx` CLI binary - Local operations (OciArchive save/load) remain available in wasm builds ### 4. Python SDK - Add `remote-artifact` feature (enabled by default) - Make network-dependent code conditional: - `ArtifactArchive::push()` and `ArtifactDir::push()` - `ArtifactDir::from_image_name()` - Dataset functions - Add `task python:ommx:build:pyodide` for building wasm wheels - Add `task python:ommx:test:pyodide` for testing in Node.js + pyodide ### 5. Testing & Release - Add pyodide test suite using Node.js + pyodide - Verify basic functionality (DecisionVariable creation) in WebAssembly environment - CI testing for both Rust SDK and Python SDK pyodide builds - Pyodide wheel automatically built and tested in release workflow - Pyodide wheel uploaded to GitHub Release on python-* tags ## Build Commands **Normal build** (with network features): ```bash cargo check -p ommx task python:ommx:build ``` **Pyodide build** (without network features): ```bash cargo +nightly check -p ommx --target wasm32-unknown-emscripten --no-default-features task python:ommx:build:pyodide task python:ommx:test:pyodide ``` ## Verification All builds tested and working: - ✅ Rust SDK with remote-artifact feature - ✅ Rust SDK for wasm32-emscripten without remote-artifact - ✅ Python SDK with remote-artifact feature - ✅ Python SDK for wasm32-emscripten (pyodide wheel) - ✅ OMMX functionality in Node.js + pyodide environment ## Version This PR introduces new features and adds a new Cargo feature to Rust SDK: - **Rust SDK**: 2.2.1 → **2.3.0** (minor version bump) - New feature: `remote-artifact` (breaking for users who depend on feature flags) - New capability: wasm32-unknown-emscripten support - **Python SDK**: 2.2.1 → **2.3.0** (minor version bump) - New feature: pyodide (WebAssembly) support - New build target: wasm32-unknown-emscripten wheels --------- Co-authored-by: Claude <noreply@anthropic.com>
main
2 days ago
Relax EvaluatedDecisionVariable invariants to allow infeasible solutions (#676) # ⚠️ Breaking Change: Allow Infeasible Solutions This PR introduces a **behavioral change** in how OMMX handles bound and kind constraint violations. This is a **minor version bump** (2.1.x → 2.2.0) due to the semantic changes in `Solution::feasible()`. ## 🎯 Summary Relaxes the invariants of `EvaluatedDecisionVariable` to allow representing infeasible solutions. Previously, bound and kind constraints were enforced at construction time, making it impossible to create solutions with violations. This was inconsistent with how constraint violations were handled. ## ❌ Problem - **Infeasible State evaluation failed**: When a State was infeasible (e.g., constraints violated), dependent variables could violate their bounds, causing `evaluate()` to fail with `StateValidationError::ValueOutOfBounds` - **Asymmetric treatment**: Constraint violations were allowed (checked via `Solution::feasible()`), but bound/kind violations caused errors - **Presolve debugging**: Made it difficult to debug presolve issues where dependent variable bounds might be temporarily violated ## 🔧 Changes ### Rust SDK (2.2.0) 1. **Remove bound/kind checking from construction**: - `EvaluatedDecisionVariable::new` no longer checks bounds or kind constraints - `SampledDecisionVariable::new` similarly relaxed - `populate()` method in `analysis.rs` no longer validates bounds/kinds 2. **Add validation method**: - New `is_valid()` method on `EvaluatedDecisionVariable` checks bound and kind constraints 3. **Extend Solution feasibility**: - `Solution::feasible()` **now checks both constraints AND decision variables** ⚠️ - New helper methods: - `feasible_decision_variables()`: Check only decision variables - `feasible_constraints()`: Check only constraints (old `feasible()` behavior) - `feasible_constraints_relaxed()`: Check only relaxed constraints 4. **Deprecated variants (semver-compatible)**: - `StateValidationError::ValueOutOfBounds` marked as `#[deprecated]` - `StateValidationError::NotAnInteger` marked as `#[deprecated]` - These variants are kept to maintain semver compatibility but are never constructed ### Python SDK (2.2.0) - `instance.evaluate()` no longer raises errors for bound/kind violations - Instead, returns an infeasible `Solution` where `solution.feasible == False` - Updated doctests to reflect new behavior ## ✅ Benefits - ✅ Infeasible states can now be evaluated to produce infeasible solutions - ✅ Dependent variables can violate bounds without causing evaluation errors - ✅ Symmetric treatment of constraint and bound/kind violations - ✅ Useful for presolve debugging when dependent variable bounds may be temporarily violated ## ⚠️ Breaking Changes ### Rust SDK **`Solution::feasible()` semantics changed**: - **Before**: Only checked constraints - **After**: Checks both constraints AND decision variable bounds/kinds **Migration**: ```rust // If you need the old behavior (constraints only): if solution.feasible_constraints() { // Use this instead of feasible() // ... } // New behavior (constraints + decision variables): if solution.feasible() { // This now also checks decision variable bounds/kinds } ``` **`StateValidationError` variants deprecated**: - `ValueOutOfBounds` and `NotAnInteger` are deprecated but kept for compatibility - These errors are never raised in the new implementation ### Python SDK **`instance.evaluate()` behavior changed**: - **Before**: Raised `RuntimeError` for bound/kind violations - **After**: Returns infeasible `Solution` with `solution.feasible == False` **Migration**: ```python # Before (2.1.x): try: solution = instance.evaluate(state) # state was valid except RuntimeError: # state had bound/kind violations pass # After (2.2.0): solution = instance.evaluate(state) if solution.feasible: # state was valid else: # state had constraint or bound/kind violations pass ``` ## 🧪 Testing - ✅ All Rust tests pass (315 tests) - ✅ All Python doctests pass - ✅ Semver-checks passes with deprecated variants - ✅ No warnings in compilation ## 📚 Related Issues This addresses the issue where presolve debugging was difficult due to dependent variables violating bounds in intermediate states. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
main
6 days ago

Active Branches

No pull requests foundAs pull requests are created, their performance will appear here.
© 2025 CodSpeed Technology
Home Terms Privacy Docs