pipe.modules.invariantAnalysis
Class InvariantAnalysis

java.lang.Object
  extended by pipe.modules.invariantAnalysis.InvariantAnalysis
All Implemented Interfaces:
Module

public class InvariantAnalysis
extends java.lang.Object
implements Module


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[] M)
          Find the net invariants.
 java.lang.String findPEquations(int[] currentMarking)
          Find the P equations of the net.
 PNMatrix findVectors(PNMatrix C)
          Transform a matrix to obtain the minimal generating set of vectors.
 java.lang.String getName()
           
 boolean isEmptySet(int[] pSet)
          check if an array is empty (only zeros)
 java.lang.String reportPInvariants(int[] M)
          Reports on the P invariants.
 java.lang.String reportTInvariants(int[] M)
          Reports on the T invariants.
 void resetArray(int[] a)
           
 void run(DataLayer pnmlData)
          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, toString, wait, wait, wait
 

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 pnmlData)
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

findNetInvariants

public java.lang.String findNetInvariants(int[] M)
Find the net invariants.

Parameters:
M - An array containing the current 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.

reportPInvariants

public java.lang.String reportPInvariants(int[] M)
Reports on the P invariants.

Parameters:
M - An array containing the current marking of the net.
Returns:
A string containing the resulting matrix of P Invariants, the P equations and some analysis

reportTInvariants

public java.lang.String reportTInvariants(int[] M)
Reports on the T invariants.

Parameters:
M - An array containing the current marking of the net.
Returns:
A string containing the resulting matrix of T Invariants and some analysis of it

findPEquations

public java.lang.String findPEquations(int[] currentMarking)
Find the P equations of the net.

Parameters:
currentMarking - An array containing the current marking of the net.
Returns:
A string containing the resulting P equations, empty string if the equations do not exist.

findVectors

public PNMatrix findVectors(PNMatrix 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.