Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] "temporaryDomain=null" bug

Hi,

In think I understand the problem, however I still have trouble fixing it:
The fixed variable was evaluated which reduced the temporary domains of the other slots.
The other slots where cleared after one of their instanciations failed (which also removed the temporary domain). The problem is that it also removed the restrictions of the fixed domain slot and the reinitialization of the other slots was completly free to assign any value to the domain slot.

The fix should be to distinguish between resetting the domain slots after a full graph match (including the temporary domain) and keeping the temporary domain during backtracking. However if I apply the patch, the CombBenchmark runs into its infinite loop again. I attached the patch which should have fixed the problem. Maybe someone else can have a look.

The basic goal is: Keep the temporary domain during backtracking, delete the temporary domain after you are done with the variables of a graph.

Cheers,
Enrico

On 13.06.2012 14:19, Christian Krause wrote:
Hi Enrico,

I think I know what is going on. It seems like that partial matches (or "prematches") are destroyed by the "temporaryDomain=null". I attached an example where this occurs (execute it in the java2statemachine folder). If you enable the "temporaryDomain=null" you will get for every partial match always the set of *all* matches, which should not be the case (compare with the version without "temporaryDomain=null"). Can you fix this?

Cheers,
Christian


_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev
### Eclipse Workspace Patch 1.0
#P org.eclipse.emf.henshin.interpreter
Index: src/org/eclipse/emf/henshin/interpreter/matching/constraints/DomainSlot.java
===================================================================
--- src/org/eclipse/emf/henshin/interpreter/matching/constraints/DomainSlot.java	(revision 1583)
+++ src/org/eclipse/emf/henshin/interpreter/matching/constraints/DomainSlot.java	(working copy)
@@ -248,6 +248,7 @@
 			checkedVariables.remove(sender);
 		}
 		
+		
 		return false;
 	}
 	
@@ -263,15 +264,22 @@
 		unlock(sender);
 		
 		if (sender == owner) {
-			initialized = false;
-			
+			initialized = false;			
+			remoteChangeMap = new HashMap<BinaryConstraint, DomainChange>();
 			owner = null;
 			value = null;
 			domain = null;
-			remoteChangeMap = new HashMap<BinaryConstraint, DomainChange>();
 		}
 	}
 	
+	public void reset(Variable sender) {
+		clear(sender);
+		
+		if (sender == owner) {
+			temporaryDomain = null;
+		}
+	}
+	
 	/**
 	 * Checks whether the domain contains additional possible objects that may
 	 * be valid for a match.
Index: src/org/eclipse/emf/henshin/interpreter/matching/conditions/ApplicationCondition.java
===================================================================
--- src/org/eclipse/emf/henshin/interpreter/matching/conditions/ApplicationCondition.java	(revision 1583)
+++ src/org/eclipse/emf/henshin/interpreter/matching/conditions/ApplicationCondition.java	(working copy)
@@ -98,7 +98,7 @@
 	
 	private void resetVariables() {
 		for (Variable var : variables) {
-			domainMap.get(var).clear(var);
+			domainMap.get(var).reset(var);
 		}
 	}
 	

Back to the top