Reputation: 67
I am newbie in CP but I want to solve problem which I got in college.
I have a Minizinc model which minimize number of used Machines doing some Tasks. Machines have some resource and Tasks have resource requirements. Except minimize that number, I am trying to minimize cost of allocating Tasks to Machine (I have an array with cost). Is there any chance to first minimize that number and then optimizate the cost in Minizinc?
For example, I have 3 Task and 2 Machines. Every Machine has enough resource to allocate 3 Task on them but I want to allocate Task where cost is lower.
Sorry for my English and thanks for help. If there is such a need I will paste my code.
Upvotes: 4
Views: 1179
Reputation: 5786
The technique that you are referring to is called lexicographic optimisation/objectives. The idea is to optimise for multiple objectives, where there is a clear ordering between the objectives. For example, when optimising (A, B, C)
we would optimise B
and C
, subject to A
. So if we can improve the value of A
then we would allow B
and C
to worsen. Similarly, C
is also optimised subject to B
.
This technique is often used, but is currently not (yet) natively supported in MiniZinc. There are however a few workarounds:
std/experimental.mzn
.Note that lexicographic techniques might not always (explicitly) talk about both minimisation and maximisation; however, you can always convert from one to the other by negating the intended objective value.
Upvotes: 8