Esittely latautuu. Ole hyvä ja odota

Esittely latautuu. Ole hyvä ja odota

4. Lecture Steps of programming decision problems see e.g. Eidhovenin university, http://www.imc.tue.nl/ Describe the management probem verbally (e.g.

Samankaltaiset esitykset


Esitys aiheesta: "4. Lecture Steps of programming decision problems see e.g. Eidhovenin university, http://www.imc.tue.nl/ Describe the management probem verbally (e.g."— Esityksen transkriptio:

1 4. Lecture Steps of programming decision problems see e.g. Eidhovenin university, Describe the management probem verbally (e.g. a paragraph of text) Formulate the decision problem mathematically Write the problem as a matlab m-file Debugging & reality checking Solve the problem and report the solution the context

2 Cost minimization, a static problem
Problem: The phosporus load to the Gulf of Finland draining from the catchment area of the Vantaanjoki river is 80,000 kg annually. The source of nutrient include the agricultural areas, forest, peatland, constructed and built areas and municipal waste water treatment plants. The loading can be reduced by activities and nutrient abatement measures in agriculture, forestry or point sources. The problem is to reduce the nutrient loads at the smallest possible cost and to develop a cost-effective combination of measures.

3 Area: 1686 km2 (0.5% of Finland) Populationj> 1 milj. Land use: Forest: ½ Agriculture: ¼ Built areas: 1/4

4 Mathematical model min 𝑥 𝑖 , 𝑖=1,…,𝑛 𝐶= 𝑖=1 𝑛 𝑐 𝑖 𝑥 𝑖 s.t. 0≤ 𝑥 i ≤1
𝐿 > 𝐿 0 − 𝑖=1 𝑛 𝑥 𝑖 𝐴 𝑚𝑎𝑥 ( 𝑥 1 ,…, 𝑥 𝑛 i index for nutrient abatement measures, i=1,…,n xi The level of implementation in relation to the maximum level (Amax), x=[0 1] ci (annual) cost of a measure i C Total cost 𝐿 Target nutrient load 𝐿 0 Initial nutrient load

5 Steps Define target level of loading
Find out a set of alternative, doable & feasible measures Estimate for each measure: Effectivity Cost (investment & maintenance, opportunity cost as relevant) Realistic boundaries (upper and lower boundaries) for implementation Find out cost-effective combination of measures simulation Optimization

6 https://www. google. fi/search

7

8

9 Set path to the work-folder
Save: work-folder Set path to the work-folder Open a new .m-file and save it with a name: vantaa_01.m Let’s start writing the code: Define state and decision variables Specify parameter values Effectivity of measures (start with only 2 measures) Define upper and lower bounds for the measures

10 cost = zeros(1,7); % costs of measures, €/year
% Variables cost = zeros(1,7); % costs of measures, €/year abat = zeros(1,7); % nutrient reduction , kg/year % indexes for measures % (1) Agriculture: reduced fertilization & gypsum % (2) Agriculture : catch crops % (3) Agriculture : Suojavyöhykkeet % (4) Agriculture : wetlands % (5) Forestry activities % (6) Investments in municipal waste waters % (7) Investments in sewege network (to reduce overflows) Vantaa_01.m, 1/1

11 Vantaa_01.m, 2/4 % Vector for the decision variables: V =[ ]; % V is a 1 x 6 vector that describes [0 1] how much of the total potential of each measures is implemented % Maximum impacts: maxPvah= [ ]; % Maximum reductions in terms of kg of P annually % Impacts of measures: abat = V.*maxPvah; % or abat(1,1) = V(1)*maxPvah(1,1); abat(1,2) = V(2)*maxPvah(1,2);

12 Vantaa_01.m, 3/4 % Costs % Marginal cost equations: % 1. measures for fertilization & application of gypsum: *exp( *x) % x = nutrient load reductions in kg % 2. catch crops: *exp( *x) % From marginal costs to total costs – integration % Approach 1: approximate numerically the total costs for measure 1: sumkust=0; for i=1:10 rajakust = ( *exp( *abat(1,1)*((i-1)/10))); sumkust = rajakust * abat(1,1)/10 + sumkust; end

13 Vantaa_01.m, 4/4 % Approach 2: anonymous function for marginal costs... % % input argument: (x) % function *exp( *x) *exp( *x); % lannoitus & kipsi *exp( *x); % nurmi & kasvipeitteisyys % anonyymi funktio sopii hyvin yhden rivin funktioille % laske esim. f1=500 % Kokonaiskustannukset (integroidaan rajakustannuskäyrää) cost(1,1) = quad(f1,0,abat(1,1)); cost(1,2) = quad(f2,0, abat(1,2));

14 % First model ready, yeah!
% Test the model: Compute total cost for implementation of two measures Compute total load reduction Compute average cost of load reduction % Alter the values of decision variables, and check how the total costs change % Make visualizations and sensitivity analysis (excersise 4/1- 4/2)

15 Excersise 4/1. Draw the marginal cost curve for the measure 1
figure % create new window for the figures xakseli = maxPvah(1,1)*(0:0.01:1); yakseli = f1(xakseli); plot(xakseli, yakseli); title('rajakustannukset') xlabel('kuormitusvähennys') ylabel(' €/kg')

16 Excersise 4/2. draw marginal cost curves for the two measures
close % sulkee aikaisemman kuvan % help plot % ... Tsekkaa syntaksi plot funktiolle figure xakseli = maxPvah(1,1)*(0:0.01:1); yakseli = f1(xakseli); xakseli2 = maxPvah(1,2)*(0:0.01:1); yakseli2 = f2(xakseli2); plot(xakseli, yakseli,'b', xakseli2, yakseli2,'r') % kaksi kuvaajaa title('rajakustannukset') xlabel('kuormitusvähennys') ylabel(' €/kg') Question: In which order should we adopt measures 1 and 2 according to visualization about the cost curve?

17 Excersise 4/3. draw marginal cost curves for the two measures
(a) Change the values of the two decision variables (V) at 0.1 interval in the range [0 1] and study their impacts on total cost and nutrient abatement. V(1) V(2) Total cost Total abatement 1 0.5 2 3 4 5 6 7 8 9 (b) Extra: draw 3 dimensional figures for both costs and total abatement: surf(V(1), V(2), total cost)

18 Cost-efficient combination of measures
Divide earlier developed model elements between two files: kustannus.m rajoitteet.m Optimizations: opt_vantaa1.m New element: global variables save…load

19 New file for finding cost efficient combination of measures under given nutrient reduction target
opt_vantaa1.m opt_vantaa1.m, 1/1 clear all global target target = 9000; % tavoite fosforin kuormitusvähennykselle X0 = [ ]; % alkuarvaus toimenpidevektorille LB = [0 0]; % alarajat toimenpiteille UB = [1 1]; % ylärajat toimenpoiteille [X,FVAL,EXITFLAG] =

20 kustannus.m, 1/1 FUNCTION FOR COMPUTING THE COSTS function [totalcosts] = kustannus(V) % KUSTANNUKSET cost = zeros(1,6); % toimenpiteiden kustannukset, €/vuosi *exp( *x); % lannoitus & kipsi *exp( *x); % nurmi & kasvipeitteisyys maxPvah= [ ]; cost(1,1) = quad(f1,0,V(1)*maxPvah(1)); cost(1,2) = quad(f2,0,V(2)*maxPvah(2)); totalcosts = sum(cost); end

21 rajoitteet.m, 1/1 RAJOITTEET OMAKSI .m TIEDOSTOKSI function [c,ceq] = rajoitteet(V) global target V(1,3:6)=0; % Maksimivähennykset (typpikiloa vuodessa) joilla toimenpiteitä täysimittaisesti soveltamalla typen kuormitusta voidaan vähentää maxPvah= [ ]; % VAIKUTTAVUUS - Vähennys typpikuormituksesta abat = V.*maxPvah; c = target-sum(abat); ceq = []; end

22 Excersise 4/4. Compute optimal combination of measures for different nutrient load targets
… and draw figures Optimal levels of implementation for the two measures as function of the target level of nutrient reduction (up to 20,000 kg) Total cost as function of target level of nutrient reduction

23 For sensitivity analysis, you could also use for-loop
opt_vantaa1b.m, 1/1 clear all global target X0 = [ ]; % alkuarvaus toimenpidevektorille LB = [0 0]; % alarajat toimenpiteille UB = [1 1]; % ylärajat toimenpoiteille tulokset = []; for i=1:100 target = i*200; [X,FVAL,EXITFLAG] = tulokset =[tulokset;target X FVAL]; end save ajo1


Lataa ppt "4. Lecture Steps of programming decision problems see e.g. Eidhovenin university, http://www.imc.tue.nl/ Describe the management probem verbally (e.g."

Samankaltaiset esitykset


Iklan oleh Google