******************************************************* * Mosel Example Problems * ====================== * * Origin file contract.mos * ````````````````` * TYPE: Contract allocation problem * DIFFICULTY: 2 * FEATURES: simple MIP problem, semi-continuous variables, * graphical representation of results * DESCRIPTION: A public utility, which is divided into six regional * districts, wishes to allocate ten power generation * contracts to its regions as cheaply as possible. The cost * per unit of power generated by each region for each * contract is known.  If part of a contract is allocated to * a region than it must be at least as big as a certain * minimum size (5 units). For reliability reasons, no * contract may be placed exclusively with only one district. * Each district has a limited power generation capacity. * FURTHER INFO: `Applications of optimization with Xpress-MP teaching * material', Section 2.2 `Semi-continuous variables: * contract allocation'; * `Applications of optimization with Xpress-MP', * Section 3.4.3 `Semi-continuous variables' * * (c) 2001 Dash Associates * author: S. Heipcke ******************************************************** * model "Contract allocation" * Districts Set DISTRICT /d1*d6 / ; * Contracts Set CONTRACT /c1*c10 / ; * Maximum output per district Parameter OUTPUT[DISTRICT] / d1 50 , d2 40 , d3 10 , d4 20 , d5 70 , d6 50 / ; * Cost per district Parameter COST[DISTRICT] / d1 50 , d2 20 , d3 25 , d4 30 , d5 45 , d6 40 / ; * Cost per district Parameter VOLUME[CONTRACT] / c1 20 , c2 10 , c3 30 , c4 15 , c5 20 , c6 30 , c7 10 , c8 50 , c9 10 , c10 20 / ; Binary Variable alloc[DISTRICT,CONTRACT] ; * 1 if a bid is chosen, 0 otherwise Variable quant[DISTRICT,CONTRACT] , * Quantities allocated to contractors Total_Cost ; Equation Eq_1(CONTRACT) , Eq_2(CONTRACT) , Eq_Output(DISTRICT) , MinAlloc(DISTRICT,CONTRACT) , Def_Obj ; * Cover the req. contract volume Eq_1(CONTRACT).. Sum{DISTRICT, quant[DISTRICT,CONTRACT] } =g= VOLUME[CONTRACT] ; * At least 2 districts per contract Eq_2(CONTRACT).. Sum{DISTRICT, alloc[DISTRICT,CONTRACT] } =g= 2 ; * Do not exceed maximum output of any district Eq_Output(DISTRICT).. Sum{CONTRACT, quant[DISTRICT,CONTRACT] } =l= OUTPUT[DISTRICT] ; * If a contract is allocated to a district, then at least 1 unit is * allocated to it MinAlloc(DISTRICT,CONTRACT).. alloc[DISTRICT,CONTRACT] =l= quant[DISTRICT,CONTRACT] ; * Objective function: total cost Def_obj.. Total_Cost =e= Sum{(DISTRICT,CONTRACT), COST[DISTRICT]*quant[DISTRICT,CONTRACT] } ; quant.up[DISTRICT,CONTRACT] = OUTPUT[DISTRICT] * Solve the problem Model Contract_allocation / all / ; Solve Contract_allocation using MIP minimazing Total_Cost ; Display Total_Cost.l ;