hello,

I am trying to solve the following model in CPLEX, however, I am having in trouble in the part where I want to find min or max of a set. So I have a set of completion times for order i as C[i][j] = {2,3,5} and I want to get max (C_late) which is 5 and min (C_early) which is 2. And then I wand to minimize the difference between them. I think I need to use big M method however I am not sure why its not working.

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 boolean z[Order][Job];
dvar int+ C_late[Order];
dvar int+ C_early[Order];
dvar int FTW[Order];
dvar int CD;
dvar int+ y [Machine][Position];
dvar int+ C[Order][Job];
dvar int Cmax;

minimize 
sum(i in Order) (C_late[i] - C_early[i]);

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_early[i] <= C[i][j];

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

}

and here is sample data set:

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]],
            ];

So is it possible to minimize function like this?

asked 13 Oct '15, 17:54

HD_1's gravatar image

HD_1
111
accept rate: 0%

Your approach to C_early and C_late is correct. What do you mean by "not working"?

(15 Oct '15, 15:35) Paul Rubin ♦♦

When I run the model, it will change the variable C[i][j] to wrong values just to minimize objective function to 0

(15 Oct '15, 18:25) HD_1
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×191
×65
×56

Asked: 13 Oct '15, 17:54

Seen: 901 times

Last updated: 16 Oct '15, 13:51

OR-Exchange! Your site for questions, answers, and announcements about operations research.