Re: [eclipse-users] Finite set of possibilities in an underconstrained equation

From: Vivek Balaraman <vivek.balaraman_at_...6...>
Date: Wed, 8 Aug 2007 18:02:23 +0530
Joachim,
Thanks for the prompt response.

I am prototyping a model where the variables are design parameters.

I am trying where possible to deal entirely in the integer domain to reduce
computational load.

However, I may have to use real variables if that cannot be avoided.

In such a case, how do I go about labeling my variables without the search
space exploding?

Thanks

Vivek
On 8/8/07, Joachim Schimpf (Independent Contractor) <jschimpf_at_...5...>
wrote:
>
> Vivek Balaraman wrote:
> > Given an IC constraint
> >
> > A #= B * C
> > where
> > A #::[0..50],
> > B #::[0..5],
> > C#::[0..10]
> >
> > (var(A)->indomain(A);true),
> > (var(B)->indomain(B);true),
> > (var(C)->indomain(C);true).
>
> You don't need the var tests, and you can use labeling/1 instead of
> a sequence of indomains.
>
> >
> > When any two of A,B,C are grounded, then there is no problem. However,
> > there may be times when only one of these is grounded (say C has the
> > value 5. What we want is to be able to generate all possible solutions
> > by labeling the other two variables. However I get a type error when I
> > try to do so.
>
> What you describe just works:
>
> ?- A #:: [0..50], B #:: [0..5], C #:: [0..10], A #= B*C,
> labeling([A,B,C]).
> A = 0
> B = 0
> C = 0
> Yes (0.00s cpu, solution 1, maybe more)
>
> ...
>
> A = 50
> B = 5
> C = 10
> Yes (0.20s cpu, solution 66)
>
>
> If you still have a problem, show us your exact code.
>
>
> -- Joachim
>
> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users_at_...2...
> http://www.crosscoreop.com/mailman/options/eclipse-users
>
Received on Wed Aug 08 2007 - 13:32:32 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST