c cientific omputing ADiCape in a large-scale industrial problem Monika Petera, Martin Bücker, Arno Rasch Institute for Scientific Computing RWTH Aachen University AD Workshop - Nice 2005 AACHEN
c cientific Optimization Problem omputing The Model: A system of differential and algebraic equations (DAE): M = & x F ( x ( p , t ), t ) where: x - set of state variables x p - subset of parameters from Goal: Φ min ( x ( p , t ), p , t ) To minimize the objective function: f p t at the final time f AD Workshop - Nice 2005 AACHEN
c cientific Modeling languages omputing A model can be written in a one of modeling languages, e.g. gPROMS, Modelica , and is usually represented as a system of mathematical equations An equation oriented approach does not make any assumptions about how to solve a model or what quantities are considered known and unknown. CapeML – A Common Model Exchange Language for Chemical Process Modeling designed for supporting the modeling process. CapeML is a neutral model exchange representation based on the XML standard. “CapeML – A Model Exchange Language for Chemical Process Modeling” - L.v.Wedel (TR May 2002) AD Workshop - Nice 2005 AACHEN
c cientific A fragment of CapeML code omputing <Equation> <BalancedEquation myID="V-0"> alpha = sin( ) <Expression> beta <Term> <Factor> <FunctionCall fcn.name=“sin"> <Expression> <Term> <Expression> <Factor> <Term> <VariableOccurrence <Factor> definition="V-car-alpha“/> <VariableOccurrence </Factor> definition="V-car-beta“/> </Term> </Factor> </Expression> </Term> </FunctionCall> </Expression> </Factor> </BalancedEquation> </Term> </Equation> </Expression> AD Workshop - Nice 2005 AACHEN
DyOS- Dynamic Optimization c cientific Software omputing Process System Engineering RWTH Aachen University takes 90% of the computational time DAE model server commercial ESO CapeML ESO ( Equation Set Object) - an internal representation of the computation tree. AD Workshop - Nice 2005 AACHEN
c cientific The model of the Distillation Column omputing The model consists of 3 submodels: Condenser • Swamp (1) • Condenser (1) • Tray (4) and a set of connecting equations. Tray 1 Tray 2 Vapour_outlet Liquid_inlet Tray 3 Tray 4 Swamp AD Workshop - Nice 2005 AACHEN
c cientific Jacobian sparsity structure omputing nV connecting equations # equations = 206 nF nF Tray (4) Swamp # variables = nV 410 Condenser # nonzeros = 919 ≈ nnz 1 . 1 % AD Workshop - Nice 2005 AACHEN
c cientific Newton Step omputing LU- scaled system state variables: Jacobian matrix − = − 1 ∂ x ( p ) x ( p ) ( LU ) F ( x ( p )) F ( x ( p , t )) M = − + 0 k 1 k k LU ∂ x h j ⋅ ∆ = ( LU ) x ( p ) F ( x ( p )) + k 1 k d d = x ( p ) s ( p ) k k dp dp derivatives: ∂ ∂ F x ( p ) ⋅ ∆ = k ( LU ) s ( p ) + ∂ ∂ k 1 x ( p ) p k ⎛ ⎞ ∂ F ⎜ ⎟ − = − ⋅ 1 s ( p ) s ( p ) ( LU ) s ( p ) ⎜ ⎟ + ∂ k 1 k k ⎝ ⎠ x ( p ) k AD Workshop - Nice 2005 AACHEN
c cientific Integration Algorithm omputing Process System Engineering ∂ RWTH Aachen University = Compute ( ( , )) A F x p ∂ 0 0 x for j =1,..., j max while convergence criterion not satisfied = h H / n j j M = − LU A Reuse LU 0 h j decomposition for k =0,..., j -1 = − − 1 x x ( LU ) F ( x ( p )) + k 1 k k ⎛ ⎞ dF ( x ( p )) ⎜ ⎟ − = − ⋅ 1 k s s ( LU ) s ⎜ ⎟ + k 1 k k ⎝ ⎠ dx k AD seeding M. Schlegel and W. Marquardt and R. Ehrig and U. Nowak: s with k “Sensitivity Analysis of Linearly-implicit Differential-algebraic Systems by One-step Extrapolation” 2004 AD Workshop - Nice 2005 AACHEN
model server c cientific ESO of DAE System ESO CapeML omputing Modeling languages model.mo Transform to CapeML CapeML model.xml XML init_vars.xml ESO AD Workshop - Nice 2005 AACHEN
XSLT – Transform language c cientific omputing ADiCape is based on XSLT Transformation Language. On any XML-based language document eg. in CapeML, an XSLT stylesheet is applied, to generate new document. CapeML document transformed XSLT CapeML processor Stylesheet ADiCape consists of 2 XSLT Stylesheets (at the moment) AD Workshop - Nice 2005 AACHEN
c cientific ADiCape_var.xsl omputing ⎡ ⎤ = ⎡ ⎤ v g _ Temp [ 1 ] 0 1 ⎢ ⎥ ⎢ ⎥ ... ⎢ ⎥ ... XML ⎢ ⎥ gradients ⎢ ⎥ = = ∇ = ⎢ ⎥ = V v Temp Temp g _ Temp [ 22 ] 1 22 ⎢ ⎥ for the dF/dTemp init_vars.xml ⎢ ⎥ ... ⎢ ⎥ ... ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ = ⎣ ⎦ v ⎣ ⎦ g _ Temp [ 410 ] 0 410 name="S.Temp" < Variable myID="V_m_S.Temp" name="S.Temp" varID="V_SWAMP_Temp" view=“ovar"> <Experiment number="1" initial_value="85" result_value="0"/> ADiCape_var.xsl dimension="410" name="S.g_Temp" index="22" < Vector name="S.g_Temp" varID="V_SWAMP_g_Temp" dimension="410" view=“ovar"> initial_value="1" < VectorVariable myID="V_m_S.g_Temp[22]" name="S.g_Temp[22]" index="22" > <Experiment number="1" initial_value="1" result_value="0"/> AD Workshop - Nice 2005 AACHEN
c cientific ADiCape omputing Modeling languages model.mo Transform to CapeML XSLT CapeML XML CapeML ADiCape_eq model.xml g_init_vars.xml g_model.xml XML XSLT init_vars.xml ADiCape_var ESO AD Workshop - Nice 2005 AACHEN
c cientific ADiCape_eq.xsl omputing Templates: <Equation> <BalancedEquation myID="V-0"> <xsl:template match="Equation"> chain rule of differentiation: <Distribution domain="V-g_i"/> <xsl:template match=“Expression"> = ⋅ <Expression> f ( g ( x ))' f ' ( g ( x )) g ' ( x ) <xsl:template match=“FunctionCall"> <Term> <xsl:template match="VariableOccurence"> <Factor> <FunctionCall fcn.name=“cos"> <Equation> <Expression> <BalancedEquation myID="V-0"> <Term> <Expression> function intrinsic: differentiation of math-operations: <Factor> <Term> <VariableOccurrence ± = ± <Factor> f f ' ( f g )' f ' g ' definition="V-car-alpha“/> <FunctionCall fcn.name=“sin"> </Factor> <Expression> sin( expr ) cos( expr ) </Term> ⋅ = ⋅ ⋅ + ⋅ <Term> ( f g )' f ' g f g ' </Expression> <Factor> − cos( expr ) sin( expr ) </FunctionCall> <VariableOccurrence </Factor> definition="V-car-alpha“/> ' 1 ⎛ ⎞ ⋅ − ⋅ <Factor mul.op=“MUL”> ' ' f f g f g </Factor> ln( ) expr ⎜ ⎟ = <VariableOccurrence ⎟ ⎜ </Term> ( expr ) definition="V-car-g_alpha“/> 2 ⎝ ⎠ g g </Expression> <DomainOccurrence domain=“V-g_i"/> </FunctionCall> ... ... </Factor> </Factor> </Term> </Term> AD Workshop - Nice 2005 </Expression> AACHEN </Expression> … …
c cientific ESO for the differentiated DAE omputing Modeling languages model.mo Transform to CapeML XSLT XML CapeML XML CapeML g_init_vars.xml ADiCape_eq model.xml g_init_vars.xml g_model.xml XML XSLT init_vars.xml ADiCape_var ESO g_ESO AD Workshop - Nice 2005 AACHEN
model server c cientific XML ESO ESO CapeML omputing original DAE First derivatives ADiCape: ESO g_ESO Full Jacobian Jacobian times Matrix Call Call m_eso m_g_eso XML ESO Sparse Jacobian matrices with known sparsity pattern: � do not calculate “zeros” get ( F ' ) get ( F ) Call � cut down number of operations � save space DyOS AD Workshop - Nice 2005 AACHEN
c cientific Matrix compression omputing BUT HOW ?? Sparsity aware seeding with CPR – Curtis-Powell-Reid graph-coloring method! AD Workshop - Nice 2005 AACHEN
c cientific Sparsity aware seeding omputing 206 = * 410 13 dF dF ⋅ seed seed dx dx AD Workshop - Nice 2005 13 AACHEN
c cientific Compressed Full Jacobian omputing size time 2.8 GHz Pentium 4 512MB cash full 206x410 55 min compressed 206x13 3.4 s 2 ≈ factor 31.5 970 ?! ( 31 . 5 970 ) AD Workshop - Nice 2005 AACHEN
c cientific Future Work omputing original DAE First derivatives Second derivatives ESO g_ESO h_ESO Call Call change DyOS System: m_eso m_g_eso � new Optimizer (IPOPT)* which uses 2nd derivatives XML ESO � change Integration Algorithm get ( F ' ) get ( F ) Call * A. Wächter and L. T. Biegler: “On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale DyOS Nonlinear Programming”, 2004 AD Workshop - Nice 2005 AACHEN
Recommend
More recommend