Class SolverCustom

java.lang.Object
jline.solvers.Solver
jline.solvers.NetworkSolver
jline.examples.java.advanced.SolverCustom

public class SolverCustom extends NetworkSolver
Template for a user-written LINE solver.

The MATLAB twin is a @SolverCustom class folder holding SolverCustom.m and runAnalyzer.m; the two free functions the analyzer calls stay in SolverCustomAlgorithm and SolverCustomAnalyzer, exactly as they do there.

To write a real solver: fill in SolverCustomAlgorithm.solver_custom(jline.lang.NetworkStruct, jline.solvers.SolverOptions), narrow getFeatureSet() to the features the algorithm actually supports, and list the method names it accepts in listValidMethods().

  • Constructor Details

  • Method Details

    • getStruct

      public NetworkStruct getStruct()
      The data structure summarizing the model (no initial state needed).
    • listValidMethods

      public List<String> listValidMethods()
      The method names this solver accepts.
    • getFeatureSet

      public static FeatureSet getFeatureSet()
      The model features this solver claims to support.

      Kept identical to the MATLAB template's list, which is deliberately broad: narrow it to what the algorithm can really answer, or supports(Network) will accept a model that SolverCustomAlgorithm.solver_custom(jline.lang.NetworkStruct, jline.solvers.SolverOptions) then gets wrong.

      Returns:
      the declared feature set
    • supports

      public boolean supports(Network model)
      Whether this solver declares every feature the model uses.
      Overrides:
      supports in class Solver
      Parameters:
      model - the model to check
      Returns:
      true if the model falls inside getFeatureSet()
    • defaultOptions

      public static SolverOptions defaultOptions()
      The options this solver starts from.
    • runAnalyzer

      public void runAnalyzer()
      Runs the solver: read the structure, call the analyzer, publish results.
      Specified by:
      runAnalyzer in class Solver
    • main

      public static void main(String[] args)
      Builds a two-station closed model and runs the template over it.