In the C++ code, use |v1-v2/v1| rather than |v1-v2/v2|.
In the Java code, remove the special case where v1 and v2 are < 1e-12.
Should have minimal effect on convergence in practice,
but makes debugging easier to have engines consistent.
A default implementation of createVarList() in ModelInfo now creates
a VarList automatically, so this does not need to be implemented when
creating a ModelGenerator. Instead, just getVarDeclarationType(int i),
which is a newly added method, should be implemented. There is also
a default implementation of this, but it assumes that integer variables
are unbounded, which will not work with the symbolic engine.
In a related change, ModelInfo can now optionally specify which "module"
a variable belongs to (via getVarModuleIndex and getModuleName).
ModulesFile is updated, to fully support the new version of ModelInfo,
and all implementations of ModelGenerator are simplified where possible.
The old VarList constructor which takes a ModulesFile is removed and
replaced with one which takes a ModelInfo object.
Instead, store the variable name and DeclarationType separately.
DeclarationType stores the type info we actually need, e.g.,
ranges for bounded integer variables. Declaration has other
information such as initial values, which is not needed here.
A new addVar(name, declType) method is added (and preferred).
Methods to add variables via Declarations remain, for convenience.
VarList should focus on the range, structure, etc. of the variables.
The initial values of the variables for a model are stored separately.
This info was only accessed from Modules2MTBDD,
which now extracts initial variable values itself,
and uses the VarList.encodeToInt helper method.
Checking that bounded integer vars are in range is now moved there.
This potentially allows checking of "symbolic" expressions for methods/engines
other than the parametric engine. It will also allow simplification of the
mechanisms for storing results from parametric model checking, aligning it
with other parts of the code.
In particular for a whole State, not just a substate.
Also for just some constants, with no variable values.
Can be used to get an expression symbolically in terms of constants.
For now, this provides a cleaner implementation of the default (unspecified)
model type being set to an MDP. Later, this will allow the actual model type
to be omitted or partially specified and derived from langage features.
Both types of engine now disallow negative/infinite/NaN rewards.
Symbolic engines will mostly still not detect the presence of NaN
due to the way that CUDD deals with this.
Regression tests also added.
This sets the working directory natively, which is used to read or
write files specified with relative locations. For example:
prism -dir /some/dir model.prism model.props
is the same as:
prism /some/dir/model.prism /some/dir/model.props
Exported files also go to the same directory.
The same applies when passing model/property files to the GUI via
the command-line and when specifying export filenames as options.
The GUI file chooser is also initialised to the -dir location.
This can be used where an exact result for testing is not known,
but bounds have been obtained, e.g., via interval iteration.
The bounds a and b must be doubles. As usual, no spaces are allowed.
Code is split into different methods for each type of test.
It is also mostly relocated to a new class prism.ResultTesting,
since it should not really be tied to the Property object.
The result for testing can now be passed as a Result object,
as well as Double, Integer, etc., with the former being preferred.
This will allow info attached to the Result object to be used
for the correctness, notably accuracy/error info.
Also add a new testing regression test - just some constants,
including border cases - infinity, NaN, etc.