howto define relation a > b+c (C ++ interface)

20 views
Skip to first unread message

Omer Brandis

unread,
Sep 29, 2022, 7:13:57 AM9/29/22
to Gecode
hello Group, 

(I'm new to gecode and contraint programming , so please be gentle )

I'm wish to define the following constraint :
Gecode::IntVar     a,b;
a > b+ extrnalConstant.

but was not able to find a suitable  Gecode::rel  overload.

Gecode::rel(*this, a, Gecode::IRT_GR, b + 13) does not compile, ...

Thanks,
:-)
Omer.




thanks,
Omer.


Omer Brandis

unread,
Sep 29, 2022, 7:30:46 AM9/29/22
to Gecode
by adding  #include <gecode/driver.hh>  I was able to use the following format :
Gecode::rel(*this, a > b + myConstant);

:-)
Omer


Mikael Zayenz Lagerkvist

unread,
Sep 29, 2022, 7:34:16 AM9/29/22
to gec...@googlegroups.com
hi,

You can use the modelling support to write out the whole expression.
See for example the expressions in the send more money example:
https://github.com/Gecode/gecode/blob/release/6.3.0/examples/money.cpp#L79

Cheers,
Mikael
> --
> You received this message because you are subscribed to the Google Groups "Gecode" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gecode+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/gecode/1d3bc847-f162-478b-9fb5-47291f4c8aafn%40googlegroups.com.



--
Mikael Zayenz Lagerkvist
Reply all
Reply to author
Forward
0 new messages