Interface MathProgrammingSolver

All Known Implementing Classes:
OjAlgoSolver

public interface MathProgrammingSolver
Solves a LinearProgram — the provider seam behind the OPTIMIZE operator and COVER EXACT.

The engine builds the program and reads the answer; a provider performs the search. Nothing in this interface is relational, which is the point: a solver author needs branch-and-bound, not a row model. The shipped provider is ojAlgo (relix-solver-ojalgo); it compiles against this module and nothing else, so anything it can do a third party can do.

Implementations are discovered with ServiceLoader through SolverCatalog, and must be safe to call from several threads at once — the engine solves one program per group and does not serialise them.

  • Method Summary

    Modifier and Type
    Method
    Description
    A short name for this solver, used in diagnostics.
    default int
    Where this solver sits when more than one is installed: the highest priority wins, and the shipped provider is 0, so dropping in a replacement works without having to remove anything.
    Solves a program.
  • Method Details

    • name

      String name()
      A short name for this solver, used in diagnostics.
      Returns:
      the solver's name, e.g. "ojAlgo"
    • priority

      default int priority()
      Where this solver sits when more than one is installed: the highest priority wins, and the shipped provider is 0, so dropping in a replacement works without having to remove anything.
      Returns:
      this solver's priority
    • solve

      SolverResult solve(LinearProgram program)
      Solves a program.

      Three outcomes, and a provider is expected to distinguish them rather than collapse the last two: an optimal assignment (SolverResult.Solved), a program proved to have none (SolverResult.Infeasible), and a search that did not decide — failed, cut off, unbounded, malformed (SolverResult.Undetermined, carrying a short reason). Infeasibility is a normal answer the engine acts on; an undecided search is an error it reports, because a query cannot honestly say "no rows" about a question nobody answered. An exception means the provider itself broke.

      Parameters:
      program - the program to solve; must not be null
      Returns:
      what the solver concluded; never null