[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] var between 2 parameters
From: |
Mate Hegyhati |
Subject: |
Re: [Help-glpk] var between 2 parameters |
Date: |
Wed, 08 Aug 2012 20:01:29 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
Dear Paolo,
I didn't go through all the details of Your model, but understand Your
idea. The issue that I wrote about is not a problem in Your case then,
You don't really need exactly what You asked.
I think if You have let's say 3 breaks, the easiest way is to introduce
a binary variable, whether a task is in the 1st, .... 4th interval.
sum of these for a task should be 1.
You should also add constraints, that stargint time of the task should
be at least the beginning of the interval and at most the ending -
duration, and both of these should be relaxed by the aforementioned
binary variable.
You can also add some tightening constraints, such as if task1 is in
"slot2", and it followed by task2, then task2 can not take place in
"slot1", etc.
Best regards,
Mate
On 08/08/2012 07:29 PM, Paolo Tofoni wrote:
> Dear Mate,
> thanks a lot for your help, really I'm try to consider in the
> following job shop model:
>
> /* Data Table 1. Tasks consist of Job, Machine, Dur data*/
> set TASKS dimen 2;
> param dur{TASKS};
> /* Data Table 2 */
> set TASKORDER within {TASKS,TASKS};
> /* JOBS and MACHINES are inferred from the data tables*/
> set JOBS := setof {(j,m) in TASKS} j;
> set MACHINES := setof {(j,m) in TASKS} m;
> /* Decision variables are start times for tasks, and the makespan */
> var start{TASKS} >= 0;
> var makespan >= 0;
>
> /* BigM is set to be bigger than largest possible makespan */
> param BigM := 1 + sum {(i,m) in TASKS} dur[i,m];
>
> /* The primary objective is to minimize makespan, with a secondary
> objective of starting tasks as early as possible */
> minimize OBJ: BigM*makespan + sum{(i,m) in TASKS} start[i,m];
>
> /* By definition, all jobs must be completed within the makespan */
> s.t. A {(j,m) in TASKS}: start[j,m] + dur[j,m] <= makespan;
>
> /* Must satisfy any orderings that were given for the tasks. */
> s.t. B {(i,m,j,n) in TASKORDER}: start[i,m] + dur[i,m] <= start[j,n];
>
> /* Eliminate conflicts if tasks are require the same machine */
> /* y[i,m,j] = 1 if Job i is scheduled before job j on machine m*/
>
> var y{(i,m) in TASKS,(j,m) in TASKS: i < j} binary;
>
> s.t. C {(i,m) in TASKS,(j,m) in TASKS: i < j}:
> start[i,m] + dur[i,m] <= start[j,m]+ BigM*(1-y[i,m,j]);
>
> s.t. D {(i,m) in TASKS,(j,m) in TASKS: i < j}:
> start[j,m] + dur[j,m] <= start[i,m] + BigM*y[i,m,j];
>
> solve;
>
> printf "\n\nMakespan = %5.2f\n",makespan;
>
> /* Post solution, compute finish times for each task to use in report */
> param finish{(j,m) in TASKS} := start[j,m] + dur[j,m];
>
> /* Task Summary Report */
> printf "\n TASK SUMMARY\n";
> printf "\n JOB MACHINE Dur Start Finish\n";
> printf {(i,m) in TASKS} "%8s %8s %5.2f %5.2f %5.2f\n",
> i, m, dur[i,m], start[i,m], finish[i,m];
>
> /* Schedule of activities for each job */
> set M{j in JOBS} := setof {(j,m) in TASKS} m;
> param r{j in JOBS, m in M[j]} :=
> 1+sum{n in M[j]: start[j,n]<start[j,m] || start[j,n]==start[j,m] && n<m} 1;
> printf "\n\n JOB SCHEDULES\n";
> for {j in JOBS} {
> printf "\n%s:\n",j;
> printf " MACHINE Start Finish\n";
> printf {k in 1..card(M[j]), m in M[j]: k==r[j,m]}
> " %15s %5.2f %5.2f\n",m, start[j,m],finish[j,m];
> }
>
> /* Schedule of activities for each machine */
> set J{m in MACHINES} := setof {(j,m) in TASKS} j;
> param s{m in MACHINES, j in J[m]} :=
> 1+sum{k in J[m]: start[k,m]<start[j,m] || start[k,m]==start[j,m] && k<j} 1;
> printf "\n\n MACHINE SCHEDULES\n";
> for {m in MACHINES} {
> printf "\n%s:\n",m;
> printf " JOB Start Finish\n";
> printf {k in 1..card(J[m]), j in J[m]: k==s[m,j]}
> " %15s %5.2f %5.2f\n",j, start[j,m],finish[j,m];
> }
> printf "\n\n";
>
> data;
>
> /* Job shop data from Christelle Gueret, Christian Prins, Marc Sevaux,
> "Applications of Optimization with Xpress-MP," Chapter 5, Dash
> Optimization, 2000. */
>
> /* Jobs are broken down into a list of tasks, each task described by
> job name, machine name, and duration */
>
> param: TASKS: dur :=
> Paper_1 Blue 45
> Paper_1 Yellow 10
> Paper_2 Blue 20
> Paper_2 Green 10
> Paper_2 Yellow 34
> Paper_3 Blue 12
> Paper_3 Green 17
> Paper_3 Yellow 28 ;
>
> /* List any required pairwise orderings of tasks */
>
> set TASKORDER :=
> Paper_1 Blue Paper_1 Yellow
> Paper_2 Green Paper_2 Blue
> Paper_2 Blue Paper_2 Yellow
> Paper_3 Yellow Paper_3 Blue
> Paper_3 Blue Paper_3 Green ;
>
> end;
>
>
> writed by Jeff Kantor the shift calendars of the machine and I guess
> that the best way could be to create a list of day off ( where the
> production is stopped) and I'm going to add to task lead time (start
> + duration) the sum of the durations of the day off (between start
> and start + duration)
> it's difficult to explain and I hope to be being clear.
> Tks again
>
hegyhati.vcf
Description: Vcard
signature.asc
Description: OpenPGP digital signature