Week 6 - Abstract Model Refactoring, Unified Testing & CI Setup

In the past week, my main focus was on refactoring the model layer, improving test coverage, and streamlining project automation.

Progress:

  • New Abstract Model Class:
    Introduced AbstractLPModel as the new central class to dynamically manage variables, constraints, and all model metadata. Instead of fixed arrays, the class uses flexible lists and maps. The final model is only constructed when calling build().

  • Consistent Mapping & ID Tracking:
    Implemented clear mapping from names to indices for all variables and constraints, preventing duplicate IDs and making debugging easier.

  • Unit Tests for Model Abstraction:
    Added a new test class (AbstractLPModelTest) covering variable/constraint addition, the build process, and redundancy cases. Exception handling for duplicate names is implemented and tested.

  • CI/CD Pipeline:
    Set up a GitHub Actions workflow that automatically builds and tests every commit and pull request. Errors are shown directly in the PR for quick feedback.

  • Unified Adapter Tests:
    Standardized all LP test cases so that CommonsMath and OjAlgo adapters are tested on exactly the same features (bounds, minimization/maximization, error handling).

  • Code Quality:
    Improved JavaDocs and ensured clean, consistent code for all model, adapter, and test classes.

  • Project Structure:
    Maintained clear separation of main and test code, stable Maven/Java environment, and consistent use of feature branches.

  • Improved Logging and Error Handling:
    The model now supports optional debug logging. With debugging enabled, all key operations (adding variables, constraints, and building the model) provide log output. In addition, the model now uses a “fail fast” approach: if you try to add a duplicate variable or constraint, an error is thrown and logged immediately. This makes debugging and testing much more straightforward compared to traditional APIs.

Next Steps:

  • Refactor the solver adapters so they accept only the finalized model object.

  • (Optional) Extend redundancy tests for intentional duplicate variable/constraint names.

  • Expand the README and developer documentation.

  • If the new interface is approved by the mentors, begin integration of CommonsMathSolver, OjAlgoSolver and the additional solvers GLPK, CBC, and SCIP.

That’s it for this week, see you next week!

Project Details:

Kommentare

Beliebte Posts aus diesem Blog

OptSolvX in SBSCL: A Solver-Agnostic LP Core (GSoC 2025 Final Report)

Week 2 – Community Bonding Wrap-Up

Week 5 - Unit Testing, OjAlgo Integration, and Code Cleanup