0

I am new to Cplex. I'm solving an integer programming problem, but I have a problem with objective function. Problem is that I have some project, that have a due date D, and if project is tardy, than I have a tardiness penalty b, so it looks like b*(cn-D). Where cn is a real complection time of a project, and it is decision variable.

It must look like this if (cn-D)>=0 then b*(cn-D)==0

I tried to use "if-then" constraint, but seems that it isn't working with decision variable. I looked on question similar to this, but but could not find solution. Please, help me define correct objective function.

A. Smith
  • 1
  • 1
  • `if (cn-D)>=0 then b*(cn-D)==0` seems strange. Usually tardiness is measured by inequalities: `tardiness >= CompletionTime - DueDate` where tardiness is a non-negative variable.. Assumption: we are minimizing tardiness. I would recommend to read some papers on scheduling models and see how others have modeled this. – Erwin Kalvelagen Apr 27 '18 at 15:14
  • But I actually want to minimize the total cost of the project, that is why I add penalty cost. But if CompletionTime < DueDate that mean that all equation is negative, and it makes total project cost lesser than it should be. That is why I wanted it to be positive if CompletionTime> DueDate, and zero if opposite. – A. Smith Apr 28 '18 at 15:42
  • How can a non-negative variable become negative? You must have discovered a bug in Cplex. – Erwin Kalvelagen Apr 28 '18 at 19:50
  • I think it is just I can't explain that clear enough. I try to say, that (ComplectionTime - DueDate) can either be positive, zero or negative, isn't it? And if I assume that DueDate is a assigned, the sign of the expression depend on ComplectionTime. If expression is positive or zero, it is okay for me, because if I multiply it on penalty = b, project cost will increase. But if expression become negative, that means that project cost will decrease if it finished before due date. – A. Smith Apr 28 '18 at 20:35

1 Answers1

1

The standard way to model this is:

min sum(i, penalty(i)*Tardy(i))
Tardy(i) >= CompletionTime(i) - DueDate(i)
Tardy(i) >= 0

Tardy is a non-negative variable and can never become negative. The other quantities are:

  • penalty: a constant indicating the cost associated with job i being tardy one unit of time.
  • CompletionTime: a variable that holds the completion time of job i
  • DueDate: a constant with the due date of job i.

The above measures the sum. Sometimes we also want to measure the count: the number of jobs that are tardy. This is to prevent many jobs being tardy. In the most general case one would have both the sum and the count in the objective with different weights or penalties.

There is a virtually unlimited number of papers showing MIP formulations on scheduling models that involve tardiness. Instead of reinventing the wheel, it may be useful to consult some of them and see what others have done to formulate this.

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39
  • Thank you so much for your answer! I thought that it should be done in other way, but your advice worked very good for my problem. – A. Smith Apr 29 '18 at 09:31