org.jbpt.petri.unfolding.SoundUnfolding Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbpt-petri Show documentation
Show all versions of jbpt-petri Show documentation
The jBPT code library is a compendium of technologies that support research on design, execution, and evaluation of business processes.
The newest version!
package org.jbpt.petri.unfolding;
/**
* Unfolding for soundness checks
*
* Proof of concept - must be improved
*
* @author Artem Polyvyanyy
*/
public class SoundUnfolding extends AbstractProperCompletePrefixUnfolding {
/*private Set unsafe = null;
private Set deadlock = null;
protected static DirectedGraphAlgorithms dga = new DirectedGraphAlgorithms();
protected SoundUnfolding() {}
public SoundUnfolding(NetSystem sys) {
if (!PetriNet.STRUCTURAL_CHECKS.isFreeChoice(sys)) throw new IllegalArgumentException("Net must be free choice!");
if (!PetriNet.STRUCTURAL_CHECKS.isWorkflowNet(sys)) throw new IllegalArgumentException("Net must be a WF-net!");
if (dga.isAcyclic(sys)) throw new IllegalArgumentException("Net must be acyclic!");
this.sys = sys;
this.initialBranchingProcess = new Cut(this.sys);
this.totalOrderTs = new ArrayList(this.sys.getTransitions());
BranchingProcessSetup setup = new BranchingProcessSetup();
setup.ADEQUATE_ORDER = new UnfoldingAdequateOrder();
setup.MAX_BOUND = Integer.MAX_VALUE;
setup.MAX_EVENTS = Integer.MAX_VALUE;
this.setup = setup;
this.construct();
}
*//**
* Get locally unsafe conditions
* @return set of locally unsafe conditions
*//*
public Set getLocallyUnsafeConditions() {
if (this.unsafe == null) {
this.unsafe = new HashSet();
for (Condition c1 : this.getConditions()) {
for (Condition c2 : this.getConditions()) {
if (c1.equals(c2)) continue;
if (this.areConcurrent(c1,c2) && c1.getPlace().equals(c2.getPlace()))
this.unsafe.add(c1);
}
}
}
return this.unsafe;
}
*//**
* Get local deadlock conditions
* @return set of local deadlock conditions
*//*
public Set getLocalDeadlockConditions() {
if (this.deadlock == null) {
this.deadlock = new HashSet();
OccurrenceNet BP = this.getOccurrenceNet();
for (Place p : BP.getPlaces()) {
if (BP.getPostset(p).isEmpty() && !this.sys.getPostset(BP.getCondition(p).getPlace()).isEmpty()) {
this.deadlock.add(BP.getCondition(p));
}
}
for (Place p : BP.getPlaces()) {
for (Transition t : BP.getPostset(p)){
for (Place p1 : BP.getPreset(t)) {
if (p.equals(p1)) continue;
for (Place p2 : BP.getSinkPlaces()) {
if (BP.getOrderingRelation(p,p2)==OrderingRelationType.CONFLICT && BP.getOrderingRelation(p1,p2)==OrderingRelationType.CONCURRENT) {
this.deadlock.add(BP.getCondition(p));
}
}
}
}
}
}
return this.deadlock;
}
*//**
* Check if the net is sound
* @return true if originative net is sound; otherwise false
*//*
public boolean isSound() {
return this.getLocallyUnsafeConditions().size()==0 && this.getLocalDeadlockConditions().size()==0;
}*/
}