I am struggling with modeling so much, for me what is logical is not so in the model. The next thing is how to force the system to change results by changing the objective value, so let me explain.
I see we can only have one objective value and that is OK. So my guessing is that the system will try to Min (or Max) the value of the objective function by changing the variable(s), is that correct?
In my objective function I have 2 parts:
@variable(premex, PRODAMOUNT[op_k in keys(_ORDER_PRODUCTs_ALL), u_k in keys(UNITS), t in TIME], Int, lower_bound = 0)
@objective(
premex,
Min,
sum(
sum(
(
(
sum(
PRODAMOUNT[op_k, u_k, t]
for (op_k, op) in _ORDER_PRODUCTs_ALL
)
== 0 ? 0 : u["cap"]
) -
sum(
PRODAMOUNT[op_k, u_k, t] * _PRODUCTs_ALL[op["product"]]["bagSize"]
for (op_k, op) in _ORDER_PRODUCTs_ALL
)
) * u["util_cost1"]
for (u_k, u) in UNITS
)
+
sum(
sum(
PRODAMOUNT[op_k, u_k, t]
== 0 ? 0 :
(t > _ORDERs_ALL[op["order"]]["details"]["deadline"] ? (t - _ORDERs_ALL[op["order"]]["details"]["deadline"]) * 1000000 : 0)
for (op_k, op) in _ORDER_PRODUCTs_ALL
)
for (u_k, u) in UNITS
)
for t in TIME
)
)
as you can see outer loop is TIME, the first part of it is:
sum(
(
(
sum(
PRODAMOUNT[op_k, u_k, t]
for (op_k, op) in _ORDER_PRODUCTs_ALL
)
== 0 ? 0 : u["cap"]
) -
sum(
PRODAMOUNT[op_k, u_k, t] * _PRODUCTs_ALL[op["product"]]["bagSize"]
for (op_k, op) in _ORDER_PRODUCTs_ALL
)
) * u["util_cost1"]
for (u_k, u) in UNITS
)
This should force the minimum waste of machines’ capacity. After running with only this part the model is giving objective_value(premex) = 1.172286e6
The next part:
sum(
sum(
PRODAMOUNT[op_k, u_k, t]
== 0 ? 0 :
(t > _ORDERs_ALL[op["order"]]["details"]["deadline"] ? (t - _ORDERs_ALL[op["order"]]["details"]["deadline"]) * 1000000 : 0)
for (op_k, op) in _ORDER_PRODUCTs_ALL
)
for (u_k, u) in UNITS
)
Should force orders that have a deadline to move up (to be finished first). This I didn’t compose perfectly but it should work. And the objective_value(premex) = 6.4791172286e10 in this case.
As you can see the objective_value changes significantly, but the results remain the same.
I clearly said that if PRODAMOUNT[op_k, u_k, t] == 0 then the system will have no issues, but if not then the penalty should apply (if any). I think this is not enough for the system to recognize what to do to make no penalties.
In other words, how to force model to finish orders that have deadlines first?