soft constraints since 2.7 ?

25 views
Skip to first unread message

greg mele

unread,
Jan 30, 2026, 6:04:15 PM (10 days ago) Jan 30
to MiniZinc
Hi there
copilot has pointed me to the key words soft and penalty (avail since 2.7)  and some minimal code

 var 0..10: x;
% Hard constraint
constraint x >= 3;
% Soft constraint with default penalty = 1
soft (x <= 5);
% Soft constraint with explicit penalty
soft (x != 7) penalty 10;
% Tell MiniZinc to minimise total penalty from soft constraints
solve minimize 0;

output ["x = \(x)\n"];

i can find no documentation
i am on windows and Minizinc IDE 2.9.5
the flatzinc converter is 2.9.5 as well.

many thanks
Greg





guido.tack

unread,
Feb 2, 2026, 6:41:30 PM (7 days ago) Feb 2
to MiniZinc
Hi,

While this would be nice to have I’m afraid copilot hallucinated that syntax. This has never been part of MiniZinc.

Cheers,
Guido

greg mele

unread,
Feb 2, 2026, 8:27:23 PM (7 days ago) Feb 2
to mini...@googlegroups.com
thank you. 



--
You received this message because you are subscribed to a topic in the Google Groups "MiniZinc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/minizinc/FrRm2RQLuBg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to minizinc+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/minizinc/0fe97af5-275c-401b-9d6f-8787bc50d806n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages