diff --git a/modeling/AVATAR/MicroWaveOven_SafetySecurity_fullMethodo.xml b/modeling/AVATAR/MicroWaveOven_SafetySecurity_fullMethodo.xml index 120a55c16f890ad8902c10922e7aec3694eea10e..88478a23c6cec072f7a62aa47dc53d15bb07d41f 100644 --- a/modeling/AVATAR/MicroWaveOven_SafetySecurity_fullMethodo.xml +++ b/modeling/AVATAR/MicroWaveOven_SafetySecurity_fullMethodo.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<TURTLEGMODELING version="0.99-beta4"> +<TURTLEGMODELING version="1.0beta"> <Modeling type="Avatar Methodology" nameTab="Methodology" > <AvatarMethodologyDiagramPanel name="AVATAR_Methodology" minX="10" maxX="1400" minY="10" maxY="900" zoom="1.0" > @@ -5281,7 +5281,7 @@ or by a maintenance station <MainCode value=""/> <MainCode value="}"/> <Optimized value="true" /> -<Validated value="" /> +<Validated value="ObserverProp1;RemotelyControlledMicrowave;RemoteControl;MicroWaveOven;Bell;ControlPanel;Controller;Magnetron;Door;WirelessInterface;" /> <Ignored value="" /> <CONNECTOR type="5002" id="2890" > @@ -10109,7 +10109,7 @@ or by a maintenance station <MainCode value=""/> <MainCode value="}"/> <Optimized value="true" /> -<Validated value="" /> +<Validated value="ObserverProp1;RemotelyControlledMicrowave;MicroWaveOven;Door;Magnetron;Controller;ControlPanel;Bell;" /> <Ignored value="" /> <CONNECTOR type="5002" id="4993" > diff --git a/src/main/java/ui/graph/AUTBlock.java b/src/main/java/ui/graph/AUTBlock.java index b76a1bdb424ea96fa4501d0d0380578bd6b03281..583de0e0c991ef4a4f33029e1492a668b0db1c93 100755 --- a/src/main/java/ui/graph/AUTBlock.java +++ b/src/main/java/ui/graph/AUTBlock.java @@ -66,6 +66,13 @@ public class AUTBlock implements Comparable<AUTBlock> { states.add(_st); } + public int getHashValue() { + if (!hashComputed) { + computeHash(); + } + return hashValue; + } + public String toString() { boolean first = true; diff --git a/src/main/java/ui/graph/AUTGraph.java b/src/main/java/ui/graph/AUTGraph.java index 326c6e11600468d0120f91ee06dbff2750df718e..d0a2e458c65eb877019813da76d9efd35205010d 100755 --- a/src/main/java/ui/graph/AUTGraph.java +++ b/src/main/java/ui/graph/AUTGraph.java @@ -40,7 +40,8 @@ package ui.graph; import myutil.Conversion; -import myutil.*; +import myutil.DijkstraState; +import myutil.GraphAlgorithms; import myutil.TraceManager; import java.io.BufferedReader; @@ -1088,14 +1089,21 @@ public class AUTGraph implements myutil.Graph { int maxIte = 1000; // With same nb of partitions int nbOfPartitions = w.size(); - int evolution = 10; + int evolution = 20; + int hashCode = -1; AUTPartition currentP; while ((w.size() > 0) && (maxIte > 0) && (evolution > 0)) { + + int newHash = w.getHashCode(); + if (newHash == hashCode) { + break; + } + if (w.size() == nbOfPartitions) { - evolution --; + evolution--; } else { - evolution = 10; + evolution = 20; } nbOfPartitions = w.size(); maxIte--; @@ -1258,7 +1266,7 @@ public class AUTGraph implements myutil.Graph { } } - //TraceManager.addDev("\nAll done:\n---------"); + TraceManager.addDev("\nAll done: it: " + maxIte + "\n---------"); //printConfiguration(partition, w); //TraceManager.addDev("------------------"); diff --git a/src/main/java/ui/graph/AUTPartition.java b/src/main/java/ui/graph/AUTPartition.java index 393ab58abf13a0a286e74e4367aed5687b9a7346..1494c55a275d9c566f5615d2e06fe51a549989b8 100755 --- a/src/main/java/ui/graph/AUTPartition.java +++ b/src/main/java/ui/graph/AUTPartition.java @@ -37,28 +37,28 @@ */ - - package ui.graph; import java.util.ArrayList; +import java.util.Arrays; import java.util.LinkedList; /** - * Class AUTPartition - * Creation : 06/01/2017 - ** @version 1.0 06/01/2017 - * @author Ludovic APVRILLE + * Class AUTPartition + * Creation : 06/01/2017 + * * @version 1.0 06/01/2017 + * + * @author Ludovic APVRILLE */ -public class AUTPartition { +public class AUTPartition { + - public ArrayList<AUTBlock> blocks; // Blocks are expected to be mutually exclusive // in terms of states they contain. public AUTPartition() { - blocks = new ArrayList<AUTBlock>(); + blocks = new ArrayList<AUTBlock>(); } public void addBlock(AUTBlock _bl) { @@ -66,43 +66,54 @@ public class AUTPartition { } public void addIfNonEmpty(AUTBlock _b) { - if (_b.size() > 0) { - addBlock(_b); - } + if (_b.size() > 0) { + addBlock(_b); + } } public String toString() { - StringBuffer sb = new StringBuffer(""); - for(AUTBlock block: blocks) { - sb.append("(" + block.toString() + ")"); - } - return sb.toString(); + StringBuffer sb = new StringBuffer(""); + for (AUTBlock block : blocks) { + sb.append("(" + block.toString() + ")"); + } + return sb.toString(); } // List of blocks that has a state that has an // output "elt" transition public LinkedList<AUTBlock> getI(AUTElement _elt, AUTBlock _b) { - LinkedList<AUTBlock> listI = new LinkedList<AUTBlock>(); - for(AUTBlock b: blocks) { - if (b.hasStateOf(_b)) { - listI.add(b); - } - } - return listI; + LinkedList<AUTBlock> listI = new LinkedList<AUTBlock>(); + for (AUTBlock b : blocks) { + if (b.hasStateOf(_b)) { + listI.add(b); + } + } + return listI; } public boolean removeBlock(AUTBlock _b) { - return blocks.remove(_b); + return blocks.remove(_b); } public AUTBlock getBlockWithState(int id) { - for(AUTBlock b: blocks) { - if (b.hasState(id)) { - return b; - } - } - return null; + for (AUTBlock b : blocks) { + if (b.hasState(id)) { + return b; + } + } + return null; + } + + public int getHashCode() { + int []values = new int[blocks.size()]; + int cpt = 0; + for(AUTBlock b: blocks) { + values[cpt] = b.getHashValue(); + cpt ++; + } + return Arrays.hashCode(values); + } diff --git a/src/main/java/ui/graph/AUTSplitter.java b/src/main/java/ui/graph/AUTSplitter.java index 16bd7f0e7eeda3509b7912e8362d2f5698076ff1..a2c9fe6fc2aabb547daba031e9de5b682f77b543 100755 --- a/src/main/java/ui/graph/AUTSplitter.java +++ b/src/main/java/ui/graph/AUTSplitter.java @@ -42,6 +42,7 @@ package ui.graph; import java.util.ArrayList; +import java.util.Arrays; /** * Class AUTSplitter @@ -74,5 +75,15 @@ public class AUTSplitter { return partitions.size(); } + public int getHashCode() { + int[] values = new int[partitions.size()]; + int cpt = 0; + for (AUTPartition p : partitions) { + values[cpt] = p.getHashCode(); + cpt++; + } + return Arrays.hashCode(values); + } + }