Re: [eclipse-users] A problem constraining sets of real numbers

From: Kish Shen <kisshen_at_...5...>
Date: Wed, 26 Sep 2007 04:04:08 +0100
Hi VicenÁ,

The first point is that you really should consider if you want to model 
your problem using discret real values.

Joachim posted the following comment to a similar question on 
comp.lang.prolog a couple of months ago:

 >You should certainly consider whether this is a good way to
 >model your problem.  If there is a choice between discrete
 >values, it might be better to have an integer variable
 >representing the choices, and have a constraint that maps
 >this decision variable to a real-valued variable.  One
 >reason would be that search strategies are easier to
 >formulate with integer variables, or the model might then
 >be amenable to a MIP solver, etc.

VicenÁ wrote:
> 1.- Why the domain of Z has not been reduced? What can I do to propagate 
> the constraint?
While you can constrained an ic variable to take up certain real values 
only, you cannot  change the  representation of the domain, which is 
still an interval that cannot have holes in it.
> 2.- How can I force the instantiation of all the variables? If I use 
> labeling([X,Y,Z]), I got the type error:
> type error in indomain(X{1.0 .. 3.0})
> many thanks,
labeling and other such predicates are for integer domain only. What you 
have is a real interval with additional constraints on the values the 
variable can take within that interval. You still need to use the ic 
predicates for refining real domains, i.e. lodaqte/2,3,4 or squash/3, e.g.

?- (X $= 1.0 ; X $= 2.0) infers ic, locate([X], 0.001).
X = 1.0__1.0
Yes (0.00s cpu, solution 1, maybe more)
X = 2.0__2.0
Yes (0.02s cpu, solution 2)

You will need to convert the bounded real into your original floats. So, 
again, consider if set of real values are the best way to model your 



>    VicenÁ
> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users_at_...2...
Received on Wed Sep 26 2007 - 04:04:31 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 22 2019 - 06:14:48 CEST