Multiple calls of ECLiPSe from C

From: Tallys Hoover Yunes <>
Date: Sun 15 Apr 2001 01:27:47 PM GMT
Message-ID: <>

   I'm writing an application in C that is going to call
   ECLiPSe to solve some FD constraints. I have 2 main

   1) I'll have to call ECLiPSe many times, but the contexts of
      the calls will be independent (different variables, different
      domains, different constraints, etc.). Do I need to call ec_init()
      and ec_cleanup() at the beginning and at the end of each
      interaction with ECLiPSe? Or is there another way of doing
      a kind of "cleanup" that does not shut the engine down?

      My concern here is to free all memory used by ECLiPSe during
      a round of constraint solving before going to the next round.

   2) Now suppose that I have a set of variables with their
      respective default initial domains. Also, suppose that these
      variables have to satisfy some constraints.

      I'll need to call ECLiPSe many times (let's call them rounds)
      and, at each time, the domains of the variables will be
      further restricted *in a different way* before constraint
      propagation takes place.

      For example:

        Let's call S0 the state of the system after the following
        constraints have been posted:

           [X,Y]::[1..5], X #>= Y.

        Then, at round 1 I need the following:

           Starting from S0 and adding X #<= 4, what are the
           final domains of X, Y after propagation?

        At round 2 I need:

           Starting from S0 and adding Y #>= 3, what are the
           final domains of X, Y after propagation?

        At round 3 I need:

           Starting from S0 and adding alldifferent([X,Y]),
           what are the final domains of X, Y after propagation?

        And so forth....

      That is, I always need to return to a fixed initial state.
      I'd like to do this as efficiently as possible.

      One way to do this is to work as if, in each round, the
      problems to be solved were totally independent (as in item
      1 above). Hence, I would have to post all the constraints
      every time I wanted to call ECLiPSe.

      Is there a way to "factor out" the initial posting of
      constraints and default domains? In other words, could
      I post the constraints and initial domains only once
      and, after that, at every new round, just add constraints
      to further restrict initial domains?

      Notice that here it would be important to have a way to
      reset the system to the state where we have the constraints
      and the default domains without having to post them again.

   Thank you.

Best regards,
Received on Sun Apr 15 14:29:43 2001

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