Johdatus IBM ILOG OPL Studio optimointiympäristön käyttöön

Samankaltaiset tiedostot
A DEA Game II. Juha Saloheimo S ysteemianalyysin. Laboratorio. Teknillinen korkeakoulu

A DEA Game I Chapters

On instrument costs in decentralized macroeconomic decision making (Helsingin Kauppakorkeakoulun julkaisuja ; D-31)

Capacity Utilization

On instrument costs in decentralized macroeconomic decision making (Helsingin Kauppakorkeakoulun julkaisuja ; D-31)

Alternative DEA Models

Efficiency change over time

Returns to Scale II. S ysteemianalyysin. Laboratorio. Esitelmä 8 Timo Salminen. Teknillinen korkeakoulu

16. Allocation Models

FinFamily PostgreSQL installation ( ) FinFamily PostgreSQL

FinFamily Installation and importing data ( ) FinFamily Asennus / Installation

Capacity utilization

Salasanan vaihto uuteen / How to change password

Tarua vai totta: sähkön vähittäismarkkina ei toimi? Satu Viljainen Professori, sähkömarkkinat

anna minun kertoa let me tell you

Information on preparing Presentation

Results on the new polydrug use questions in the Finnish TDI data

Kon Konepajojen tuotannonohjaus: ILOG CPLEX Studion käyttö

You can check above like this: Start->Control Panel->Programs->find if Microsoft Lync or Microsoft Lync Attendeed is listed

The CCR Model and Production Correspondence

On instrument costs in decentralized macroeconomic decision making (Helsingin Kauppakorkeakoulun julkaisuja ; D-31)

Network to Get Work. Tehtäviä opiskelijoille Assignments for students.

Sisällysluettelo Table of contents

National Building Code of Finland, Part D1, Building Water Supply and Sewerage Systems, Regulations and guidelines 2007

Bounds on non-surjective cellular automata

The Viking Battle - Part Version: Finnish

Gap-filling methods for CH 4 data

Operatioanalyysi 2011, Harjoitus 4, viikko 40

Rekisteröiminen - FAQ

1. SIT. The handler and dog stop with the dog sitting at heel. When the dog is sitting, the handler cues the dog to heel forward.

Uusi Ajatus Löytyy Luonnosta 4 (käsikirja) (Finnish Edition)

Other approaches to restrict multipliers

1.3 Lohkorakenne muodostetaan käyttämällä a) puolipistettä b) aaltosulkeita c) BEGIN ja END lausekkeita d) sisennystä

1.3Lohkorakenne muodostetaan käyttämällä a) puolipistettä b) aaltosulkeita c) BEGIN ja END lausekkeita d) sisennystä

812336A C++ -kielen perusteet,

TW-LTE 4G/3G. USB-modeemi (USB 2.0)

7.4 Variability management

ECVETin soveltuvuus suomalaisiin tutkinnon perusteisiin. Case:Yrittäjyyskurssi matkailualan opiskelijoille englantilaisen opettajan toteuttamana

Travel Getting Around

Choose Finland-Helsinki Valitse Finland-Helsinki

Use of spatial data in the new production environment and in a data warehouse

make and make and make ThinkMath 2017

WindPRO version joulu 2012 Printed/Page :42 / 1. SHADOW - Main Result

KONEISTUSKOKOONPANON TEKEMINEN NX10-YMPÄRISTÖSSÄ

Rotarypiiri 1420 Piiriapurahoista myönnettävät stipendit

Counting quantities 1-3

Metsälamminkankaan tuulivoimapuiston osayleiskaava

WindPRO version joulu 2012 Printed/Page :47 / 1. SHADOW - Main Result

C++11 seminaari, kevät Johannes Koskinen

RINNAKKAINEN OHJELMOINTI A,

AYYE 9/ HOUSING POLICY

EUROOPAN PARLAMENTTI

Data Quality Master Data Management

( ( OX2 Perkkiö. Rakennuskanta. Varjostus. 9 x N131 x HH145

BLOCKCHAINS AND ODR: SMART CONTRACTS AS AN ALTERNATIVE TO ENFORCEMENT

( ,5 1 1,5 2 km

LYTH-CONS CONSISTENCY TRANSMITTER

Tynnyrivaara, OX2 Tuulivoimahanke. ( Layout 9 x N131 x HH145. Rakennukset Asuinrakennus Lomarakennus 9 x N131 x HH145 Varjostus 1 h/a 8 h/a 20 h/a

Hankkeen toiminnot työsuunnitelman laatiminen

Operatioanalyysi 2011, Harjoitus 3, viikko 39

TM ETRS-TM35FIN-ETRS89 WTG

TM ETRS-TM35FIN-ETRS89 WTG

HARJOITUS- PAKETTI A

Curriculum. Gym card

MUSEOT KULTTUURIPALVELUINA

TM ETRS-TM35FIN-ETRS89 WTG

Nuku hyvin, pieni susi -????????????,?????????????????. Kaksikielinen satukirja (suomi - venäjä) ( (Finnish Edition)

TM ETRS-TM35FIN-ETRS89 WTG

,0 Yes ,0 120, ,8

TM ETRS-TM35FIN-ETRS89 WTG

Miksi Suomi on Suomi (Finnish Edition)

Hankkeiden vaikuttavuus: Työkaluja hankesuunnittelun tueksi

Operatioanalyysi 2011, Harjoitus 2, viikko 38

TM ETRS-TM35FIN-ETRS89 WTG

KMTK lentoestetyöpaja - Osa 2

Tietorakenteet ja algoritmit

4x4cup Rastikuvien tulkinta

1. Liikkuvat määreet

Käyttöliittymät II. Käyttöliittymät I Kertaus peruskurssilta. Keskeisin kälikurssilla opittu asia?

TM ETRS-TM35FIN-ETRS89 WTG

BDD (behavior-driven development) suunnittelumenetelmän käyttö open source projektissa, case: SpecFlow/.NET.

Mat Seminar on Optimization. Data Envelopment Analysis. Economies of Scope S ysteemianalyysin. Laboratorio. Teknillinen korkeakoulu

SIMULINK S-funktiot. SIMULINK S-funktiot

TM ETRS-TM35FIN-ETRS89 WTG

Data protection template

Microsoft Lync 2010 Attendee

S SÄHKÖTEKNIIKKA JA ELEKTRONIIKKA

Lab SBS3.FARM_Hyper-V - Navigating a SharePoint site

C470E9AC686C

MEETING PEOPLE COMMUNICATIVE QUESTIONS

TM ETRS-TM35FIN-ETRS89 WTG

TM ETRS-TM35FIN-ETRS89 WTG

TM ETRS-TM35FIN-ETRS89 WTG

Exercise 1. (session: )

PAINEILMALETKUKELA-AUTOMAATTI AUTOMATIC AIR HOSE REEL

Alueellinen yhteistoiminta

Counting quantities 1-3

Travel Accommodations

Voice Over LTE (VoLTE) By Miikka Poikselkä;Harri Holma;Jukka Hongisto

Statistical design. Tuomas Selander

Transkriptio:

Johdatus IBM ILOG OPL Studo optmontympärstön käyttöön OPL (Optmzaton Programmng Language) on optmontongelmen kuvauskel, joka mustuttaa vakntunutta matemaattsten lausekkeden krjottamstapaa. OPL Studo on optmontympärstö, jossa OPL kelset ongelmat vodaan ratkasta CPLEX ratkasmella. Tämä opas kuvaa lyhyest OPL Studon käyttöä ja OPL mallen krjottamsta. Käyttölttymä Projects / folders IBM ILOG OPL uses the concept of a project to assocate a model (.mod) fle wth, usually, one or more data (.dat) fles and one or more settngs (.ops) fles. A project contanng only a sngle model fle s vald; data and settngs fles are optonal. However, one project can contan several sets of model, data and settngs fles, the relatonshps between them mantaned usng run confguratons. The model fle declares data elements but does not necessarly ntalze them. The data fles contan the ntalzaton of data elements declared n the model. The.project fle n the root folder for the OPL project organzes all the related model, data and settngs fles. Run confguratons, whch are mantaned n an.oplproject fle, also provde a convenent way to 1

mantan the relatonshp between related fles and runtme optons for the envronment (see also the Run confguratons secton). When you are about to wrte a new model n IBM ILOG, the dalog box that appears allows you to name your project, gve your project a descrpton, and choose whether you want to create a data fle or a settngs fle. The descrpton of the project may be useful later to better dfferentate projects wth smlar names. Ths s explaned n detal n Gettng Started wth the OPL IDE and n the IDE Reference manual. A mnmal project has: one model fle one default run confguraton referencng that same model fle A typcal project has: one or more model fles any number of data fles or no data fle any number of settngs fles or no settngs fle one or more run confguratons referencng varous combnatons of those model, data, and settngs fles. (A run confguraton cannot have more than one model fle.) Model fles Model (.mod) fles contan all your OPL statements. The data and the objectve functon are not mandatory and there may be more optonal components, such as scrptng statements. Note that you can also generate a model fle n a compled form (.opl) from the IDE for executon through the OPL nterface lbrares (see Generatng a compled model). The components of a model fle are covered n the followng sectons. Declaratons of data Data declaratons allow you to name your data so that you can reference them easly n your model. For example, f your data n a table defne the cost of shppng one unt of materal from locaton to locaton j, you mght want to call your tem of data cost j where =1,..., n and j=1,..., n and n s the number of locatons n your model. You tell OPL that your model uses ths data by declarng: nt n =... ; float cost[1..n][1..n] =... ; The... (ellpss) means that the values for your table are located n a data fle, whch must be lsted n the current project. You could also lst the data explctly n the model fle. However, t s recommended that you construct model fles wthout specfyng values for data so that you can later easly solve many nstances of the same model by smply changng the data fle. See also the Run confguratons secton. Note that thent type declared means that the numbers n the data fle must be ntegers. If the numbers n the data fle are floatng pont numbers, use thefloat type nstead. Declaratons of decson varables In OPL context, as opposed to IBM ILOG Scrpt and to the general programmng context, varables are decson varables. Declaratons of decson varables name and gve the type of each varable n the model. For example, f you want to create a varable that equals the amount of materal shpped from locaton to locaton j, you can create a varable named shp j. dvar float+ shp[1..n][1..n]; That statement declares an array of non negatve floatng pont varables. (That s what float+ means). The dvar keyword ndcates that you are declarng a decson varable. 2

An objectve functon The objectve functon s a functon that you want to optmze. Ths functon must consst of varables and data that you have declared earler n the model fle. The objectve functon s ntroduced by ether the mnmze or themaxmze keyword. For example, mnmze sum(,j n 1..n) cost[][j]*shp[][j]; That statement ndcates that you want to mnmze the sum of the shppng costs for each orgn destnaton par. Constrants Constrants ndcate the condtons necessary for a feasble soluton to your model. You declare constrants wthn asubject to block. For example, subject to { } forall(j n 1..n) sum( n 1..n) shp[][j] == demand[j]; That statement declares one set of constrants. There s a constrant for each destnaton. (That s what the forall keyword ndcates.) The constrant for each destnaton states that the sum of materal shpped to that destnaton must equal the demand at that destnaton. The symbol == ndcates equals wthn a constrant block. The symbol<= ndcates less than or equal to. The symbol>= ndcates greater than or equal to. Data fles You can organze large problems better by separatng the model of the problem from the nstance data, each set of data stored n a separate data fle, wth a.dat extenson. In ths case, you store the nstance data n one or more data fles (.dat). Data fles (.dat) store the values of the data used n the model. If you declare the data as suggested n ths tutoral, your data fle wll look somethng lke ths: n = 3; c = [[0.0 1.5 2.3] [1.5 0.0 3.7] [2.3 3.7 0.0]]; Each data fle may specfy one or more connectons to data sources, such as a relatonal database or a spreadsheet, to read and wrte data. Settngs fles Settngs fles (.ops) are where your user defned values are stored when you decde to change the default values of OPL language optons, constrant programmng (CP Optmzer) parameters, or mathematcalprogrammng (CPLEX ) parameters. OPL settngs apply only to the model ncluded n the run confguraton, not to the submodels loaded and solved. Run confguratons Run confguratons are a way of handlng model, data, and settngs fles wthn a project. Bascally, a run confguraton s a varaton of a gven project for executon purposes. It combnes at least a model fle and, optonally, one or more data fles and one or more settngs fles wthn the project, whle addressng the same mathematcal problem. You can defne as many run confguratons as you need wthn a gven project. Typcally, you use run confguratons to test, mprove, and fne tune your OPL projects. 3

For example, you can: keep two sets of data: a smple one for quck prototypng and a larger one to work closer to your busness case; keep one confguraton for each set of MP optons (CPLEX parameters) that makes sense for your problem. Practcally, run confguratons appear as sublevels n the Projects tree. Esmerkk: yksttäsen koneen akataulutus Yksttäsen koneen akataulutustehtävässä oletetaan, että ajotettavana on joukko tekemskelposa tötä. Nämä työt tuls ajottaa nn, että jokn käytännöllnen krteer optmotuu. Jos työn alottamseen lttyvä rajotusehtoja (lähnnä akasn mahdollnen startthetk) e ole, normaalt tunnusluvut optmotuvat järjestämällä työt peräkkän lman välejä. Myöhäsmpään valmstumshetkeen e töden järjestyksellä ole vakutusta. Mm. keskmääränen läpäsyaka ja maksmmyöhästymä optmotuvat yksnkertaslla prorsontsäännöllä. Kokonasmyöhästymän mnmontn sen sjaan e ole mtään helppoja algortmeja. Nnpä tämä ongelma ratkastaan seuraavassa esmerkssä matemaattsella ohjelmonnlla. Data I P M D = töden lukumäärä = työn kesto = suur luku = työn vmenen sallttu valmstumshetk (määräpävä) Decson varables t = työn alkamshetk y j = saavat arvon 1, jos edeltää j:tä, muuten arvon 0 f = työn myöhästymä Objectve Mnmodaan yksttästen töden myöhästymen summa. Kaavana: Mn Constrants 1 edellytetään, että myöhästymä on määräpävän ja työn valmstumshetken erotus 2 töden alkamshetket ja myöhästymät ovat postvsa 3 f työt evät saa olla päällekkän 4 y j ovat bnäärsä 4

Rajotusehdot krjotettuna kaavona: t + P D f, t My M y 0, f + ( t t ) P, { 1,.., I 1, } j { + 1,.., I} j j j ( 1 y ) ( t t ) P { I } j { I} j + j, 1,.., 1, + 1,.., { 0,1, }, j j 0, The constructon of an OPL model fle (.mod) follows the same format exactly. The problem can be formulated n IBM ILOG OPL lke ths: //Data nt I =...; nt M =...; float P[1..I] =...; float D[1..I] =...; //Varables dvar float+ t[1..i]; dvar boolean y[1..i][1..i]; dvar float+ f[1..i]; //Objectve mnmze sum ( n 1..I)f[]; //Constrants subject to{ forall ( n 1..I) f[] >= t[] + P[] D[]; forall ( n 1..I 1, j n +1..I) M * y[][j] + (t[] t[j]) >= P[j]; forall ( n 1..I 1, j n +1..I) M * (1 y[][j]) + (t[j] t[]) >= P[]; // FIFO smulont: // forall ( n 1..I 1) t[+1] >= t[]; } Notce that: the... (ellpss) syntax means that the data s ntalzed externally, that s, from a data fle (.dat): I = 5; M = 1000; P = [4,6,8,3,9]; D = [9,20,36,15,19]; /* Datan luku ja krjotus Excel taulukkoon SheetConnecton sheet("harjotus.xls"); P from SheetRead(sheet,"A1:A5"); D from SheetRead(sheet,"B1:B5"); t to SheetWrte(sheet,"C1:C5"); f to SheetWrte(sheet,"D1:D5"); */ 5

Debuggng and dealng wth error messages OPL checks for errors n the model and data fles. Syntax errors Syntax and semantc errors are dsplayed dynamcally n the Issues tab as you type. For example, a common error s to forget to put a semcolon at the end of a statement. If you omt the semcolon at the end of the lne nt P =...; the Problems tab dsplays the descrpton, locaton, and source fle of the error. Generally, error messages wll look smlar to ths example. Solvng errors Immedately after you run your project, OPL checks for errors that prevent the solver from runnng. If such errors are found, one or more error messages wll be dsplayed n the Problems tab. (See The Man wndow secton.) Dsplayng solutons It s possble for you to vew solutons whle the solver s runnng as well as after t has fnshed. In addton to the Solutons tab of the Output Area, you can vew a soluton n tabular form through the Problem Browser. (See The Man wndow.) If your model expresses a MIP problem that generates feasble solutons, you can see the soluton pool n the Problem Browser and further populate t wth more nonoptmal solutons. (You can also see feasble solutons n the Solutons tab f certan Language settngs are selected; see After runnng a project and Settng language optons.) You can see varable values n the Problem Browser, whch also contans nformaton about data structures, data values, labeled constrants and senstvty data, as well as postprocessng data. 6