![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||
Scheduling problems Description
Further explanation of this example: 'Applications of optimization with Xpress-MP', Chapter 7: Scheduling problems
Source Files By clicking on a file name, a preview is opened at the bottom of this page. Data Files b1stadium2.mos (!****************************************************** Mosel Example Problems ====================== file b1stadium2.mos ``````````````````` Construction of a stadium - Set version - A town is planning to build a new stadium and need to determine the earliest it can be completed. Additionally, the town would like to project to finish earlier than the initial estimate. The town is prepared to pay the builder a bonus for every week the project completes early. Each task has a max week reduction with added costs. The second problem determines when the project will finish if the builder maximizes their profit. The first problem is a classical project scheduling problem. To define the precedence relations between tasks, we work with an array 'SUCC' that holds the set of direct successors per task and define constraints for related tasks. The second problem is called 'scheduling with project crashing' and it requires the result of the first problem. The new variable 'advance' is introduced to represent how many weeks early each task can be finished. (c) 2008-2022 Fair Isaac Corporation author: S. Heipcke, Jan. 2006, rev. Mar. 2022 *******************************************************!) model "B-1 Stadium construction (2)" uses "mmxprs" forward procedure printsol declarations N = 19 ! Number of tasks in the project ! (last = fictitious end task) TASKS=1..N SUCC: array(TASKS) of set of integer ! Successors of tasks DUR: array(TASKS) of real ! Duration of tasks start: array(TASKS) of mpvar ! Start times of tasks obj1: real ! Solution of first problem end-declarations initializations from 'b1stadium2.dat' SUCC DUR end-initializations ! Precedence relations between tasks forall(i in TASKS, j in SUCC(i)) Prec(i,j):= start(j) - start(i) >= DUR(i) ! Solve the first problem: minimize the total duration minimize(start(N)) obj1:=getobjval ! Solution printing printsol ! **** Extend the problem **** declarations BONUS: integer ! Bonus per week finished earlier MAXW: array(TASKS) of real ! Max. reduction of tasks (in weeks) COST: array(TASKS) of real ! Cost of reducing tasks by a week advance: array(TASKS) of mpvar ! Number of weeks finished early end-declarations initializations from 'b1stadium2.dat' MAXW BONUS COST end-initializations ! Second objective function Profit:= BONUS*advance(N) - sum(i in 1..N-1) COST(i)*advance(i) ! Redefine precedence relations between tasks forall(i in TASKS, j in SUCC(i)) Prec(i,j):= start(j) - start(i) + advance(i) >= DUR(i) ! Total duration start(N) + advance(N) = obj1 ! Limit on number of weeks that may be saved forall(i in 1..N-1) advance(i) <= MAXW(i) ! Solve the second problem: maximize the total profit maximize(Profit) ! Solution printing writeln("Total profit: ", getsol(Profit)) printsol !----------------------------------------------------------------- procedure printsol writeln("Total duration: ", getsol(start(N)), " weeks") forall(i in 1..N-1) write(strfmt(i,2), ": ", strfmt(getsol(start(i)),-3), if(i mod 9 = 0,"\n","")) writeln end-procedure end-model
| |||||||||||||||||||||||||||||||||||||||||||||||||||
© Copyright 2025 Fair Isaac Corporation. |