Class Solver
-
- All Implemented Interfaces:
public abstract class Solver
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.
-
-
Field Summary
Fields Modifier and Type Field Description public Model
model
public String
name
public SolverOptions
options
public SolverResult
result
public boolean
enableChecks
public Random
random
-
Constructor Summary
Constructors Constructor Description Solver(String name, SolverOptions options)
Constructs a solver with the specified name and options. Solver(Model model, String name, SolverOptions options)
Constructs a solver with the specified model, name, and options. Solver(String name)
Constructs a solver with the specified name using default options.
-
Method Summary
Modifier and Type Method Description static SolverOptions
defaultOptions()
Returns a new SolverOptions instance with default settings. static Map<String, List<String>>
listValidOptions()
Returns lists of valid options and methods supported by solvers. static SolverOptions
parseOptions(Array<Object> varargin)
Parses option parameters into a SolverOptions data structure. static SolverOptions
parseOptions(SolverOptions options, Array<Object> varargin)
Parses option parameters into an existing SolverOptions instance. String
getName()
Returns the name identifier of this solver. SolverOptions
getOptions()
Returns the current solver options. void
setOptions(SolverOptions options)
Sets new solver options. SolverResult
getResults()
Returns the results from the most recent solver execution. boolean
hasResults()
Checks if the solver has computed results. boolean
isJavaAvailable()
Checks if Java runtime is available for solver execution. boolean
isValidOption(String optName)
Checks if the specified option name is valid for this solver. void
reset()
Clears previously stored results and resets the random number generator. void
resetRandomGeneratorSeed(long seed)
Assigns a new seed to the random number generator. abstract void
runAnalyzer()
Executes the solver algorithm to analyze the model. void
runAnalyzerChecks(SolverOptions options)
Performs validation checks before running the analyzer. void
setChecks(boolean bool)
Enables or disables validation checks during solver execution. boolean
supports(Network model)
Checks if this solver supports the given network model. -
-
Constructor Detail
-
Solver
Solver(String name, SolverOptions options)
Constructs a solver with the specified name and options.- Parameters:
name
- the solver name identifieroptions
- configuration options for the solver
-
Solver
Solver(Model model, String name, SolverOptions options)
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
Solver(String name)
Constructs a solver with the specified name using default options.- Parameters:
name
- the solver name identifier
-
-
Method Detail
-
defaultOptions
static SolverOptions defaultOptions()
Returns a new SolverOptions instance with default settings.
- Returns:
default solver options
-
listValidOptions
static Map<String, List<String>> listValidOptions()
Returns lists of valid options and methods supported by solvers.
- Returns:
map containing "allOptions" and "allMethods" lists
-
parseOptions
static SolverOptions parseOptions(Array<Object> varargin)
Parses option parameters into a SolverOptions data structure.
- Parameters:
varargin
- variable arguments in key-value pairs- Returns:
parsed solver options
-
parseOptions
static SolverOptions parseOptions(SolverOptions options, Array<Object> varargin)
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
-
getOptions
SolverOptions getOptions()
Returns the current solver options.
- Returns:
the solver options
-
setOptions
void setOptions(SolverOptions options)
Sets new solver options.
- Parameters:
options
- the new solver options to set
-
getResults
SolverResult getResults()
Returns the results from the most recent solver execution.
- Returns:
the solver results
-
hasResults
boolean hasResults()
Checks if the solver has computed results.
- Returns:
true if results are available, false otherwise
-
isJavaAvailable
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
boolean isValidOption(String optName)
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
void reset()
Clears previously stored results and resets the random number generator.
-
resetRandomGeneratorSeed
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
abstract void runAnalyzer()
Executes the solver algorithm to analyze the model. This abstract method must be implemented by concrete solver classes.
-
runAnalyzerChecks
void runAnalyzerChecks(SolverOptions options)
Performs validation checks before running the analyzer. Verifies model compatibility and method validity.
- Parameters:
options
- the solver options to validate
-
setChecks
void setChecks(boolean bool)
Enables or disables validation checks during solver execution.
- Parameters:
bool
- true to enable checks, false to disable
-
supports
boolean supports(Network model)
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
-
-
-
-