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

From: Warwick Harvey <wh_at_...2...>
Date: Thu, 9 Aug 2007 10:03:41 +0100
Hi Vivek,

I suggest you try reading some of the ECLiPSe tutorial introduction:

http://eclipse.crosscoreop.com/doc/tutorial/tutorial.html

In particular, the chapters:

 * Getting started with Interval Constraints
 * Working with real numbers and variables 

That should answer many of your questions.

Cheers,
Warwick

On Thu, Aug 09, 2007 at 02:10:01PM +0530, Vivek Balaraman wrote:
> Hi,
> Want to tag on another question to my first, viz.,
> 
> i.e. given an equation with say 3 variables and 2 of the variables are not
> ground then I need to generate all possible solutions and where one or more
> variables may be real. At the same time I want to avoid an explosion of
> solutions.
> 
> What should be my labeling or solution finding strategy to achieve this?
> 
> Thanks
> 
> Vivek Balaraman
> 
> 
> On 8/8/07, Joachim Schimpf (Independent Contractor) <jschimpf@...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@...2...
> > http://www.crosscoreop.com/mailman/options/eclipse-users
> >

> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users@...2...
> http://www.crosscoreop.com/mailman/options/eclipse-users


-- 
!umop apisdn papuadsns w,I - aW dlaH aseald
Received on Thu Aug 09 2007 - 10:03:42 CEST

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