0

I building a mixed integer programming model, and I want to define the minimum and mzximum of a decision variable.

for example lets say the C={19, 20, 30}

I want to define C_early as 19 and C_late as 30. Then I want to minimize the difference. The C_late part was defined successfully using auxiliary constraints, however, I think I am missing something for the min part.

here is my code:

int I=...;
int J=...;
int K=...; 
int T=...;

range Order = 1..I;
range Job = 1..J;
range Machine=1..K;
range Position = 1..T;

int p[Order][Job]=...;
int a[Order][Job][Machine]=...;


dvar boolean x[Order][Job][Machine][Position];
dvar int C_late[Order];
dvar int C_early[Order];
dvar int diff[Order];
dvar int+ y [Machine][Position];
dvar int+ C[Order][Job];
dvar int Cmax;


minimize 
Cmax;

subject to{
// Ensure that a job is scheduled on one position only
forall(i in Order, j in Job: p[i][j]>0) sum(t in Position, m in Machine) 
x[i][j][m][t] == 1;

forall(m in Machine, t in Position) sum(i in Order, j in Job: p[i][j]>0)
x[i][j][m][t] <= 1;  

forall(i in Order, j in Job: p[i][j]>0 , m in Machine, t in Position)
   x[i][j][m][t] - a[i][j][m] <= 0;

forall (m in Machine)
y[m][1] >= sum(i in Order, j in Job) p[i][j]*x[i][j][m][1];

forall(m in Machine, t in Position: t>=2)
y[m][t] >= y[m][t-1] + sum(i in Order, j in Job) p[i][j]*x[i][j][m][t];

forall(i in Order, j in Job: p[i][j]>0, m in Machine, t in Position) 
C[i][j] >= y[m][t] - 100000*(1 - x[i][j][m][t]);

forall(m in Machine) 
sum(i in Order, j in Job, t in Position) p[i][j]*x[i][j][m][t] - Cmax <= 0;

forall(i in Order, j in Job: p[i][j]>0)
C[i][j] >= C_early[i];

forall(i in Order, j in Job: p[i][j]>0)
C[i][j] <= C_late[i];

forall (i in Order)
C_late[i] - C_early[i] <= diff[i]
}

Last three constraints are related to my question.

Example on dataset:

J=3;
K=3;
T=10;
I=10;

p= [
        [15,0,0], 
        [14,0,0],
        [16,0,0],
        [15,0,0],
        [14,0,0],
        [16,0,0],
        [16,0,0],
        [14,0,0],
        [15,0,0],
        [17,16,14]
            ];

a = [
        [[1,1,1], [0,0,0], [0,0,0]], 
        [[0,1,1], [0,0,0], [0,0,0]],
        [[1,1,1], [0,0,0], [0,0,0]],
        [[1,0,1], [0,0,0], [0,0,0]],
        [[0,1,1], [0,0,0], [0,0,0]],
        [[1,1,1], [0,0,0], [0,0,0]],
        [[0,1,1], [0,0,0], [0,0,0]],
        [[0,1,1], [0,0,0], [0,0,0]],
        [[1,1,1], [0,0,0], [0,0,0]],
        [[1,1,1], [1,1,1], [1,0,1]],
            ]; 

I know that I have to use big m method for the min constraint, however, I am not sure how Thanks,

4
  • What values are you getting for C_early and C_late for some example small problem instances? Commented Oct 7, 2015 at 13:40
  • @H.D Please give a vote or a comment. Commented Oct 8, 2015 at 17:17
  • I get the right values when I try to minimize Cmax, however, when I try to minimize this : (sum i in Order) diff[i] --> C_late and C_early will be equal. I think I need to apply big m method for the C_early constraint, however, I dont know how Commented Oct 8, 2015 at 22:41
  • Then add a small test data set that reproduces the problem. Commented Oct 9, 2015 at 7:02

1 Answer 1

0

You only minimize Cmax, not diff. This is probably an error.

Sign up to request clarification or add additional context in comments.

1 Comment

Cmax is an objective I used to test the model, I frogot to put the new one which is: (sum i in Order) diff[i]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.