# Maximization in objective MILP

• 6 replies
• 153 views

• Enthusiast
• 6 replies

Hello,

In my model, I want to include the following function in the objective: [sum[p, x(a,p,t) * (M(a,p) - 1)] - w(a,t) + - h(a) - i,0]]^+ (where M(a,p), h(a) and i are parameters and x(a,p,t) and w(a,t) are variables), thus: we want to get the maximum of sum[p, x(a,p,t) * (M(a,p) - 1)] - w(a,t) + - h(a) - i,0] and 0.

But, I am dealing with a linear model. Is there maybe a modeling trick that I can use in order to rewrite this part of the objective (so a function that gives the maximum of another function and 0) in a linear part? I hope you can help me.

### 6 replies

Userlevel 5 +4

Hi @Anne2 I am afraid that your question is not entirely clear. Why is there a ",0" part in the sum:

sum[p, x(a,p,t) * (M(a,p) - 1)] - w(a,t) + - h(a) - i,0]  ?

Do you want to model something like:

vnew(a,t) = max( sum[p, x(a,p,t) * (M(a,p) - 1)] - w(a,t) - h(a) - i], 0 )

and then use sum( (a,t), vnew(a,t) ) in the objective?

What is the optimization direction of the math program: minimization or maximization?

I would indeed like what you have in your vnew construction. So, vnew is 0 if the sum gives a negative value and vnew is the value of the sum if this is positive.The optimization direction of the math program is minimization. I hope my question is clear now :)

Userlevel 5 +4

If you are minimizing then it suffices to add the following two constraints:

vnew(a,t) >= sum[p, x(a,p,t) * (M(a,p) - 1)] - w(a,t) - h(a) - i]

vnew(a,t) >= 0

with sum( (a,t), vnew(a,t) ) added to the objective. (You only need to add the first constraint if you define vnew as a nonnegative variable.)

Dear Marcel,

Thank you for the reply. Unfortunately, it does not work. AIMMS gives that after zero iterations an integer solution to this problem does not exist (I think since vnew takes a negative value in all circumstances, which is good, since that is what I want to achieve, but then the value in the objective for vnew should take 0, instead of an infeasible solution..). I hope you can help me!

Userlevel 5 +4

Adding the variable vnew plus the two constraints cannot induce an infeasibility (because CPLEX can just increase vnew indefinitely to make these two constraints feasible) so it seems to me that the infeasibility is caused by something else. To find the cause of the infeasibility you should switch on the Solvers General option 'Infeasibility Finder’ and solve the model. AIMMS will then print an irreducible infeasibility set in the listing file (in the log folder) which you should analyze to find the cause.

I missed the 'i’ inside the sum. Is that an index? If so then vnew(a,t) should become vnew(a,t,i). (This will not resolve the infeasibility.)

Ah, I have implemented it in the wrong way. I now see what you meant. Thanks a lot!