1
$\begingroup$

I am trying to implement a constraint as follows:

routing.solver().Add(capacity_dimension.CumulVar(idx) * routing.ActiveVar(idx) >= capacity_dimension.CumulVar(routing.End(v)) * 0.5 )

It gives error:

TypeError: unsupported operand type(s) for *: 'IntVar' and 'float'

How can I resolve this?

I tried capacity_dimension.CumulVar(routing.End(v)).Value() * 0.5 on RHS but this kills the kernel.

$\endgroup$
1

1 Answer 1

1
$\begingroup$

This is solved as follows:

2 * capacity_dimension.CumulVar(idx) * routing.ActiveVar(idx) >= capacity_dimension.CumulVar(routing.End(v))
$\endgroup$
2
  • 1
    $\begingroup$ Please do not ask the same question on 3 sites. These are the same persons who can answer on all sites $\endgroup$ Commented Dec 11, 2022 at 14:01
  • $\begingroup$ ok noted. Thanks for pointing it out. $\endgroup$
    – mufassir
    Commented Dec 11, 2022 at 14:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.