Re: [eclipse-clp-users] Query

From: Marco Gavanelli <marco.gavanelli_at_...17...>
Date: Thu, 02 Jun 2011 15:39:13 +0200
On 02/06/11 08:22, nishant raj wrote:
> I have installed Eclipse 6.0 from http://eclipseclp.org/ and now i have a
> doubt
>
> For the Eclipse code which i have found on net and written below.. I have
> compiled it and that part is ok.
> now,
> 1. What will be its Querry. What to write in Querry. I wrote solve(0,6). but
> then instead of executing or saying no if its wrong argument...the program
> is hanging.

I tried it and it says:

	[eclipse 2]: solve(0,6).

	No (0.00s cpu)

what do you mean by "it hangs"?

You question on "what is the query" is like asking: how should I invoke 
this C (or Java, Pascal, whatever) function I downloaded from the net?

Well, it should be in the documentation of the code you downloaded. If 
it is not, then you should look at the code and try to understand what 
this code does.

Looking quickly at the code, I guess that:
Predicate data contains the input data.
Predicate model contains the constraint model.
Predicate optimize is predefined in the eplex library, so you can read 
the ECLiPSe documentation.
The final row prints the output.

So, it seems to me that Cost and Slots are output parameters in this 
code, so they should be variables:

[eclipse 3]: solve(Cost,Slots).
[](1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 
0, 0, 0)
[](0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 1)
[](0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 
0, 0, 0)
[](0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 
0, 0, 0)
[](0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 
1, 1, 0)
[](0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 
0, 0, 0)

Cost = 27.0
Slots = []([](1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 
0, 0, 0, 0, 0, 0, 0), [](0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 1), [](0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0), [](0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 
0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), [](0, 0, 0, 0, 0, 0, 1, 
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0), [](0, 0, 0, 1, 
0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0))
Yes (0.03s cpu)

> 2. Here suppose I want that instead of 6 slots there should be user defined
> slot and ser defined data for them....so how should i change its codes...

As far as I understand, the input data is in predicate data.
Change that predicate according to your instance.

Cheers,
Marco

-- 
Marco Gavanelli, Ph.D. in Computer Science
Dept of Engineering
University of Ferrara
Tel/Fax  +39-0532-97-4833
http://www.ing.unife.it/docenti/MarcoGavanelli/
Received on Thu Jun 02 2011 - 13:39:25 CEST

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST