1

I'm trying to use CP-SAT solver with some variables: x,y. I want to maximise an objective function of the form x**2-y*x with some constraints. I'm getting

TypeError: unsupported operand type(s) for ** or pow(): 'IntVar' and 'int'

error messages. Am I correct in assuming I cannot use nonlinear objective function for CP-SAT, as I couldn't find any documentation or examples that did employ nonlinear objectives? Or is there some way to do this?

etov
  • 2,972
  • 2
  • 22
  • 36
Joseph Doob
  • 163
  • 15

1 Answers1

3

You have to create an intermediate variable using AddMultiplicationEquality(x2, [x, x])

Stradivari
  • 2,626
  • 1
  • 9
  • 21