[gecode-users] Gecode::IntVarBranch cannot be used as a function
Christian Schulte
cschulte at kth.se
Sun Apr 7 19:53:08 CEST 2013
Hi,
I guess you are reading MPG for Gecode 4.* while using a Gecode version 3.*.
Please make sure that the documentation and the Gecode version matches (MPG
says on the second page to which Gecode version it corresponds to; you can
find out the Gecode version you have installed by running any example with
-help on the commandline).
Best
Christian
--
Christian Schulte, www.ict.kth.se/~cschulte/
> -----Original Message-----
> From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On
> Behalf Of Gerloff Hendrik
> Sent: Wednesday, April 03, 2013 12:50 AM
> To: users at gecode.org
> Subject: [gecode-users] Gecode::IntVarBranch cannot be used as a function
>
> Hi,
>
> I tried to compile the example "Send More Money" from the pdf "Modeling
and
> Programming with Gecode", page 14.
>
> The compiler stops with following errors:
> In constructor 'SendMoreMoney::SendMoreMoney()':
> error: '(Gecode::IntVarBranch)10u' cannot be used as a function
> error: '(Gecode::IntValBranch)0u' cannot be used as a function
>
> The line causing the error is (you can find the complete code at the end
of this
> mail):
> branch(*this, l, INT_VAR_SIZE_MIN(), INT_VAL_MIN()); // defined in set.hh
>
> As far as I know this kind of error occurs when you use a variable with
the same
> name as the function, but there is no variable with this name. Searching
with
> google didn't show any useful results so I am asking here for help.
>
> I'm using qtcreator on ubuntu 12.04.
>
> Greets
>
>
> Example from the book:
>
> #include <gecode/int.hh>
> #include <gecode/gist.hh>
>
> using namespace Gecode;
>
> class SendMoreMoney : public Space {
> protected:
> IntVarArray l;
> public:
> SendMoreMoney(void) : l(*this, 8, 0, 9) {
> IntVar s(l[0]), e(l[1]), n(l[2]), d(l[3]),
> m(l[4]), o(l[5]), r(l[6]), y(l[7]);
> rel(*this, s, IRT_NQ, 0);
> rel(*this, m, IRT_NQ, 0);
> distinct(*this, l);
> IntArgs c(4+4+5); IntVarArgs x(4+4+5);
> c[0]=1000; c[1]=100; c[2]=10; c[3]=1;
> x[0]=s; x[1]=e; x[2]=n; x[3]=d;
> c[4]=1000; c[5]=100; c[6]=10; c[7]=1;
> x[4]=m; x[5]=o; x[6]=r; x[7]=e;
> c[8]=-10000; c[9]=-1000; c[10]=-100; c[11]=-10; c[12]=-1;
> x[8]=m; x[9]=o; x[10]=n; x[11]=e; x[12]=y;
> linear(*this, c, x, IRT_EQ, 0);
> branch(*this, l, INT_VAR_SIZE_MIN(), INT_VAL_MIN());
> }
> SendMoreMoney(bool share, SendMoreMoney& s) : Space(share, s) {
> l.update(*this, share, s.l);
> }
> virtual Space* copy(bool share) {
> return new SendMoreMoney(share,*this);
> }
> void print(void) const {
> std::cout << l << std::endl;
> }
> };
>
> int main(int argc, char* argv[]) {
> SendMoreMoney* m = new SendMoreMoney;
> Gist::dfs(m);
> delete m;
> return 0;
> }
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
More information about the users
mailing list