[gecode-users] fzn-gecode and float_lin_eq

Guido Tack tack at gecode.org
Wed Sep 17 01:48:15 CEST 2014


The constraint float_lin_eq is a linear constraint, i.e. you can't use it to multiply to float variables.  You have to use float_times instead, which has the following signature:

predicate float_times(var float: x, var float: y, var float: z)

and which posts the constraint z = x*y.

Cheers,
Guido

On 17 Sep 2014, at 7:49 am, Tommy Persson <tommy.persson at liu.se> wrote:

> Is float_lin_eq supposed to work with fzn-gecode?
> 
> I have tried a lot of varaints to get it to parse but have not found anything that works. My problem is:
> 
> /opt/gecode-4.3.0/bin/fzn-gecode camera.fzn
> Error: Type error: float literal expected
> 
> And the camera.fzn is:
> 
> 
> 
> 
> float: hfov = 0.7;
> float: vfov = 0.52;
> float: hfov2 = 0.35;
> float: vfov2 = 0.26;
> float: period = 0.1;
> 
> var float: speed :: output_var;
> var float: alt :: output_var;
> var float: hfov_tan;
> var float: vfov_tan;
> var float: max_speed;
> var float: h;
> array [1..1] of var float: a;
> array [1..1] of var float: b;
> 
> constraint float_eq(alt, 5.0);
> constraint float_eq(vfov_tan, 0.7);
> 
> %constraint float_eq(a[1], vfov_tan);
> %constraint float_eq(b[1], alt);
> constraint float_eq(a[1], 0.5);
> constraint float_eq(b[1], 6.0);
> constraint float_le(alt, 30.0);
> constraint float_le(5.0, alt);
> constraint float_le(speed, 15.0);
> constraint float_le(3.0, speed);
> constraint float_tan(hfov2, hfov_tan);
> constraint float_tan(vfov2, vfov_tan);
> constraint float_lin_eq(a, b, h);
> 
> solve satisfy;
> 
> --------
> 
> 
> What I want to do is multiply two floats.
> 
> /Tommy Persson
> Linköping University
> 
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users




More information about the users mailing list