(!****************************************************** Mosel Example Problems ====================== file capbgt.mos ``````````````` TYPE: Capital budgeting DIFFICULTY: 1 FEATURES: simple MIP problem DESCRIPTION: Among 8 projects under consideration we wish to choose the most profitable ones. Each project requires a capital investment and a commitment of skilled personnel. The (discounted) return of each project is known. The available capital and the number of skilled personnel are limited. FURTHER INFO: Similar problem: `Applications of optimization with Xpress-MP', Section 13.6 `Choice of expansion projects'. (c) 2001 Dash Associates authors: Y. Colombani & S. Heipcke *******************************************************!) model Capbgt uses "mmxprs" ! Use Xpress-Optimizer declarations RPROJ = 1..8 ! Range of possible projects CAPAVL = 478 ! Availability of capital PERAVL = 106 ! Availability of skilled personnel CAP: array(RPROJ) of real ! Capital required for project p PER: array(RPROJ) of real ! Personnel required for project p RET: array(RPROJ) of real ! Return from project p x: array(RPROJ) of mpvar ! Variables indicating whether a project ! is chosen end-declarations ! PROJ 1 2 3 4 5 6 7 8 CAP := [104, 53, 29, 187, 98, 32, 75, 200] PER := [ 22, 14, 7, 36, 24, 10, 20, 41] RET := [124, 75, 42, 188, 108, 56, 88, 225] ! Objective: maximize the return MaxReturn:= sum(i in RPROJ) RET(i)*x(i) ! Limit on capital used by all projects LimCap:= sum(i in RPROJ) CAP(i)*x(i) <= CAPAVL ! Limit on personnel used by all projects LimPers:= sum(i in RPROJ) PER(i)*x(i) <= PERAVL ! Variables are 0/1 forall(i in RPROJ) x(i) is_binary ! Solve the problem maximize(MaxReturn) ! Solution printing writeln("Solution:\n Objective: ", getobjval) forall(i in RPROJ) write(" x(", i, "): ", getsol(x(i))) writeln end-model