pipe.modules.invariantAnalysis
Class InvariantAnalysis

java.lang.Object
  |
  +--pipe.modules.invariantAnalysis.InvariantAnalysis
All Implemented Interfaces:
Module

public class InvariantAnalysis
extends java.lang.Object
implements Module


Field Summary
private  IntMatrix IncidenceMatrix
           
private static java.lang.String MODULE_NAME
           
private  IntMatrix PInvariants
           
private  IntMatrix TInvariants
           
 
Constructor Summary
InvariantAnalysis()
           
 
Method Summary
 int[] alphaCoef(int k, int[] j)
          adjust linear combination coefficients according to sign if sign(j) <> sign(k) then alpha = abs(j) beta = abs(k) if sign(j) == sign(k) then alpha = -abs(j) beta = abs(k)
 int[] betaCoef(int chk, int n)
          adjust linear combination coefficients according to sign if sign(j) <> sign(k) then alpha = abs(j) beta = abs(k) if sign(j) == sign(k) then alpha = -abs(j) beta = abs(k)
 int effectiveSetLength(int[] pSet)
          find the number of non-zero elements in a set
 java.lang.String findNetInvariants(int[] M0)
          Find the net invariants.
 java.lang.String findPEquations(int[] initialMarking)
          Find the P equations of the net.
 java.lang.String findPInvariants(int[] M0)
          Find the P invariants.
 java.lang.String findTInvariants(int[] M0)
          Find the T invariants.
 IntMatrix findVectors(IntMatrix C)
          Transform a matrix to obtain the minimal generating set of vectors.
 java.lang.String fixedWidthDoubletoString(double x, int w, int d)
          Format double with Fw.d.
 java.lang.String getConclusionsP()
          Draw conclusions based on the P Invariants.
 java.lang.String getConclusionsT()
          Draw conclusions based on the T Invariants.
 java.lang.String getName()
           
 boolean isEmptySet(int[] pSet)
          check if an array is empty (only zeros)
private  void print(java.lang.String s)
          Shorten spelling of print.
 void printArray(int[] a)
          used to display intermiadiate results for checking
 void resetArray(int[] a)
           
 void run(DataLayer dataObj)
          Call the methods that find the net invariants.
 int[] uniteSets(int[] A, int[] B)
          Unite two sets (arrays of integers) so that if there is a common entry in the arrays it appears only once, and all the entries of each array appear in the union.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

IncidenceMatrix

private IntMatrix IncidenceMatrix

PInvariants

private IntMatrix PInvariants

TInvariants

private IntMatrix TInvariants

MODULE_NAME

private static final java.lang.String MODULE_NAME
Constructor Detail

InvariantAnalysis

public InvariantAnalysis()
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface Module
Returns:
The module name

run

public void run(DataLayer dataObj)
Call the methods that find the net invariants.
Specified by:
run in interface Module
Parameters:
dataObj - A dataLayer type object with all the information about the petri net param initialMarking An array with the initial marking of the petri net. param array A double array of ints describing the incidence matrix of the PT Net

findNetInvariants

public java.lang.String findNetInvariants(int[] M0)
Find the net invariants.
Parameters:
M0 - An array containing the initial marking of the net.
Returns:
A string containing the resulting matrices of P and T Invariants or "None" in place of one of the matrices if it does not exist.

findPInvariants

public java.lang.String findPInvariants(int[] M0)
Find the P invariants.
Parameters:
M0 - An array containing the initial marking of the net.
Returns:
A string containing the resulting matrix of P Invariants or "None" if the matrix does not exist.

getConclusionsP

public java.lang.String getConclusionsP()
Draw conclusions based on the P Invariants.
Returns:
A string containing the conclusions.

getConclusionsT

public java.lang.String getConclusionsT()
Draw conclusions based on the T Invariants.
Returns:
A string containing the conclusions.

findTInvariants

public java.lang.String findTInvariants(int[] M0)
Find the T invariants.
Parameters:
M0 - An array containing the initial marking of the net.
Returns:
A string containing the resulting matrix of T Invariants or "None" if the matrix does not exist.

findPEquations

public java.lang.String findPEquations(int[] initialMarking)
Find the P equations of the net.
Parameters:
initialMarking - An array containing the initial marking of the net.
Returns:
A string containing the resulting P equations, empty string if the equations do not exist.

findVectors

public IntMatrix findVectors(IntMatrix C)
Transform a matrix to obtain the minimal generating set of vectors.
Parameters:
C - The matrix to transform.
Returns:
A matrix containing the vectors.

effectiveSetLength

public int effectiveSetLength(int[] pSet)
find the number of non-zero elements in a set
Parameters:
pSet - The set count the number of non-zero elements.
Returns:
The number of non-zero elements.

alphaCoef

public int[] alphaCoef(int k,
                       int[] j)
adjust linear combination coefficients according to sign if sign(j) <> sign(k) then alpha = abs(j) beta = abs(k) if sign(j) == sign(k) then alpha = -abs(j) beta = abs(k)
Parameters:
k - The column index of the first coefficient
j - The column indices of the remaining coefficients
Returns:
The adjusted alpha coefficients

betaCoef

public int[] betaCoef(int chk,
                      int n)
adjust linear combination coefficients according to sign if sign(j) <> sign(k) then alpha = abs(j) beta = abs(k) if sign(j) == sign(k) then alpha = -abs(j) beta = abs(k)
Parameters:
chk - The first coefficient
n - The length of one row
Returns:
The adjusted beta coefficients

resetArray

public void resetArray(int[] a)

uniteSets

public int[] uniteSets(int[] A,
                       int[] B)
Unite two sets (arrays of integers) so that if there is a common entry in the arrays it appears only once, and all the entries of each array appear in the union. The resulting array size is the same as the 2 arrays and they are both equal. We are only interested in non-zero elements. One of the 2 input arrays is always full of zeros.
Parameters:
A - The first set to unite.
B - The second set to unite.
Returns:
The union of the two input sets.

isEmptySet

public boolean isEmptySet(int[] pSet)
check if an array is empty (only zeros)
Parameters:
pSet - The set to check if it is empty.
Returns:
True if the set is empty.

printArray

public void printArray(int[] a)
used to display intermiadiate results for checking
Parameters:
a - The array to print.

print

private void print(java.lang.String s)
Shorten spelling of print.
Parameters:
s - The string to print.

fixedWidthDoubletoString

public java.lang.String fixedWidthDoubletoString(double x,
                                                 int w,
                                                 int d)
Format double with Fw.d.
Parameters:
x - The format of the string.
w - The length of the string.
d - The number of fraction digits.
Returns:
The string to print.