Jonathan Skovhus Andersen wrote:

> Hello,
> 
> I'm a beginner in Gecode, so there is something that I don't quite 
> understand. First of all I understand that Gecode only uses integers. But in 
> my implementation I have to use arcus tangent which gives me some problems. I 
> have to following line in my code:
> 
> for(int i = 0; i < p.size(); i++)
>                       rel(*this, angle[i] == 
> 180/3.1415*atan((sqrt(sqr(coordinatesArray[i][0]-x)+sqr(coordinatesArray[i][1]-y))/constantsArray[2][0])));
> 
> Which gives me the following error:
> 
> Error 12      error C2665: 'atan' : none of the 3 overloads could convert all 
> the argument types      ...source.cpp   107     TSP
> 
> Is there any way to work around this? I don't really have any ideas...

It's simply a type problem: sqrt returns a Gecode::LinExpr, but there's no atan 
function that would accept a LinExpr as an argument. The only way to work 
around this would be to add propagators for trigonometric functions to Gecode, 
which only really makes sense if you have floating point variables.

Cheers,
        Guido

-- 
Guido Tack, http://people.cs.kuleuven.be/~guido.tack/




_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to