(!****************************************************** Mosel Example Problems ====================== file burglar2.mos ````````````````` Data read from file. (c) 2008 Fair Isaac Corporation author: S. Heipcke, Jan. 2001 *******************************************************!) model Burglar2 uses "mmxprs" declarations WTMAX = 102 ! Maximum weight allowed ITEMS: set of string ! Index set for items VALUE: array(ITEMS) of real ! Value of items WEIGHT: array(ITEMS) of real ! Weight of items end-declarations initializations from "burglar.dat" [VALUE,WEIGHT] as "BurgData" end-initializations declarations take: array(ITEMS) of mpvar ! 1 if we take item i; 0 otherwise end-declarations ! Objective: maximize total value MaxVal:= sum(i in ITEMS) VALUE(i)*take(i) ! Weight restriction sum(i in ITEMS) WEIGHT(i)*take(i) <= WTMAX ! All variables are 0/1 forall(i in ITEMS) take(i) is_binary maximize(MaxVal) ! Solve the MIP-problem ! Solution output forall(i in ITEMS) SOLTAKE(i):= getsol(take(i)) writeln("Solution:\n Objective: ", getobjval) writeln(SOLTAKE) initializations to "burglarout.txt" SOLTAKE end-initializations end-model