Package jline.solvers
Class Solver
java.lang.Object
jline.solvers.Solver
- Direct Known Subclasses:
EnsembleSolver,NetworkSolver,SolverLQNS
Abstract base class for model solution algorithms and analysis tools.
This class provides the fundamental infrastructure for solving queueing models using various analytical and simulation algorithms. It manages solver configuration, result storage, random number generation, and validation of solver options.
Concrete implementations must provide the runAnalyzer() method to perform
the actual model solution.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanFlag controlling whether to perform validation checksThe model to be solvedName identifier for this solver instanceConfiguration options for the solverRandom number generator for stochastic algorithmsResults from the most recent solver execution -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a solver with the specified name using default options.protectedSolver(String name, SolverOptions options) Constructs a solver with the specified name and options.protectedSolver(Model model, String name, SolverOptions options) Constructs a solver with the specified model, name, and options. -
Method Summary
Modifier and TypeMethodDescriptionstatic SolverOptionsReturns a new SolverOptions instance with default settings.getName()Returns the name identifier of this solver.Returns the current solver options.Returns the results from the most recent solver execution.booleanChecks if the solver has computed results.booleanChecks if Java runtime is available for solver execution.booleanisValidOption(String optName) Checks if the specified option name is valid for this solver.Returns lists of valid options and methods supported by solvers.static SolverOptionsparseOptions(Object... varargin) Parses option parameters into a SolverOptions data structure.static SolverOptionsparseOptions(SolverOptions options, Object... varargin) Parses option parameters into an existing SolverOptions instance.voidreset()Clears previously stored results and resets the random number generator.voidresetRandomGeneratorSeed(long seed) Assigns a new seed to the random number generator.abstract voidExecutes the solver algorithm to analyze the model.voidrunAnalyzerChecks(SolverOptions options) Performs validation checks before running the analyzer.voidsetChecks(boolean bool) Enables or disables validation checks during solver execution.voidsetOptions(SolverOptions options) Sets new solver options.booleanChecks if this solver supports the given network model.
-
Field Details
-
model
The model to be solved -
name
Name identifier for this solver instance -
options
Configuration options for the solver -
result
Results from the most recent solver execution -
enableChecks
public boolean enableChecksFlag controlling whether to perform validation checks -
random
Random number generator for stochastic algorithms
-
-
Constructor Details
-
Solver
Constructs a solver with the specified name and options.- Parameters:
name- the solver name identifieroptions- configuration options for the solver
-
Solver
Constructs a solver with the specified model, name, and options.- Parameters:
model- the model to be solvedname- the solver name identifieroptions- configuration options for the solver
-
Solver
Constructs a solver with the specified name using default options.- Parameters:
name- the solver name identifier
-
-
Method Details
-
defaultOptions
Returns a new SolverOptions instance with default settings.- Returns:
- default solver options
-
listValidOptions
Returns lists of valid options and methods supported by solvers.- Returns:
- map containing "allOptions" and "allMethods" lists
-
parseOptions
Parses option parameters into a SolverOptions data structure.- Parameters:
varargin- variable arguments in key-value pairs- Returns:
- parsed solver options
- Throws:
IllegalArgumentException- if arguments are invalid
-
parseOptions
public static SolverOptions parseOptions(SolverOptions options, Object... varargin) throws IllegalArgumentException Parses option parameters into an existing SolverOptions instance.- Parameters:
options- existing options object to modifyvarargin- variable arguments in key-value pairs- Returns:
- modified solver options
- Throws:
IllegalArgumentException- if arguments are invalid
-
getName
Returns the name identifier of this solver.- Returns:
- the solver name
-
getOptions
Returns the current solver options.- Returns:
- the solver options
-
setOptions
Sets new solver options.- Parameters:
options- the new solver options to set
-
getResults
Returns the results from the most recent solver execution.- Returns:
- the solver results
-
hasResults
public boolean hasResults()Checks if the solver has computed results.- Returns:
- true if results are available, false otherwise
-
isJavaAvailable
public boolean isJavaAvailable()Checks if Java runtime is available for solver execution. Always returns true in this Java implementation.- Returns:
- true indicating Java is available
-
isValidOption
Checks if the specified option name is valid for this solver.- Parameters:
optName- the option name to validate- Returns:
- true if the option is valid, false otherwise
-
reset
public void reset()Clears previously stored results and resets the random number generator. -
resetRandomGeneratorSeed
public void resetRandomGeneratorSeed(long seed) Assigns a new seed to the random number generator. This sets the master seed for all random number generation in the system.- Parameters:
seed- the seed value for random number generation
-
runAnalyzer
public abstract void runAnalyzer() throws IllegalAccessException, ParserConfigurationException, IOExceptionExecutes the solver algorithm to analyze the model. This abstract method must be implemented by concrete solver classes.- Throws:
IllegalAccessException- if access to required resources is deniedParserConfigurationException- if XML parsing configuration failsIOException- if I/O operations fail
-
runAnalyzerChecks
Performs validation checks before running the analyzer. Verifies model compatibility and method validity.- Parameters:
options- the solver options to validate- Throws:
RuntimeException- if validation fails
-
setChecks
public void setChecks(boolean bool) Enables or disables validation checks during solver execution.- Parameters:
bool- true to enable checks, false to disable
-
supports
Checks if this solver supports the given network model. Default implementation returns true; subclasses should override to provide specific feature validation.- Parameters:
model- the network model to check- Returns:
- true if the model is supported, false otherwise
-