Re: [eclipse-clp-users] Data Passing from C++ to Eclipse

From: Vivek Balaraman <vivek.balaraman_at_...6...>
Date: Tue, 10 Jun 2008 16:50:24 +0530
Thanks Joachim.

Will try it out and get back.

Cheers

Vivek


On 6/10/08, Joachim Schimpf (Independent Contractor) <jschimpf_at_...5...>
wrote:
>
> Vivek Balaraman wrote:
> > Joachim,
> > Thanks for the information.
> >
> > My response to the last part of your mail
> >
> >
> > On 6/9/08, *Joachim Schimpf (Independent Contractor)*
> > <jschimpf_at_...5... <mailto:jschimpf_at_...5...>> wrote:
> >
> >
> >     How are you going to compute several solutions?  Are they computed
> one
> >     by one from scratch, or all in one go, or are alternative solutions
> >     produced on backtracking, etc?
> >
> >
> >
> > Our current code in eclipse calculates a solution, stores it in a store
> > and then calls fail causing it to backtrack and find other
> > solutions. Then either when all solutions or number of solutions > 50
> > used to send the solutions to the calling program one by one using the
> > write_exdr operations.
> >
> > something like
> >
> > calc_all_scenarios:-
> >
> >  (
> >
> >  calc_one_scenario ([Index, Solution]),
> >
> >  store_put(Store, Index,Solution),
> >
> >  Additionally also increment the count of solutions in a counter
> >
> >  fail
> >
> >  ;
> >
> >  Lookup counter to get number of solutions
> >
> > For all solutions, store_get(Store,I, Solution), write solution to queue
> >
> > ).
>
> Using the C/C++ interface, there is no need to use queues, you can read
> the store contents directly by posting store_get/3 goals, i.e.
>
>        EC_Ref solution;
>        int index = ...;
>        post_goal(term(EC_functor("store_get",3), "my_store_name", index,
> solution));
>        EC_resume();
>
>
>
> Another solution, which is possible with the C/C++ interface, is to have
> the
> fail-loop in C++.  In that scenario, you would initially post
> calc_one_scenario/1
> and resume.  When this succeeds and returns to C++, you have one solution
> and can
> process it in C++.  You then post a fail/0 and resume, and this will
> succeed with
> the next solution and return to C++, and so on.  No need to use stores.
> An example is in doc/examples/eg_cc_fail_loop.cc
>
>
> -- Joachim
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
>
Received on Tue Jun 10 2008 - 04:20:27 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST