A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model 1 • ACCEL (continued) • a 4 categories model • dominance and Pareto optimality • strength algorithm • Examples A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: a four-categories model •to-do list keeps track of incomplete expressions •to-do list empty: script is compiled •script compiles correctly: script starts running 2 A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: a four-categories model •quantities are automatically categorized: •x=17 constant: cat. III •x=slider(3,0,10) user input: cat I •x not in right hand part: output only: cat. II •otherwise: cat. IV 3 A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: a four-categories model •Category I: •slider (number), checkbox (boolean), button (boolean event), input (arbitrary), cursorX, cursorY, cursorB •cannot occur in expressions: a=slider(10,0,20) *p •slider with integer parameters gives integer results •slider with 1 float parameter gives float results 4 A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: a four-categories model 5 •Category I: •to use slider for non-numeric input: r=[ch0, ch1, ch2, …, chn] myChoice=slider(0,0,n) p=r[myChoice] (p can have arbitrary properties) http://www.gulfdine.com/McDonald's_Markiya A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: a four-categories model •Category II: •all cat.-II quantities are given as output •dynamic models: p = f( p{1}, q{1} ) : p is not in cat.-II •to enforce a quantity in cat.-II: pp = p •visual output with 'descartes()'; this is a function and produces output cat.-II (usually 'plotOK') 6 A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: a four-categories model •Category II: •in IO/edit tab: show / hide values: values of all quantities •results output: (too …) few decimals 7 A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: a four-categories model •Category III: •cat.-III is automatically detected for numbers or strings •Cat-III is detected for expressions with constants only: X = 3 * sin (7.14 / 5) •don't use numerical constants in expressions: x = pricePerUnit * nrUnits x = 3.546 * nrUnits x = 2 * PI * r (built-in constants: PI and E) 8 A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: a four-categories model 9 •Category IV: •Expressions should be simple as possible: •Prefer y = x * p, p = z + t over y = x * (z+t) •when in doubt: inspect! •make temporary cat.-II quantity •(even) better trick: next week image: http://shyatwow.blogspot.nl/2010/11/bug-day-inspect-bugs.html A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: a four-categories model •Category IV: •efficiency: re-use common subexpressions •consider user defined functions image: http://mewantplaynow.blogspot.nl/ 10 A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: a four-categories model •Category IV: •efficiency: re-use common subexpressions •consider user defined functions u = a + b*log(c)*sin(d) v = e + b*log(c)*sin(d) term = b*log(c)*sin(d) u=a + term v=e + term 11 A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: a four-categories model •Category IV: •efficiency: re-use common subexpressions •consider user defined functions u = a + b*log(c)*sin(d) v = e + p*log(q)*sin(r) term(x,y,z) = x*log(y)*sin(z) u = a + term(b,c,d) v = e + term(p,q,r) 12 A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: dominance & pareto optimality image: http://hellnearyou.blogspot.nl/2010/06/aspria-managers-wantsubmission-from.html 13 A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model ACCEL: dominance & pareto optimality Dominance • Ordinal cat.-II quantities: • C1 dominates C2 C1.qi is better than C2.qi for all qi; • ‘better’: ‘<‘ (e.g., waste) or ‘>’ (e.g., profit); • more cat.-II quantities: fewer dominated solutions. 14 A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model ACCEL: dominance & pareto optimality Dominance • Ordinal cat.-II quantities: • C1 dominates C2 C1.qi is better than C2.qi for all qi; • ‘better’: ‘<‘ (e.g., waste) or ‘>’ (e.g., profit); • more cat.-II quantities: fewer dominated solutions. q2 15 C3 (e.g., waste) C2 C1 dominates C2 C1 dominates C3 C1 C2,C3: no dominance q1 (e.g., profit) A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model ACCEL: dominance & pareto optimality 16 Dominance • Only non-dominated solutions are relevant • Dominance: prune cat.-I space; • More cat.-II quantities: more none-dominated solutions • nr. cat.-II quantities should be small. image http://ornamentalplant.blogspot.nl/2011/07/trimming-pruning.html A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: dominance & pareto optimality Dominance in ACCEL • y=paretoMax(expression) enlist for maximum • y=paretoMin(expression) enlist for minimum • To use Pareto algorithm, express all conditions into penalties • For inspection of the results: Paretoplot paretoHor(x) paretoVer(x) 17 A Core Course on Modeling Week 5 – Roles of Quantities in a Functional Model ACCEL: dominance & pareto optimality Dominance in ACCEL myArea=paretoHor(paretoMax(p[myProv].area)) myPop=paretoVer(paretoMin(p[myProv].pop)) p=[Pgr,Pfr,Pdr,Pov,Pgl,Put,Pnh,Pzh,Pzl,Pnb,Pli] myProv=slider(0,0,11) myCap=p[myProv].cap Pfr=['cap':'leeuwarden','pop':647239,'area':5748.74] . . . Pli=['cap':'maastricht','pop':1121483,'area':2209.22] 18 A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model ACCEL: dominance & pareto optimality Dominance in ACCEL • Dominated areas: bounded by iso-cat.-II quantitiy lines; • Solutions in dominated areas: ignore; • Non-dominated solutions: Pareto front. D 19 A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model ACCEL: strength-algorithm 20 image: http://www.usdivetravel.com/T-BolivianAndesExpedition.html Optimization in practice •Find 'best' concepts in cat.-I space. •Mathematical optimization: singlevalued functions. •The 'mounteneer approach'; •Only works for 1 cat.-II quantity. A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model ACCEL: strength-algorithm Optimization in practice •Eckart Zitzler: Pareto + Evolution. •genotype = blueprint of individual (‘cat.-I’); •genotype is passed over to offspring; •genotype phenotype, determines fitness (‘cat.-II’); •variation in genotypes variation among phenotypes; •fitter phenotypes beter gene-spreading. 21 A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model ACCEL: strength-algorithm 22 Optimization in practice •Start: population of random individuals (tuples of values for cat.-I quantities); •Fitness: fitter when dominated by fewer; •Next generation: preserve non-dominated ones; •Complete population: mutations and crossing-over; •Convergence: Pareto front stabilizes. image: http://www.freakingnews.com/Mutation-Pictures---2317.asp A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model ACCEL: strength-algorithm 23 Optimization in practice: caveats •Too large % non-dominated concepts: no progress; •Find individuals in narrow niche: problematic; •Analytical alternatives may not exist •Need guarantee for optimal solution DON’T use Pareto-Genetic. image: http://glup.me/epic-fail-pics-serie-196 A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model ACCEL: strength-algorithm 24 Optimization in practice: brute force •If anything else fails: •local optimization for individual elements of the Pareto-front; •Split cat.-I space in sub spaces if model function behaves different in different regimes; •Temporarily fix some cat.-IV quantities (pretend that they are in category-III). http://www.square2marketing.com/Portals/112139/images/the-hulk-od-2003-resized-600.jpg A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model Examples 25 Optimal province: paretoMax 1 cat.-II quantity meaningful quantity, related to purpose spaciousness = area / population or area paretoMax population paretoMin 2 cat.-II quantities A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model Examples 26 Optimal street lamps: paretoMin 1 cat.-II quantity contrived not not too muchquantity, light related to purpose not too little light efficiency = power * penalty or power paretoMin penalty paretoMin 2 cat.-II quantities A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model Examples Optimal street lamps: dL=slider(25.5,5,50) h=slider(5.5,3,30) p=slider(500.1,100,2000) intPenalty=paretoMin(paretoHor(min(minP,minInt)+max(maxP,maxInt)-(maxP-minP))) roadLength=40 roadWidth=15 . . . problem: too slow to do optimization 27 A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model Examples Optimal street lamps: dL=slider(25.5,5,50) h=slider(5.5,3,30) p=slider(500.1,100,2000) intPenalty=paretoMin(paretoHor(min(minP,minInt)+max(maxP,maxInt)-(maxP-minP))) roadLength=40 • Minimal • Minimal roadWidth=15 intensity • Maximal • Maximal intensity to computed . . . intensity intensity see road marks by the model tnot to be computed by the blinded model problem: too slow to do optimization 28 A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model Examples Optimal street lamps: dL=slider(25.5,5,50) h=slider(5.5,3,30) p=slider(500.1,100,2000) intPenalty=paretoMin(paretoHor(min(minP,minInt)+max(maxP,maxInt)-(maxP-minP))) roadLength=40 roadWidth=2 . . . problem: awkward metric in cat.-II space too slow to do optimization use symmetry 29 A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model Examples 30 intPenalty Optimal street lamps: minInt maxInt dL=slider(25.5,5,50) h=slider(5.5,3,30) minP p=slider(500.1,100,2000) intPenalty=paretoMin(paretoHor(log(0.00001min(minP,minInt)+max(maxP,maxInt)-(maxP-minP)))) roadLength=40 roadWidth=2 . . . maxP problem: border awkward optima metric ??? in cat.-II space scale penalty A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model Examples Optimal street lamps: dL=slider(25.5,5,50) h=slider(5.5,1,30) p=slider(500.1,50,2000) intPenalty=paretoMin(paretoHor(log(0.00001min(minP,minInt)+max(maxP,maxInt)-(maxP-minP)))) roadLength=40 roadWidth=2 . . . problem: border optima ??? expand cat.-I ranges 31 A Core Course on Modeling Week 5-Roles of Quantities in a Functional Model Examples Optimal street lamps: Summary: •check if model exploits symmetries •check if penalty functions represent intuition •check if optima are not on arbitrary borders •keep thinking: interpret trends (h 0, l0 … 1D approximation …?) 32