Which version you're using ? here is an example that show work:
------------------- :- module(_,_).
:- use_package(clpq).
test(A,B,C) :- clp_meta([A.>.B]), clp_meta([B.>.C]). --------------------
?- test(A,B,C).
B.>.C, B.<.A ?
On Tue, Jun 10, 2008 at 8:12 PM, Hannes Strass <hannes.strass(a)alumnos.upm.es> wrote:
Hi Samir,
many thanks for the quick reply.
However, my Ciao complains that "clp_meta/1" is undefined, both for clpq and clpr. Do I have to include any more libraries? I also did not find any mention of "clp_meta" via grep anywhere in the ciao directory. I have Ciao Prolog 1.10 #8.
Best regards, Hannes.
2008/6/10 Samir Genaim <genaim(a)gmail.com>:
Hi Hannes,
The solution you sent does not work since in ciao a compile time transformation is applied on constraints when they appear as atoms. In order to post clpq/r constraints dynamically you can use the predicate clp_meta/1, e.g
?- clp_meta([A .>. B, B .>. C]).Regards,
-- Samir
---------- Forwarded message ---------- From: "Hannes Strass" <hannes.strass(a)alumnos.upm.es> To: ciao-users(a)clip.dia.fi.upm.es Date: Tue, 10 Jun 2008 10:50:32 +0200 Subject: mime-version:content-type:content-transfer-encoding
Hi,
I am working on a problem where I automatically create a linear programming problem that I want Ciao to solve (via clpr or clpq). The problem is represented as a list of inequations that I translate to constraints at runtime.
Now posting a constraint as simple as "A .<. B + C" fails when created on-line, while the hard-coded variant works perfectly. I thus assume that clpr/clpq do not lack the capacity to solve it, it is just the way it is posted.
Here is an example: Giving the list of "constraints"
% [ leq(0, A), leq(A, 1), leq(A, B+C), flt(A), flt(B), flt(C) ] %
to the predicate
% post_constraints([], V) :- write('Solution:'), nl, write(V). post_constraints([ flt(E) | T], V) :- flt(E), post_constraints(T, V). post_constraints([ leq(L, R) | T], V) :- L .=<. R, post_constraints(T, V). %
results in failure.
Any ideas how to resolve this?
Thanks, Hannes Strass.
============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list
<whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list
Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/
--
Manuel Hermenegildo | Prof., C.S. Department Director, IMDEA-Software and CLIP Group | T.U. of Madrid (UPM) http://www.cliplab.org/herme | +34-91-336-7435 (W) -352-4819 (Fax)
-- Samir