[gecode-users] How to estimate the range of a (linear) function

Max Ostrowski ChaosAngel at gmx.de
Fri Jun 10 12:56:47 CEST 2011


Thanks a lot, it works wonderful now.



> The simplest option is to use the minimodel support for writing linear
> expressions, so in your case: instead of creating a variable y yourself,
> just set y to the variable that is returned by the expr function, that is,
> something like:
> 	IntVar y = expr(home, c+5*7-b);
> The expr function actually does infer tight bounds for the variables it
> returns (based on the domains of c and b in this example). If that does
> not
> fit your bill you might want to check how expr does it. Not that
> difficult,
> in fact.
> 
> The problem is that one should always keep in mind that the basic
> abstraction in CP are relations (constraints). Anything that involves
> expressions requires additional effort. That is one reason why the basic
> layer in Gecode talks about constraints only and has an additional layer
> of
> abstraction (minimodel) to deal with expressions.
> 
> Christian
> 
> --
> Christian Schulte, KTH, web.it.kth.se/~cschulte/
> 
> 
> -----Original Message-----
> From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
> Of Max Ostrowski
> Sent: Friday, June 10, 2011 10:42 AM
> To: users at gecode.org
> Subject: [gecode-users] How to estimate the range of a (linear) function
> 
> Hello everybody,
> 
> as i'm developing an SMT-like solver, i have a special syntax for the
> constraints of Gecode and i also have to handle things.
> 
> b(1..3).
> $count[a(X) $== c+5*7-b : b(X)] $> 0.
> 
> 
> This shall represent an count constraint constraint.
> count(x,y,>,0) where x is a set of variables (a(1),a(2),a(3)) and y is a
> single variable y=c+5*7-b.
> The domains of the variables a,b,c are known (usually an IntSet).
> I created a variable for "c+5*7-b" using the domain
> (Limits::min,Limits::max).
> I found out that this is not the best way to do it, as Gecode does not
> seem
> to automatically shrink the domain of y :-)
> 
> 
> Is there some functionality in Gecode for automatically/manually estimate
> the range of a function. (So if i add a and b, can't i just "add" the
> domain
> of them using the IntVarRanges?).
> And the same for multiplication etc...
> 
> Thanks in advance,
> 
> Max
> --
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie
> mit
> bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
> 
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
> 

-- 
NEU: FreePhone - kostenlos mobil telefonieren!			
Jetzt informieren: http://www.gmx.net/de/go/freephone



More information about the users mailing list