unification

From: Aleksandar Bakic <bakicale_at_cse.msu.edu>
Date: Sun 06 Dec 1998 08:25:05 PM GMT
Message-Id: <E0znlK3-0004PT-00@passion.icparc.ic.ac.uk>
Hi,

I have a predicate that unifies a list of logical (FD) variables with a
list of constants. Now, I want to break this unification down into
successive unifications of individual variables. (The reason is that I
want to do this from C++ in a dyncamically chosen order.) While the
original list unification takes a few tens of seconds, the successive
individual variable unifications take hours.

Here is the C++ code excerpt:

EC_functor unify = EC_functor("=", 2);
EC_refs Parameters(238);
EC_ref ParameterVars;
ParameterVars = list(Parameters);
long parametervals[238];

...

for (i = 0; i < 238; i++) // successive individual unifications, take
hours
  {
    post_goal(term(unify, Parameters[i], parametervals[i]));
    Result = (EC_status) EC_resume(Choice);
    if (Result == EC_fail)
      {
 cout << "Parameter " << i << " could not be unified" << endl;
 exit(1);
      }
    else
      {
 cout << "Assigned " << parametervals[i] << " to the " <<
      i << "-th parameter variable" << endl;
 Choice.cut_to(); // maybe unnecessary, but does not affect timing
      }
  }
//      // list unification, takes tens of seconds
//      post_goal(term(parameters, 1, ParameterVars));
//      EC_resume();

What am I doing wrong, i.e., why do the successive individual
unifications take so much time?

Thank you,
Aleksandar
-- 
Aleksandar Bakic, Comp.Sci. graduate student at Michigan State
University
e-mail: bakicale@cse.msu.edu
Received on Wed Dec 9 15:16:05 1998

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:04 PM GMT GMT