Float objective with CP-SAT

41 views
Skip to first unread message

Yury Semenov

unread,
May 27, 2024, 5:56:26 AMMay 27
to MiniZinc
Hi,

I have a model with purely integer variables and constraints, and a linear objective function with float coefficients (such objective functions are supported by CP-SAT). When I try to solve the model, I get "CP-SAT does not support float variables" error. As far as I understand, this happens because minizinc creates an auxiliary float variable for the objective function. Is there any way to change this behavior and feed the model with float objective function to CP-SAT without creating float variables?

guido.tack

unread,
May 27, 2024, 7:47:27 PMMay 27
to MiniZinc
No, that's not possible within the MiniZinc architecture, since the objective is always passed to the solver in the form of a variable. The CP-SAT backend would have to detect that all the float variables in the model are only used to define the objective, which shouldn't be hard to do. As far as I understand, the CP-SAT solver scales floating point objectives to integers internally, so it may be easier to change your MiniZinc model to use coefficients that are scaled up to integers.

Cheers,
Guido

Yury Semenov

unread,
May 28, 2024, 1:26:26 AMMay 28
to MiniZinc
Thank you, I'll try it.

вторник, 28 мая 2024 г. в 02:47:27 UTC+3, guido.tack:

Max Ostrowski

unread,
May 28, 2024, 3:56:54 AMMay 28
to mini...@googlegroups.com

Just as a side remark, I think that there is some lost real estate here.
SAT based CP solvers could definitely benefit if they get a a weighted set of variables as input to their objective function.
It is much harder to undo this extra variable and it can hinder propagation.

Best,
Max

--
You received this message because you are subscribed to the Google Groups "MiniZinc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minizinc+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/minizinc/2b3323d4-9113-476f-8858-920eb9d98d37n%40googlegroups.com.

Laurent Perron

unread,
May 30, 2024, 10:43:34 PMMay 30
to mini...@googlegroups.com
For CP-SAT, this is equivalent as presolve expand the objective. 

Reply all
Reply to author
Forward
0 new messages