PER ANALISI DI SCENARI E OTTIMIZZAZIONE

Slides:



Advertisements
Presentazioni simili
Primary Italian Saying How You Are.
Advertisements

Trieste, 26 novembre © 2005 – Renato Lukač Using OSS in Slovenian High Schools doc. dr. Renato Lukač LinuxDay Trieste.
Centro Internazionale per gli Antiparassitari e la Prevenzione Sanitaria Azienda Ospedaliera Luigi Sacco - Milano WP4: Cumulative Assessment Group refinement.
I numeri, l’ora, I giorni della settimana
L’esperienza di un valutatore nell’ambito del VII FP Valter Sergo
Cache Memory Prof. G. Nicosia University of Catania
La Domanda del settore privato: consumo e investimento
Prof. Stefano Bistarelli
Modelli Matematici per i Mercati Finanziari I
Teoria e Tecniche del Riconoscimento
Interfacce Java.
1 Teaching Cloud Computing and Windows Azure in Academia Domenico Talia UNIVERSITA DELLA CALABRIA & ICAR-CNR Italy Faculty Days 2010.
A. Oppio, S. Mattia, A. Pandolfi, M. Ghellere ERES Conference 2010 Università Commerciale Luigi Bocconi Milan, june 2010 A Multidimensional and Participatory.
Relaunching eLene Who are we now and which are our interests.
DG Ricerca Ambientale e Sviluppo FIRMS' FUNDING SCHEMES AND ENVIRONMENTAL PURPOSES IN THE EU STRUCTURAL FUNDS (Monitoring of environmental firms funding.
Laurea Magistrale in Informatica Thecnologies for Innovation
Prof. Mario Pavone - crentro di ricerca IPPARI
Italiano Da quando siamo passati al corso di metallurgia (3^o ) abbiamo cominciato a lavorare utilizzando i maniera didattica tecnologie di tipo hardware.
Cancer Pain Management Guidelines
Il presente del congiuntivo (the present subjunctive)
Il presente del congiuntivo (the present subjunctive)
Raffaele Cirullo Head of New Media Seconda Giornata italiana della statistica Aziende e bigdata.
J0 1 Marco Ronchetti - Corso di Formazione Sodalia – Febbraio 2001 – Modulo Web Programming Tomcat configuration.
prompt> java SumAverage
C Consiglio Nazionale delle Ricerche - Pisa Iit Istituto per lInformatica e la Telematica Reasoning about Secure Interoperation using Soft Constraints.
Biometry to enhance smart card security (MOC using TOC protocol)
Costruzione di Interfacce Lezione 10 Dal Java al C++ parte 1
TIPOLOGIA DELLE VARIABILI SPERIMENTALI: Variabili nominali Variabili quantali Variabili semi-quantitative Variabili quantitative.
Ergo : what is the source of EU-English? Standard British English? Standard American English? Both!!!! See morphology (use of British.
Metodi di simulazione numerica in Chimica Fisica Dario Bressanini Universita degli Studi dellInsubria III anno della Laurea triennale in Scienze Chimiche.
2000 Prentice Hall, Inc. All rights reserved. 1 Capitolo 3 - Functions Outline 3.1Introduction 3.2Program Components in C++ 3.3Math Library Functions 3.4Functions.
SQL Esercitazione per il corso “Basi di Dati” Gabriel Kuper
Magnetochimica AA Marco Ruzzi Marina Brustolon
Queuing or Waiting Line Models
2000 Prentice Hall, Inc. All rights reserved. 1 Capitolo 6: Classi e astrazione dati 1.Introduzione 2.Definizione delle strutture 3.Accedere ai membri.
Chistmas is the most loved holiday of the years. Adults and children look forward to Chistmas and its magical atmosphere. It is traditional to decorate.
VARO SRL LOGISTIC, QUALITY, SERVICE
“Su alcuni problemi nella Teoria dei Linguaggi Formali”
Le regole Giocatori: da 2 a 10, anche a coppie o a squadre Scopo del gioco: scartare tutte le carte per primi Si gioca con 108 carte: 18 carte.
Players: 3 to 10, or teams. Aim of the game: find a name, starting with a specific letter, for each category. You need: internet connection laptop.
Compito desame del Svolgimento della Sezione 5: CONTROLLORI Esempio preparato da Michele MICCIO.
Scuola di Dottorato della Facoltà di Scienze MM. FF. NN., Università di Milano Bicocca ELEMENTI DI ORGANIZZAZIONE AZIENDALE Funzione finanza e controllo:
Ischia, giugno 2006Riunione Annuale GE 2006 Exploiting the Body Effect to Improve Analog CMOS Circuit Performances *P. Monsurrò, **S. Pennisi, *G.
Alcuni, qualche, un po’ di
UNIVERSITÀ DEGLI STUDI DI PAVIA FACOLTÀ DI ECONOMIA, GIURISPRUDENZA, INGEGNERIA, LETTERE E FILOSOFIA, SCIENZE POLITICHE. Corso di Laurea Interfacoltà in.
Guardate le seguenti due frasi:
Motor Sizing.
Calibrating (Partial Equilibrium) Mathematical Programming Spatial Models Open questions … (filippo arfini) III Workshop PUE&PIEC - Treia (Mc), 3-4 febbraio.
Tutor: Elisa Turrini Mail:
Project Review Novembrer 17th, Project Review Agenda: Project goals User stories – use cases – scenarios Project plan summary Status as of November.
FOR EVERY CALLOUT THAT YOU WILL SEE IN ENGLISH PROVIDE (IN WRITING) THE CORRECT ITALIAN SENTENCE OR EXPRESSION. REMEMBER TO LOOK AT THE VERBS AND PAY.
UG40 Energy Saving & Twin Cool units Functioning and Adjustment
EMPOWERMENT OF VULNERABLE PEOPLE An integrated project.
PLURALI - with NOUNS PAY ATTENTION TO THE ENDING OF THE NOUN! “O” ---> “I” ex) il quaderno -> i quaderni “A” ---> “E” ex) la matita -> le matite “E” --->
LA WEB RADIO: UN NUOVO MODO DI ESSERE IN ONDA.
Teorie e tecniche della Comunicazione di massa Lezione 7 – 14 maggio 2014.
Guida alla compilazione del Piano di Studi Curricula Sistemi per l’Automazione Automation Engineering.
Passato Prossimo. What is it?  Passato Prossimo is a past tense and it is equivalent to our:  “ed” as in she studied  Or “has” + “ed” as in she has.
Lezione n°27 Università degli Studi Roma Tre – Dipartimento di Ingegneria Corso di Teoria e Progetto di Ponti – A/A Dott. Ing. Fabrizio Paolacci.
Italian 1 -- Capitolo 2 -- Strutture
Buon giorno Io sono Professoressa Kachmar. Buon giorno Io sono Professoressa Kachmar.
Un problema multi impianto Un’azienda dispone di due fabbriche A e B. Ciascuna fabbrica produce due prodotti: standard e deluxe Ogni fabbrica, A e B, gestisce.
Buon giorno, ragazzi oggi è il quattro aprile duemilasedici.
MSc in Communication Sciences Program in Technologies for Human Communication Davide Eynard Facoltà di scienze della comunicazione Università della.
Do You Want To Pass Actual Exam in 1 st Attempt?.
WRITING – EXERCISE TYPES
Preliminary results of DESY drift chambers efficiency test
The Behavioral Insight Team
The effects of leverage in financial markets Zhu Chenge, An Kenan, Yang Guang, Huang Jiping. Department of Physics, Fudan University, Shanghai, ,
Transcript della presentazione:

PER ANALISI DI SCENARI E OTTIMIZZAZIONE Corso RICERCA OPERATIVA USO DI EXCEL PER ANALISI DI SCENARI E OTTIMIZZAZIONE Laura Palagi Dipartimento di Informatica e Sistemistica “A. Ruberti” Sapienza Universita` di Roma Corso di Laurea in Ingegneria dei Trasporti Corso di Laurea Magistrale in Ingegneria Meccanica Corso di Laurea Magistrale in Ingegneria dei Sistemi di Trasporto

Capital Budgeting (Pianificazione degli Investimenti) Consideriamo il problema di Capital Budgeting Definizione del problema Un’azienda deve considerare tre possibili progetti sui cui investire nel corso dell’anno Data Ogni progetto produce un Guadagno (G) Ogni progetto richiede un investimento (I) Budget 15 milioni

Capital budgeting: un possibile scenario Selezionato (YES = 1) Per ogni progetto Non selezionato (NO = 0) Investimento richiesto = 8 + 0 + 5 = 13 Guadagno ottenuto = 12 + 0 + 7 = 19 E` la migliore possibile ?

Capital budgeting: costruzione del modello Definiscono le possibili alternative Soluzioni ammissibili Selected (YES = 1) Per ogni progetto Not selected (NO = 0)

Capital budgeting Tutte le possibilita` Sono tutte compatibili con il budget ? Budget 15 milioni Non accettabile

Un possibile modello di capital budgeting Le scelte ammissibili F= Qual e` la migliore rispetto ai guadagni ? Miglior valore

Perche’ e` un modello “sbagliato” Feasible solutions Rappresentazione esaustiva 2n = numero enorme per valori grandi di n Potrebbe addirittura essere impossibile scriverlo Non indipendente dai dati Se i dati cambiano, e` necessario riscrivere ‘ex novo’ tutto il modello

Un modello “migliore” xi= Rappresentazione implicita delle soluzioni ammisibili Indipendente dai dati xi= 1 se il progetto i e` selezionato 0 se il progetto i NON e` selezionato Variabili di decisione Vincolo di Budget 8 x1+6 x2+5 x3 budget Investment for project 1 Investment for project 3 Investment for project 2

Un modello “migliore” xi= 1 if project i is selected 0 if project i is not selected guadagni 12 x1+8 x2+7 x3 earnings for project 1 Earnings for project 2 Earnings for project 3 Se cambiano i dati, solo I coefficneti dei vncoli e della funzione obiettivo devono essere modificati, ma non le funzioni matematiche, cioe` il modello che rimane lo stesso

Modello matematico di Capital budgeting Decision variables xi= 1 if project i is selected 0 if project i is not selected i=1,2,3 Funzione obiettivo 12 x1+8 x2+7 x3 max earnings vincoli 8 x1+6 x2+5 x3 budget x1, x2 , x3 Programmazione lineare intera (PLI)

Il modello di Capital Budget in Excel Possiamo rappresentare i dati del modello in una tabella Excel data Se cambiano i dati, e` necessario modificare solo questa parte della tabella Excel

Variabili di decisione (intere) c7,d7,e7

Il modello di Capital Budget in Excel Dobbiamo ora definire nuove celle nella tabella Excel che consentano di definire il modello matematico: 1. Variabili di decisione: dobbiamo assegnare dei valori inziali (stima iniziale) che consentano di valutare le funzioni Variabili di decisione (intere) c7,d7,e7

Il modello di Capital Budget in Excel Dobbiamo ora definire delle celle nella tabella Excel che consentano di definire il modello matematico data Integer decision variables c7,d7,e7 Constraint C4*C7+D4*D7+E4*E7 Objective C5*C7+D5*D7+E5*E7

Valore l.h.s. del vincolo C4*C7+D4*D7+E4*E7 r.h.s = budget Valore l.h.s. del vincolo C4*C7+D4*D7+E4*E7

Funzione obiettivo C5*C7+D5*D7+E5*E7

data Integer decision variables c7,d7,e7 Objective C5*C7+D5*D7+E5*E7

Solving Capital Budget with Excel   Objective function

Solving Capital Budget with Excel Variables (b6,c6,d6) are 0-1  

Solving Capital Budget with Excel   x1 x2 x3<= 1 x1 x2 x3>= 0 x1 x2 x3 int

Solving Capital Budget with Excel italian   english

Solving Capital Budget with Excel

Excel: an easy platform to optimization Excel has an optimization toolbox: Solver Tools Add-ins Solver

Solving PL with Excel In the main menù select Tools (Strumenti) and then Solver (solutore)

Tipo di problema (max o min) Solving PL with Excel It will appear a dialog window like below Objective function Decision variables Tipo di problema (max o min) Constraints Let now fill in

Setting the objective function Objective function PTOT = c9 The value can be set easily by clicking the corresponding cell (it puts the address $c$)

Setting the initial guess We need to give an initial value (also zero is feasible) = guess Cells C8 and D8 contains the value of the variables. At the end of the optimization process they contain the optimal value

Setting the constraints Clich Add (Aggiungi) Window of constraints

Setting the constraints Italian English Constraint can be of the type A    B A Int (integer value) A bin (binary value 0,1) Address of the cell Address of the cell or a constant

Setting the options Clicking Options (Opzioni) the window of parameters appears We must Assume Linear Model (use simplex method) and non-negative variables (in alternative we can define the additional constraints c8, d8  0).

Setting the options Maximum time allowed to obtain a solution Maximum iterations of the algorithm to obtain a solution It uses an algorithm for linear problems (simplex) More complex models (non linear)

Solve LP con Excel We can start optimization Click the button Solve (Risolvi)

Final result with Excel Guess initial values have been substituted by the optimal ones The “algorithmic” solution is the same obtained with the graphical solution

Changing the options for LP Reducing time Reducing iterations Reducing or increasing tolerance Same solution

Changing the options for LP Change the model Same solution In general this is not true

Solving Capital Budget with Excel   Objective function

Solving Capital Budget with Excel Variables (b6,c6,d6) are 0-1  

Solving Capital Budget with Excel   x1 x2 x3<= 1 x1 x2 x3>= 0 x1 x2 x3 int

Solving Capital Budget with Excel italian   english

Solving Capital Budget with Excel

Changing the options for ILP Reducing time Reducing iterations same solution but the Solver is not able to certify optimality

Changing the options for ILP Increasing Tolerance SOLUTION CHANGES Optimality declared, but it is not true

Production planning An engineering factory produces two types of tools: pliers and spanners. Pliers cost to the production 1.5 € each Spanners cost to the production 1 € each Production costs Pliers are sold at 6 € each Spanners are sold at 5 € each Selling price How much should the factory produce to maximize its profit ? Objective function

A possible scenario 15000 pliers 15000 spanners Assume that we are constructing Let us define the data of the problem 4,5 = (6 – 1,5) unit profit for pliers 4 = (5 – 1) unit profit for spanners unit profit = selling price – unit cost Objective function = total profit PTOT PTOT= number of pliers * unit profit for pliers + number of spanners * unit profit for spanners

A possible scenario (2) Formally: variables output of our model CH = number of spanners to be produced PI = number of pliers to be produced Equation of the overall profit 15000 Unit profit of pliers 127500 PTOT = 4  CH + 4,5  PI = 4 * 15000 + 4,5 * 15000 = Unit profit of spanners 15000 Is this the best value ?

First use of Excel for data storing We use an Excel table to summarize data and objective CH = D8 = number of pliers PI = C8 = number of spanners 4,5= unit profit pliers = D4 – D5 4 = unit profit spanners = C4-C5 C9 = C6 * C8 + D6 * D8 Excel formula PTOT = 4  CH + 4,5  PI Profit equation

Constraints Every point in the non negative quadrant is a possible feasible solution (a possible production planning) 2 4 6 8 10 12 14 16 Spanners (thousands) Pliers (thousands) (25000) overall profit (68000) (127500) In principle: the more I produce the more I gain ! In practice: constraints exist that limit the production

A standard constraint: the budget one Budget constraint: the overall cost must not greater than € 18000 CH = D8 = number of pliers PI = C8 = number of spanners CTOT= overall cost CTOT = 1  CH +1,5  PI Unit cost spanner Unit cost pliers Cost equation C11 = C5 * C8 + D5 * D8 CTOT = 1  CH + 1,5  PI  budget =18000 Budget constraint

Geometric view of the constraint Let draw the set F of the feasible solutions In the plane (PI, CH), first draw the equation of the budget constraint 1  CH + 1,5  PI = 18 Feasible region All non negative points “below” the line 1*CH + 1,5* PI = 18 12 CH PI 2 4 6 8 10 14 16 18 CTOT = 37500 > 18000: non ammissibile CTOT = 20000 CTOT = 7000  18000: ammissibile

Geometric view of the problem We need to find the “right” solution among the feasible ones “right” It satisfies the budget constraint It maximizes the profit CH 12 PI 2 4 6 8 10 14 16 18 1*CH + 1,5* PI = 18 Points in the red area satisfies the budget constraint, which is the better one ?

Scenarios with Excel Let us see with different scenarios feasible Not feasible Best among the three feasible. Is the optimum ? By chance ? feasible feasible

Limit of the “What If” approach The scenarios are too many: infinite solutions ! It is not possible to look over all of them !! We may wonder if may be better when the number of solutions is finite This is not always true, let see with an example

Construction of a good model: general rules 1 if project i is selected Definition of the decision variables xi= 0 if project i is not selected i=1,2,3 Definition of the objectives max 12 x1+8 x2+7 x3 earnings Definition of the constraints 8 x1+6 x2+5 x3 budget

Geometric view of the production problem The scenarios are too many We must find another method Depict the feasible region F (red area) 12 CH PI 2 4 6 8 10 14 16 18 1*CH + 1,5* PI = 18 PTOT = 69 Draw the line of the profit PTOT 4  CH + 4,5  PI = 69 Actual best value

Geometric view of the problem Draw the line of the profit PTOT 4  CH + 4,5  PI For growing values of PTOT = PTOT = 72 12 CH PI 2 4 6 8 10 14 16 18 1*CH + 1,5* PI = 18 PTOT = 56 56 PTOT = 18 18 PTOT = 0 Growing direction Old best value Optimum !!

Another constraint: technology To produce 1000 pliers or 1000 spanners is required 1 hour of usage of a plant The plant can work for a maximum of 14 hours per day CH = D8= number of spanners PI = C8= number of pliers HTOT = total hours nedeed HTOT = 0.001  CH + 0.001  PI Equation of the total hours C11 = C7 * C8 + D7 * D8 Technological constraint HTOT = 0.001  CH + 0.001  PI  max_hours=14

Geometric view of the technological constraint 0.001  CH + 0.001  PI  14 1  CH + 1  PI  14000 14 PI 12 2 4 6 8 10 CH 16 18 1*CH + 1* PI = 14 hours 16 > 14: not feasible In the plane (PI, CH), first draw the equation of the technological constraint  14: feasible hours 6 Feasible region of the technological constraint

Mixing the two constraints We must put together budget and technological constraints. Both must be satisfied Spanner Plier Both violated budget violated technological satisfied Budget satisfied technological violated Both satisfied

Geometric view of both constraints Hours: feasible Budget: not feasible Not feasible points PI 16 14 1*CH + 1* PI = 14 Hours: not feasible Budget: not feasible 12 1*CH + 1,5* PI = 18 10 8 6 Hours: not feasible Budget: feasible 4 2 Feasible set F Hours: feasible Budget: feasible 14 2 4 6 8 10 12 16 18 CH

Final feasible region 14 12 2 4 6 8 10 16 18 F 1  CH + 1,5  PI  18 budget hours Feasible solutions (CH,PI) satisfy: CH  0 PI  0 Non negativity Which is the best value for (CH,PI)* among the feasible ones ? The best one (CH,PI)* maximizes the profit 4  CH + 4,5  PI

Linear Programming CH,PI Real decision variables CH, PIR profit Objective function max 4CH + 4,5PI 1CH + 1,5  PI  18 budget 1  CH + 1  PI  14 hours constraints Non negativity CH  0 PI  0 CH, PIR LINEAR PROGRAMMING (LP) Max or Min of one linear objective function Constraints are linear equalities (=) or inequalities ( = )

Construction of a good model: general rules Definition of the decision variables CH, PIR x1 , x2 R The name is not important Definition of the objectives 4 x1+4,5 x2 max profit x1+ 1,5 x2 budget Definition of the constraints x1+ x2 hours x1 , x2

Graphical solution for LP Let choice a feasible point PI CH 1  CH + 1,5  PI = 18 14 12 2 4 6 8 10 16 18 1CH + 1PI = 14 (4,4) (4000 spanners e 4000 pliers) PTOT = 34 The profit PTOT is 4CH + 4,5PI = 34 (34000 €) Better solution must have a value of PTOT  34 The idea is looking for solutions that satisfy also the “new fictitious” constrait 4CH + 4,5PI  34.

Graphical solution for LP PI 1  CH + 1,5  PI = 18 14 12 2 4 6 8 10 16 18 1CH + 1PI = 14 CH 4  CH + 4,5  PI = 34 Draw the new feasible region F’ The profit PTOT is now 4CH + 4,5PI = 53 (53000 €) PTOT = 53 A better solution (if any) must be in the new feasible region F’ F’ Let choice (2,10). with Excel

Graphical solution for LP PI 1  CH + 1,5  PI = 18 14 12 2 4 6 8 10 16 18 1CH + 1PI = 14 4  CH + 4,5  PI = 53 The feasible region F” is more and more narrow (violet region) Behind this point (6,8) with PTOT = 60, there are non more feasible better points PTOT = 60 CH The point (6,8) is the best feasible one The region with the constraint PTOT > 60 is empty !!! Increasing values of PTOT

Graphical solution of LP: summary When the number of variables is two: Draw the constraints and the feasible region Choice a feasible point Draw the line of the objective function passing for this point Parallel move the line of the objective function in the direction of better values The last feasible point “touched” by the line is the optimal solution

Solution of LP Graphical solution can be applied only when the number of variables is two Real problems has usually more than two variables Computer must be used as a tool to tackle large quantities of data and arithmetic Many standard software exist to solve LP problems of different level of complexity We use Excel Solver (www.frontsys.com) http://www.frontsys.com/