Week 7 - Model Refinement, Code Cleanup, and Solver Integration

In the past week, my main focus was on refining the model abstraction, further cleaning the codebase, and once again, integrate the CommonsMathSolver into the solver interface.

Progress:

  • Model Refinement with Built Flag:
    Added a built flag to AbstractLPModel to clearly indicate when the model is finalized. After calling build(), the flag is set to true. Any subsequent changes reset the flag to false until the model is rebuilt. This mechanism ensures clarity about the model's state throughout its lifecycle.

  • Utility for Constraint Indices:
    Implemented a utility method that retrieves the index of a given constraint within the model. This allows adapters or other classes easy access to constraint indices without redundant logic.

  • Continuous Integration Improvements:
    Ensured the CI pipeline via GitHub Actions runs all unit tests smoothly and without errors, providing instant feedback on new code contributions and pull requests.

  • Explicit Double Types in Tests:
    Added the explicit type suffix (d) to all double literals within unit tests, clearly marking them as doubles and improving readability.

  • Extracted Optimization Goal Enum:
    Moved the optimization goal (MAXIMIZE/MINIMIZE) enum into a dedicated file, following best Java architecture practices. This enhances reusability across classes and avoids tight coupling.

  • Mapping Index Logic Relocated to Model:
    Removed the direct handling of indices from variables and constraints, centralizing the mapping logic within the model itself. This reduces complexity in the solver adapters.

  • Enhanced Future-Proof Logging:
    Replaced fixed logging strings with dynamically generated class names and used Java's MessageFormat for constructing log messages. This approach is flexible and robust, reducing maintenance if class or method names change in the future.

  • CommonsMathSolver Integration:
    Successfully integrated the CommonsMathSolver into the unified solver interface (ILPSolver). The solver is now fully operational and demonstrated via the SolverDemo class.

Next Steps:

  • Review the correctness and suitability of the model’s built-flag mechanism in further Unit tests.

  • Reuse the unit tests from the old Interface for the SimplexSolver and import them into the new interface.

  • Integrate the current Interface into SBSCL to test if the integration was done correctly.

  • If possible, expand the documentation (README, developer docs).

  • If the first solver works in SBSCL, continue with the integration of the remaining solver adapters (OjAlgo, GLPK, CBC, 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