| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Mining and process industries Description
Further explanation of this example: 'Applications of optimization with Xpress-MP', Chapter 6: Mining and process industries (blending problems)
Source Files By clicking on a file name, a preview is opened at the bottom of this page.
Data Files
a6electr.mos (!****************************************************** Mosel Example Problems ====================== file a6electr.mos ````````````````` Production of electricity Four types of power generators are available to meet daily electricity demands and up to 20% above. Each type of generator has a set maximum capacity and minimum power output. A generator can only be started or stopped at the beginning of a time period. The objective is to determine which generators should be used in each period so that total daily cost is minimized. Three variable arrays are required to determine when to 'start' generators, which ones are set to 'work' in each time period, and the energy productionl ('padd') of each type above the minimum output level. 'work' is defined as integer. 'start' is the difference between 'work' this period and 'work' last period and therefore is automatically integer. (c) 2008-2022 Fair Isaac Corporation author: S. Heipcke, Mar. 2002, rev. Mar. 2022 *******************************************************!) model "A-6 Electricity production" uses "mmxprs", "mmsystem" declarations NT = 7 TIME = 1..NT ! Time periods TYPES = 1..4 ! Power generator types LEN, DEM: array(TIME) of integer ! Length and demand of time periods PMIN,PMAX: array(TYPES) of integer ! Min. & max output of a generator type CSTART: array(TYPES) of integer ! Start-up cost of a generator CMIN: array(TYPES) of integer ! Hourly cost of gen. at min. output CADD: array(TYPES) of real ! Cost/hour/MW of prod. above min. level AVAIL: array(TYPES) of integer ! Number of generators per type start: array(TYPES,TIME) of mpvar ! No. of gen.s started in a period work: array(TYPES,TIME) of mpvar ! No. of gen.s working during a period padd: array(TYPES,TIME) of mpvar ! Production above min. output level end-declarations initializations from 'a6electr.dat' LEN DEM PMIN PMAX CSTART CMIN CADD AVAIL end-initializations ! Objective function: total daily cost Cost:= sum(p in TYPES, t in TIME) (CSTART(p)*start(p,t) + LEN(t)*(CMIN(p)*work(p,t) + CADD(p)*padd(p,t))) ! Number of generators started per period and per type forall(p in TYPES, t in TIME) start(p,t) >= work(p,t) - if(t>1, work(p,t-1), work(p,NT)) ! Limit on power production above minimum level forall(p in TYPES, t in TIME) padd(p,t) <= (PMAX(p)-PMIN(p))*work(p,t) ! Satisfy demands forall(t in TIME) sum(p in TYPES) (PMIN(p)*work(p,t) + padd(p,t)) >= DEM(t) ! Security reserve of 20% forall(t in TIME) sum(p in TYPES) PMAX(p)*work(p,t) >= 1.20*DEM(t) ! Limit number of available generators; numbers of generators are integer forall(p in TYPES, t in TIME) do work(p,t) <= AVAIL(p) work(p,t) is_integer end-do ! Solve the problem minimize(Cost) ! Solution printing writeln("Daily cost: ", getobjval) write(strfmt("Time period ",-20)) ct:=0 forall(t in TIME) do write(formattext("%5d-%2d", ct, ct+LEN(t))) ct+=LEN(t) end-do forall(p in TYPES) do write(formattext("\nType %d%-14s", p, " No. working ")); forall(t in TIME) write(strfmt(work(p,t).sol,8)) write("\n", strfmt("Total output ",20)); forall(t in TIME) write(strfmt(getsol((PMIN(p)*work(p,t) + padd(p,t))),8)) write("\n", strfmt("of which add.",20)); forall(t in TIME) write(strfmt(padd(p,t).sol,8)) end-do writeln end-model | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
© Copyright 2024 Fair Isaac Corporation. |