[Gecode] Problem with operator== for views, equality vs. aliasing.

Christian Schulte schulte at imit.kth.se
Thu May 26 15:15:53 CEST 2005


Hi,

the code is of course complete rubbish as Mikael points out correctly. What
I never really understood is what "==" is supposed to mean. What I had in
mind is that it means aliasing: two views refer to the same variable. This
is of course important in many cases, however here clearly it means
"identical". So what we should do is the following:

x == y <=> the two views need to be of the same kind and are identical (same
var, same constants, etc)

x aliases y <=> the two views of whatever type depend on the same variable

Another relation on views is x < y: the variable associated with view x is
less (wrt to some order on variables) than the variable associated with y.

So what needs to be done:
 - replace "==" to mean identity 
 - introduce something for "aliases". How about "&" (along the lines that
two views have something in common). Or just "aliases" textually.

Christian

--
Christian Schulte, http://www.imit.kth.se/~schulte/ 

-----Original Message-----
From: gecode-bounces at ps.uni-sb.de [mailto:gecode-bounces at ps.uni-sb.de] On
Behalf Of Mikael 'Zayenz' Lagerkvist
Sent: Thursday, May 26, 2005 11:29 AM
To: Technical discussions about Gecode
Subject: [Gecode] Problem with operator== for views, equality vs. aliasing.


Hi,

I recently found that there is a problem with the equality-operators for
views in Gecode. The operators are defined to handle aliasing, that is, the
operation checks for usage of the same base variable.

However, the usage is (at least in some places), based on operator== testing
semantic equality.  As an example, take
Int::Rel::Le<View>::post(...) from int/rel/lq-le.icc, lines 95-103:

	template <class View>
	ExecStatus
	Le<View>::post(Space* home, View x0, View x1) {
	  if (x0 != x1) {
	    (void) new (home) Le<View>(home,x0,x1);
	    return ES_OK;
	  }
	  return ES_FAILED;
	}

Consider this when invoked using two scale-views representing 3*x and 5*x.
Then the invocation will erroneously fail.


So, what should the equality-operator mean, and what do we call the other
operation?


Regards,
Mikael

--
Mikael 'Zayenz' Lagerkvist, http://www.imit.kth.se/~zayenz/
_______________________________________________
Gecode mailing list
Gecode at ps.uni-sb.de http://www.ps.uni-sb.de/mailman/listinfo/gecode





More information about the gecode-users mailing list