|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectengin.Engin
public class Engin
Engin
This is where all the computations take place. The engine can be set into three different threaded mode :Copyright(c) 2005 Université Laval, LSFM research group.
Nested Class Summary | |
---|---|
class |
Engin.Runner
Runner This class is a thread which starts the computation. |
Field Summary | |
---|---|
static int |
GET_STATES_VERIFYING_A_FORMULA_MODE
In this mode, the thread will determines which states from the state space verify the formula |
static int |
USE_BIGDECIMAL
In this mode, the engine will use BigDecimal structures for increased accuracy at the expense of reduces performance. |
static int |
USE_DOUBLE
In this mode, the engine will use simple double real numbers. |
static int |
USE_HASH
In this mode, the engine will use regular has table based data structures. |
static int |
USE_MTBDD
In this mode, the engine will use multiterminal binary decison diagrams (MTBDDs) in order to save memory. |
static int |
VERIFY_A_FORMULA_MODE
In this mode, the thread will verify if the initial state verifies the formula |
static int |
VERIFY_CONSTRAINT_MODE
In this mode, the thread will verify if all the LMP constraints are verified by the system |
Constructor Summary | |
---|---|
Engin()
Default constructor. |
|
Engin(java.lang.String str,
int mode)
Test constructor, to compute the system size. |
Method Summary | |
---|---|
void |
addEnginListener(EnginListener e)
Registers a listener to the engine |
java.util.HashMap |
computeProbabilities(IntervalList list,
java.lang.String act)
Compute the probability P[a](x, list), i.e. the probability to reach a certain point of the list from any x point. |
java.util.ArrayList |
findZeroes(Expression exp,
Variable var,
Interval inter,
double threshold)
This method finds the intersection points between a mathematical expression and a threshold, on the interval closure inter . |
java.util.ArrayList |
findZeroesBigDecimal(Expression exp,
Variable var,
Interval inter,
double threshold)
This method finds the intersection points between a mathematical expression and a threshold, on the interval closure inter . |
java.util.ArrayList |
findZeroesDouble(Expression exp,
Variable var,
Interval inter,
double threshold)
This method finds the intersection points between a mathematical expression and a threshold, on the interval closure inter . |
int |
getCalculationMode()
Returns the calculation mode used ... |
Formula |
getFormula()
Returns the formula stored in the engine. |
LogicParser |
getLogicParser()
Returns the logical parser used by the engine to analyse formulae |
int |
getNbIteration()
Returns the maximum number of iterations the function findZeroes can make to find polarity change. |
Parser |
getParser()
Returns the expression parser used by the engine used to analyse the expressions attached to the transitions |
double |
getPrecision()
Returns the smallest unit used during the computation of findZeroes. |
ProbSystem |
getProbSystem()
Returns the probabilistic on which the engine performs the computations |
int |
getSegmentation()
Returns the number of segments that the findZeroes function will build while attempting to find a polarity switch. |
IntervalList |
getStatesVerifying(Formula f)
Returns all the states verifying a formula using the system loaded in the engine. |
IntervalList |
getStatesVerifying(Formula f,
int level)
Returns all the states verifying a formula using the system loaded in the engine. |
int |
getStructMode()
Returns the current data structure mode used. |
Variable |
getX()
Returns the x variable definition |
Variable |
getY()
Returns the y variable definition |
boolean |
highestPForTransition(Transition transition,
double q)
Returns true if q is the highest probability of the transition. |
void |
libere(ProbSystem s)
Free the memory used by the previous probabilitic system. |
java.lang.String |
loadFormula(java.io.File file)
Loads the formula history from the specified file |
void |
loadProbSystem(java.io.File filename)
Loads a probabilistic system from a file. |
void |
loadProbSystem(java.io.Reader reader,
int numberOfLines)
Loads a probabilistic system from a reader. |
void |
loadProbSystem(java.lang.String s)
Loads a probabilistic system from a string. |
ExpressionProgram |
parseExp(java.lang.String exp)
Parse a string representing an expression attached to a transition to build an expression object recognizable by the JavaMath library. |
Formula |
parseFormula(java.lang.String formula)
Parse a string representing a formula (usually from the formula history) in order to build a formula tree that can be analysedby the engine. |
void |
removeEnginListener(EnginListener e)
Remove a listener from the engine |
void |
run(int mode)
Use to perform ths computation in a separate thread. |
boolean |
satisfies(ProbSystem s,
Formula f)
Checks wether of not a probabilistic system does verify a formula. |
IntervalList |
separation(java.util.HashMap fct,
Variable var,
double q)
Returns all the x values for which the probability obtained from the probabilistic expression is greater than q. |
void |
setCalculationMode(int calculationMode)
Sets the calculation mode for the findZeroes method. |
void |
setEnginTrace(EnginTraceDialog trace)
Register a trace verification object for use during formula verification |
void |
setFormula(Formula formula)
This method register a formula to the engine, in order to perform its verification. |
void |
setNbIteration(int nbIter)
Sets the maximum number of iterations the findZeroes can make to find zeroes. |
void |
setPrecision(double precision)
Sets the smalles unit to be used by the function findZeroes. |
void |
setProbSystem(ProbSystem s)
This method replace the currently attached probabilistic system with a new one. |
void |
setProgress(ProgressDialog progress)
Attach a progress bar to the engine. |
void |
setSegmentation(int segmentation)
Sets the number of segments the findZeroes method must build in order to attempt to find a switch of polarity. |
void |
setStructMode(int structMode)
Type of data structures used to store the system. |
boolean |
verifySystemConstraints()
This function verifies that the system does indeed satisfies the LMP constraints : 0 <= P_a(x,S) < 1 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int VERIFY_A_FORMULA_MODE
public static final int GET_STATES_VERIFYING_A_FORMULA_MODE
public static final int VERIFY_CONSTRAINT_MODE
public static final int USE_DOUBLE
public static final int USE_BIGDECIMAL
public static final int USE_MTBDD
public static final int USE_HASH
Constructor Detail |
---|
public Engin()
public Engin(java.lang.String str, int mode)
str
- the name of the file to loadmode
- the engine mode (MTBDDs or Hashtable)Method Detail |
---|
public Parser getParser()
public LogicParser getLogicParser()
public Variable getX()
public Variable getY()
public ProbSystem getProbSystem()
public void libere(ProbSystem s)
s
- the probabilistic system to free from the memory.public void setProbSystem(ProbSystem s)
s
- the new probabilistic system to be attached to the enginepublic void setProgress(ProgressDialog progress)
progress
- the progress bar to attachpublic ExpressionProgram parseExp(java.lang.String exp)
exp
- the string to convert into an expression
public Formula parseFormula(java.lang.String formula)
formula
- a string representing the formula tree
public void setEnginTrace(EnginTraceDialog trace)
trace
- a trace verification objectpublic double getPrecision()
Engine#findZeroes
public void setPrecision(double precision)
precision
- the smallest unit to be used during findZeroes
computationfindZeroes(edu.hws.jcm.data.Expression, edu.hws.jcm.data.Variable, data.Interval, double)
public void setSegmentation(int segmentation)
segmentation
- the number of segments to buildpublic int getSegmentation()
Engine#findZeroes
public void setNbIteration(int nbIter)
nbIter
- the maximum number of iterations made by the findZeroes
functionpublic int getNbIteration()
public void setFormula(Formula formula)
formula
- a logical formulaparseFormula(java.lang.String)
,
Engin#getStatesVerifing
public java.util.HashMap computeProbabilities(IntervalList list, java.lang.String act)
list
- the state set which may be reached from x.act
- the action to be applied.
public IntervalList separation(java.util.HashMap fct, Variable var, double q)
fct
- a association of Interval -> probability for each x set
for which the expression returns a probability greater than qvar
- represents the x variable in the expressionq
- the minimum probabity (not included)
public boolean satisfies(ProbSystem s, Formula f)
s
- the probabilistic system to verify the formula fromf
- the formula to verify
public IntervalList getStatesVerifying(Formula f)
f
- the formula to verify
setProbSystem(data.ProbSystem)
public IntervalList getStatesVerifying(Formula f, int level)
f
- the formula to verifylevel
- the depth of the expression evaluated in power of two.
If a logical operator is used, then the signs are switched from each side.
setProbSystem(data.ProbSystem)
public java.util.ArrayList findZeroes(Expression exp, Variable var, Interval inter, double threshold)
inter
.
It is possible zeroes will not be found by the procedure, which analyse
the signs of each segments. An application of the secant method
estimates the zero value when a sign difference is found.
exp
- the expression to analysevar
- the Variable object representing xinter
- the interval to analysethreshold
- the threshold
setPrecision(double)
,
setSegmentation(int)
,
setNbIteration(int)
public java.util.ArrayList findZeroesDouble(Expression exp, Variable var, Interval inter, double threshold)
inter
.
It is possible zeroes will not be found by the procedure, which analyse
the signs of each segments. An application of the secant method
estimates the zero value when a sign difference is found. Double
numbers are used.
exp
- the expression to analysevar
- the Variable object representing xinter
- the interval to analysethreshold
- the threshold
setPrecision(double)
,
setSegmentation(int)
,
setNbIteration(int)
public java.util.ArrayList findZeroesBigDecimal(Expression exp, Variable var, Interval inter, double threshold)
inter
.
It is possible zeroes will not be found by the procedure, which analyse
the signs of each segments. An application of the secant method
estimates the zero value when a sign difference is found. BigDecimal
numbers are used.
exp
- the expression to analysevar
- the Variable object representing xinter
- the interval to analysethreshold
- the threshold
setPrecision(double)
,
setSegmentation(int)
,
setNbIteration(int)
public boolean highestPForTransition(Transition transition, double q)
transition
- the transition to analyseq
- the maximum probabity to check
public void addEnginListener(EnginListener e)
e
- the listener to addpublic void removeEnginListener(EnginListener e)
e
- the listener to removepublic Formula getFormula()
public void loadProbSystem(java.io.File filename) throws DataParserException, ProbSystemException
filename
- the file name from which to load the system.
DataParserException
- should an invalid expression be detected
ProbSystemException
- should an invalid probabilistic system be present in the readerpublic void loadProbSystem(java.lang.String s) throws java.io.IOException, DataParserException, ProbSystemException
s
- a string representing the system
java.io.IOException
- should an error occur while reading the string
DataParserException
- should an error exist in the system's representation
ProbSystemException
- if the system could not be createdpublic void loadProbSystem(java.io.Reader reader, int numberOfLines) throws java.io.IOException, DataParserException, ProbSystemException
reader
- the reader object from which to load the systemnumberOfLines
- number of lines in the reader, 0 if unknown
java.io.IOException
- should an error occur while reading data
DataParserException
- should an invalid expression be detected
ProbSystemException
- should an invalid probabilistic system be present in the readerpublic boolean verifySystemConstraints() throws java.lang.Exception
java.lang.Exception
- if one constraint is violatedpublic void setCalculationMode(int calculationMode)
calculationMode
- Eighter USE_BIGDECIMAL or USE_DOUBLE, else
nothing will happen.USE_DOUBLE
,
USE_BIGDECIMAL
public void setStructMode(int structMode) throws java.lang.Exception
structMode
- USE_MTBDD or USE_HASH, else nothing will happen.
java.lang.Exception
- if mode change was unsuccesfulUSE_MTBDD
,
USE_HASH
public void run(int mode)
mode
- the operation to be performedVERIFY_A_FORMULA_MODE
,
GET_STATES_VERIFYING_A_FORMULA_MODE
,
VERIFY_CONSTRAINT_MODE
public int getCalculationMode()
USE_DOUBLE
,
USE_BIGDECIMAL
public int getStructMode()
USE_MTBDD
,
USE_HASH
public java.lang.String loadFormula(java.io.File file) throws java.io.IOException, DataParserException, ProbSystemException
file
- the file from which to load the formula history
java.io.IOException
- should a file access error occur
DataParserException
- should the file contain an invalid formula
ProbSystemException
- should the history be empty
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |