An Extended Mathematical Programming Framework Extended Mathematical Programming Framework ......

of 43 /43
An Extended Mathematical Programming Framework Michael C. Ferris University of Wisconsin, Madison Computing with Uncertainty, IMA, October 21, 2010 Ferris (Univ. Wisconsin) EMP IMA, October 2010 1 / 35

Embed Size (px)

Transcript of An Extended Mathematical Programming Framework Extended Mathematical Programming Framework ......

  • An Extended Mathematical Programming Framework

    Michael C. Ferris

    University of Wisconsin, Madison

    Computing with Uncertainty, IMA, October 21, 2010

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 1 / 35

  • Optimal Power Flow

    OPF(): miny energy dispatch cost (y , )s.t. conservation of power flow at nodes

    Kirchoffs voltage law, and simple bound constraints

    are (given) price bids, parametric optimization

    Leader(i ): maxi ,y , firm i s profit (i , y , )s.t. 0 i i

    y solves OPF(i , i )

    Note that objective involves multiplier from OPF problem

    Leader(i ): maxi ,y , firm i s profit (y , , )s.t. 0 i i

    (y , ) solves KKT(OPF(i , i ))

    This is an example of an MPCC since KKT form complementarityconstraints

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 2 / 35

  • Optimal Power Flow

    OPF(): miny energy dispatch cost (y , )s.t. conservation of power flow at nodes

    Kirchoffs voltage law, and simple bound constraints

    are (given) price bids, parametric optimization

    Leader(i ): maxi ,y , firm i s profit (i , y , )s.t. 0 i i

    y solves OPF(i , i )

    Note that objective involves multiplier from OPF problem

    Leader(i ): maxi ,y , firm i s profit (y , , )s.t. 0 i i

    (y , ) solves KKT(OPF(i , i ))

    This is an example of an MPCC since KKT form complementarityconstraints

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 2 / 35

  • Optimal Power Flow

    OPF(): miny energy dispatch cost (y , )s.t. conservation of power flow at nodes

    Kirchoffs voltage law, and simple bound constraints

    are (given) price bids, parametric optimization

    Leader(i ): maxi ,y , firm i s profit (i , y , )s.t. 0 i i

    y solves OPF(i , i )

    Note that objective involves multiplier from OPF problem

    Leader(i ): maxi ,y , firm i s profit (y , , )s.t. 0 i i

    (y , ) solves KKT(OPF(i , i ))

    This is an example of an MPCC since KKT form complementarityconstraints

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 2 / 35

  • Multi-player EPEC and security constraints

    (1, 2, . . . , m) is an equilibrium if

    i solves Leader(i ), i

    (Nonlinear) Nash Equilibrium where each player solves an MPCC

    MPCC is hard (lacks a constraint qualification)

    Nash Equilibrium is PPAD-complete (Chen et al, Papadimitriou et al)

    In practice, also require contingency (scenario) constraints imposed inthe OPF problem

    Model involves: complementarity, hierarchy, interacting agents, riskmeasures

    How to convey and exploit such model structure

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 3 / 35

  • Multi-player EPEC and security constraints

    (1, 2, . . . , m) is an equilibrium if

    i solves Leader(i ), i

    (Nonlinear) Nash Equilibrium where each player solves an MPCC

    MPCC is hard (lacks a constraint qualification)

    Nash Equilibrium is PPAD-complete (Chen et al, Papadimitriou et al)

    In practice, also require contingency (scenario) constraints imposed inthe OPF problem

    Model involves: complementarity, hierarchy, interacting agents, riskmeasures

    How to convey and exploit such model structure

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 3 / 35

  • Complementarity Problems via Graphs

    T = NR+ = (R+ {0})

    ({0} R)

    y T () (,y) T 0 y 0

    By approximating (smoothing) graph can generate interior pointalgorithms for example y = , y , > 0

    F (x) NRn+(x) (x ,F (x)) Tn 0 x F (x) 0

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 4 / 35

  • Complementarity Systems (DVI)

    dxdt (t) = f (x(t), (t))

    y(t) = h(x(t), (t))

    0 y(t) (t) 0

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 5 / 35

  • Complementarity Systems (DVI)

    dxdt (t) = f (x(t), (t))

    y(t) = h(x(t), (t))

    0 y(t) (t) 0

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 5 / 35

  • Complementarity Systems (DVI)

    dxdt (t) = f (x(t), (t))

    y(t) = h(x(t), (t))

    ((t),y(t)) T

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 6 / 35

  • Operators and Graphs (X = [1, 1])

    xi = 1,Fi (x) 0 or xi (1, 1),Fi (x) = 0 or xi = 1,Fi (x) 0

    ComplementaritySystems

    Ferris(Univ.Wisconsin)

    EMP

    NonsmoothSchool,June2010

    2/42 Complementarity Systems

    Ferris (Univ. Wisconsin) EMP Nonsmooth School, June 2010 2 / 42

    Complementarity Systems

    Ferris (Univ. Wisconsin) EMP Nonsmooth School, June 2010 2 / 42

    T () T 1(y) (I + T )1(y) = PT (y)

    PT (y) is the projection of y onto [`, u]

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 7 / 35

  • Generalized Equations

    Suppose T is a maximal monotone operator

    0 F (z) + T (z) (GE )

    Define PT = (I + T )1

    If T is polyhedral (graph of T is a finite union of convex polyhedralsets) then PT is piecewise affine (continous, single-valued,non-expansive)

    0 F (z) + T (z) z F (z) + I(z) + T (z) z F (z) (I + T )(z) PT (z F (z)) = z

    Use in fixed point iterations (cf projected gradient methods)

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 8 / 35

  • Splitting Methods

    Suppose T is a maximal monotone operator

    0 F (z) + T (z) (GE )

    Can devise Newton methods (e.g. SQP) that treat F via calculus andT via convex analysisAlternatively, can split F (z) = A(z) + B(z) (and possibly T also) sowe solve solve (GE) by solving a sequence of problems involving just

    T1(z) = A(z) and T2(z) = B(z) + T (z)

    where each of these is simpler

    Forward-Backward splitting:

    zk+1 = (I + ckT2)1 (I ckT1)

    (zk),

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 9 / 35

  • Normal Map

    Suppose T is a maximal monotone operator

    0 F (z) + T (z) (GE )

    Define PT = (I + T )1

    0 F (z) + T (z) z F (z) + I(z) + T (z) z F (z) = y and y (I + T )(z) z F (z) = y and PT (y) = z PT (y) F (PT (y)) = y 0 = F (PT (y)) + y PT (y)

    This is the so-called Normal Map Equation

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 10 / 35

  • Normal manifold = {Fi + NFi}

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 11 / 35

  • C = {z |Bz b},F (z) = Mz + q

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 12 / 35

  • Cao/Ferris Path (Eaves)

    Start in cell that has interior(face is an extreme point)

    Move towards a zero ofaffine map in cell

    Update direction when hitboundary (pivot)

    Solves or determinesinfeasible if M iscopositive-plus on rec(C )

    Solves 2-person bimatrixgames, 3-person games too,but these are nonlinear

    Cao/Ferris Path (Eaves) Start in cell that has

    interior (face is an extreme point)

    Move towards a zero of affine map in cell

    Update direction when hit boundary

    Solves or determines infeasible if M is copositive-plus on rec(C)

    Nails 2-person game

    But algorithm has exponential complexity (von Stengel et al)

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 13 / 35

  • Extensions and Computational Results

    Embed AVI solver in a Newton Method - each Newton step solves anAVI

    Compare performance of PathAVI with PATH on equivalent LCP

    PATH the most widely used code for solving MCP

    AVIs constructed to have solution with Mnn symmetric indefinite

    PathAVI PATHSize (m,n) Resid Iter Resid Iter

    (180, 60) 3 1014 193 0.9 10176(360, 120) 3 1014 1516 2.0 10594

    2 - 10x speedup in Matlab using sparse LU instead of QR

    2 - 10x speedup in C using sparse LU updates

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 14 / 35

  • But who cares?

    Why arent you using my *********** algorithm?(Michael Ferris, Boulder, CO, 1994)

    Show me on a problem like mine

    Must run on defaults

    Must deal graciously with poorly specified cases

    Must be usable from my environment (Matlab, R, GAMS, ...)

    Must be able to model my problem easily

    EMP provides annotations to an existing optimization model that conveynew model structures to a solver

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 15 / 35

  • But who cares?

    Why arent you using my *********** algorithm?(Michael Ferris, Boulder, CO, 1994)

    Show me on a problem like mine

    Must run on defaults

    Must deal graciously with poorly specified cases

    Must be usable from my environment (Matlab, R, GAMS, ...)

    Must be able to model my problem easily

    EMP provides annotations to an existing optimization model that conveynew model structures to a solver

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 15 / 35

  • EMP(i): MPCC: complementarity constraints

    minx ,s

    f (x , s)

    s.t. g(x , s) 0,0 s h(x , s) 0

    g , h model engineering expertise: finite elements, etc

    models complementarity, disjunctionsComplementarity constraints available in AIMMS, AMPL andGAMS

    NLPEC: use the convert tool to automatically reformulate as aparameteric sequence of NLPs

    Solution by repeated use of standard NLP softwareI Problems solvable, local solutions, hard

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 16 / 35

  • EMP(i): MPCC: complementarity constraints

    minx ,s

    f (x , s)

    s.t. g(x , s) 0,0 s h(x , s) 0

    g , h model engineering expertise: finite elements, etc

    models complementarity, disjunctionsComplementarity constraints available in AIMMS, AMPL andGAMS

    NLPEC: use the convert tool to automatically reformulate as aparameteric sequence of NLPs

    Solution by repeated use of standard NLP softwareI Problems solvable, local solutions, hard

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 16 / 35

  • EMP(ii): Hierarchical models

    Bilevel programs:

    minx,y

    f (x, y)

    s.t. g(x, y) 0,y solves min

    yv(x, y) s.t. h(x, y) 0

    model bilev /deff,defg,defv,defh/;empinfo: bilevel min v y defv defh

    EMP tool automatically creates the MPCC

    minx,y,

    f (x, y)

    s.t. g(x, y) 0,0 v(x, y) + Th(x, y) y 00 h(x, y) 0

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 17 / 35

  • Large scale example: bioreactor (with Niebel)

    Challenge

    Formulating an optimization problem that allows the estimation of thedynamic changes in intracellular fluxes based on measured externalbioreactor concentrations.

    Approach

    Using existing constraint-based stoichiometric models of the cellularmetabolism to formulate a bilevel dynamic optimization problem.

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 18 / 35

  • Dynamic optimizationApproach:The different timescales of the metabolism (fast) and the reactor growth(slow), allows to assume steady-state for the metabolism.

    minimize / maximize Objective (eg. parameter tting)

    s. t.

    s. t.

    bioreactor dynamics

    maximize growth rate

    stoichiometric constraints

    ux constraints

    constraints on exchange uxes

    Different mathematical programming techniques are used to transform theproblem to a nonlinear program. The differential equations aretransformed into nonlinear constraints using collocation methods.

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 19 / 35

  • The overall scheme!

    Collection of algebraic equations

    Form a bilevel program via emp

    EMP tool automatically creates the MPCC (model transformation)

    NLPEC tool automatically creates (a series of) NLP models (modeltransformation)

    GAMS automatically rewrites NLP models for global solution viaBARON (model transformation)

    Is this global? Whats the hitch?

    Note that heirarchical structure is available to solvers for analysis orutilization

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 20 / 35

  • The overall scheme!

    Collection of algebraic equations

    Form a bilevel program via emp

    EMP tool automatically creates the MPCC (model transformation)

    NLPEC tool automatically creates (a series of) NLP models (modeltransformation)

    GAMS automatically rewrites NLP models for global solution viaBARON (model transformation)

    Is this global? Whats the hitch?

    Note that heirarchical structure is available to solvers for analysis orutilization

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 20 / 35

  • Variational inequalities

    Find z X such that

    0 F (z) +NX (z)

    Many applications where F is not the derivative of some f

    model vi / F, g /;empinfo: vifunc F z

    Convert problem into complementarity problem by introducingmultipliers on representation of X

    Can now do MPEC (as opposed to MPCC)!

    Projection algorithms, robustness (evaluate F only at points in X )

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 21 / 35

  • EMP(iii): Embedded modelsModel has the format:

    Agent o: minx

    f (x , y)

    s.t. g(x , y) 0 ( 0)

    Agent v: H(x , y , ) = 0 ( y free)

    Difficult to implement correctly (multiple optimization models)Can do automatically - simply annotate equationsempinfo: equilibriummin f x defgvifunc H y dualvar defgEMP tool automatically creates an MCP

    x f (x , y) + Tg(x , y) = 00 g(x , y) 0

    H(x , y , ) = 0

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 22 / 35

  • World Bank Project (Uruguay Round)

    24 regions, 22 commoditiesI Nonlinear complementarity

    problemI Size: 2200 x 2200

    Short term gains $53 billion p.a.I Much smaller than previous

    literature

    Long term gains $188 billion p.a.I Number of less developed

    countries loose in short term

    Unpopular conclusions - forcedconcessions by World Bank

    Region/commodity structure notapparent to solver

    Application: Uruguay Round World Bank Project with

    Harrison and Rutherford 24 regions, 22 commodities

    2200 x 2200 (nonlinear) Short term gains $53 billion p.a.

    Much smaller than previous literature

    Long term gains $188 billion p.a. Number of less developed

    countries loose in short term Unpopular conclusions forced

    concessions by World Bank

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 23 / 35

  • Nash Equilibria

    Nash Games: x is a Nash Equilibrium if

    xi arg minxiXi

    `i (xi , xi , q),i I

    xi are the decisions of other players.

    Quantities q given exogenously, or via complementarity:

    0 H(x , q) q 0

    empinfo: equilibriummin loss(i) x(i) cons(i)vifunc H q

    Applications: Discrete-Time Finite-State Stochastic Games.Specifically, the Ericson & Pakes (1995) model of dynamiccompetition in an oligopolistic industry.

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 24 / 35

  • Key point: models generated correctly solve quicklyHere S is mesh spacing parameter

    S Var rows non-zero dense(%) Steps RT (m:s)

    20 2400 2568 31536 0.48 5 0 : 0350 15000 15408 195816 0.08 5 0 : 19100 60000 60808 781616 0.02 5 1 : 16200 240000 241608 3123216 0.01 5 5 : 12

    Convergence for S = 200 (with new basis extensions in PATH)

    Iteration Residual

    0 1.56(+4)1 1.06(+1)2 1.343 2.04(2)4 1.74(5)5 2.97(11)

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 25 / 35

  • General Equilibrium models

    (C ) : maxxkXk

    Uk(xk) s.t. pT xk ik(y , p)

    (I ) :ik(y , p) = pTk +

    j

    kjpTgj(yj)

    (P) : maxyjYj

    pTgj(yj)

    (M) : maxp0

    pT

    k

    xk k

    k

    j

    gj(yj)

    s.t. l

    pl = 1

    Can reformulate as embedded problem (Ermoliev et al):

    maxxX ,yY

    k

    tkk

    log Uk(xk)

    s.t.k

    xk k

    k +

    j

    gj(yj)

    tk = ik(y , p) where p is multiplier on NLP constraint

    Leads to sequential joint maximization algorithm (Rutherford)

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 26 / 35

  • General Equilibrium models

    (C ) : maxxkXk

    Uk(xk) s.t. pT xk ik(y , p)

    (I ) :ik(y , p) = pTk +

    j

    kjpTgj(yj)

    (P) : maxyjYj

    pTgj(yj)

    (M) : maxp0

    pT

    k

    xk k

    k

    j

    gj(yj)

    s.t. l

    pl = 1

    Can reformulate as embedded problem (Ermoliev et al):

    maxxX ,yY

    k

    tkk

    log Uk(xk)

    s.t.k

    xk k

    k +

    j

    gj(yj)

    tk = ik(y , p) where p is multiplier on NLP constraint

    Leads to sequential joint maximization algorithm (Rutherford)Ferris (Univ. Wisconsin) EMP IMA, October 2010 26 / 35

  • Competing agent models (with Wets)

    Competing agents (consumers, or generators in energy market)

    Each agent maximizes objective independently (utility)

    Market prices are function of all agents activities

    Additional twist: model must hedge against uncertainty

    Facilitated by allowing contracts bought now, for goods delivered later

    Conceptually allows to transfer goods from one period to another(provides wealth retention or pricing of ancilliary services in energymarket)

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 27 / 35

  • The model details: c.f. Brown, Demarzo, EavesEach agent maximizes:

    uh =

    s

    s

    (

    l

    ch,lh,s,l

    )Time 0:

    dh,0,l = ch,0,l eh,0,l ,

    l

    p0,ldh,0,l +k

    qkzh,k 0

    Time 1:

    dh,s,l = ch,s,l eh,s,l k

    Ds,l ,k zh,k ,

    l

    ps,ldh,s,l 0

    Additional constraints (complementarity) outside of control of agents:

    0 h

    zh,k qk 0

    0 h

    dh,s,l ps,l 0Ferris (Univ. Wisconsin) EMP IMA, October 2010 28 / 35

  • EMP(iv): Stochastic programming and risk measures

    SP: min c>x + E[d>y ]

    s.t. Ax = b

    T ()x + W ()y() h(), for all ,

    x 0, y() 0, for all .

    Annotations are slightly more involved but straightforward:

    Need to describe probability distribution

    Define (multi-stage) structure (what variables and constraints belongto each stage)

    Define random parameters and process to generate scenarios

    Can also define risk measures on variables

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 29 / 35

  • EMP(iv): Stochastic programming and risk measures

    SP: min c>x + R[d>y ]

    s.t. Ax = b

    T ()x + W ()y() h(), for all ,

    x 0, y() 0, for all .

    Annotations are slightly more involved but straightforward:

    Need to describe probability distribution

    Define (multi-stage) structure (what variables and constraints belongto each stage)

    Define random parameters and process to generate scenarios

    Can also define risk measures on variables

    Automatic reformulation (deterministic equivalent), solvers such asDECIS, etc.

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 30 / 35

  • EMP(v): Extended nonlinear programs

    minxX

    f0(x)+(f1(x), . . . , fm(x))

    Examples of different

    least squares, absolute value, Huber functionSolution reformulations are very differentHuber function used in robust statistics.

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 31 / 35

  • More general functions

    In general any piecewise linear penalty function can be used: (differentupside/downside costs).General form:

    (u) = supyY{yTu k(y)}

    nonsmooth due to the max term; separable in example. is always convex.

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 32 / 35

  • First order conditions

    Solution via reformulation. One way:

    0 xL(x , y) + NX (x)0 yL(x , y) + NY (y)

    NX (x) is the normal cone to the closed convex set X at x .

    Automatically creates an MCP (or a VI)

    Already available!

    To do: extend X and Y beyond simple bound sets.

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 33 / 35

  • Alternative Reformulations

    Convert does symbolic/numeric reformulations. Alternative NLPformulations also possible.

    k(y) =1

    2y Qy , X = {x : Rx r} , Y =

    {y : S y s

    }Defining

    Q = DJ1D , F (x) = (f1(x), . . . , fm(x))

    min f0(x) + sz + 12wJw

    s.t. Rx r , z 0,F (x) Sz Dw = 0

    Can set up better (solver) specific formulation.

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 34 / 35

  • Conclusions

    Modern optimization within applications requires multiple modelformats, computational tools and sophisticated solvers

    EMP model type is clear and extensible, additional structure availableto solver

    Extended Mathematical Programming available within the GAMSmodeling system

    Able to pass additional (structure) information to solvers

    Embedded optimization models automatically reformulated forappropriate solution engine

    Exploit structure in solvers

    Extend application usage further

    Ferris (Univ. Wisconsin) EMP IMA, October 2010 35 / 35

    MotivationExtended Mathematical ProgrammingMPCCHierarchical ModelsBioreactorVariational InequalitiesEmbedded modelsNash EquilibriaStochastic ProgrammingExtended Nonlinear Programming

    Conclusions