Interface SolverResult

All Known Implementing Classes:
SolverResult.Infeasible, SolverResult.Solved, SolverResult.Undetermined

public sealed interface SolverResult permits SolverResult.Solved, SolverResult.Infeasible, SolverResult.Undetermined
What a solver has to say about a LinearProgram: it found an optimum, it proved there is none, or it did not decide.

The third case is the reason this is a type rather than an Optional. "No assignment satisfies the constraints" and "the search ran out of road" are both answers with no values attached, and a caller that cannot tell them apart has to guess — which in practice means reporting a failed search as an empty result and returning rows that are quietly wrong. A provider says which it means; the engine decides what to do about it.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    The program is proved infeasible — no assignment satisfies its constraints.
    static final record 
    An optimal assignment.
    static final record 
    The search did not decide: it failed, hit a limit, found the program unbounded or malformed, or stopped for any other reason short of an answer.
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    Returns the proved-infeasible result.
    solved(double[] values)
    Returns a solved result.
    Returns an undecided result.
  • Method Details

    • solved

      static SolverResult solved(double[] values)
      Returns a solved result.
      Parameters:
      values - the variable values
      Returns:
      the result
    • infeasible

      static SolverResult infeasible()
      Returns the proved-infeasible result.
      Returns:
      the result
    • undetermined

      static SolverResult undetermined(String reason)
      Returns an undecided result.
      Parameters:
      reason - a short explanation of why the search did not answer
      Returns:
      the result