Upload
emilio-lopez-cano
View
1.088
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Presentation at the Use R! 2012 Conference (Nashville, TN, June 2012)
Citation preview
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 1/1
Decision Making under Uncertainty:R implementation for Energy Efficient Buildings
Emilio L. Cano1 Javier M. Moguerza1
1Department of Statistics and Operations ResearchUniversity Rey Juan Carlos, Spain
The 8th International R Users Meeting
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 2/1
Outline
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 3/1
Outline
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 4/1
Introduction
The model described in this talk has been developed withinthe project EnRiMa: Energy Efficiency and Risk Managementin Public Buildings, funded by the EC.
The overall objective of EnRiMa is to develop adecision-support system (DSS) for operators ofenergy-efficient buildings and spaces of public use.
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 4/1
Introduction
The model described in this talk has been developed withinthe project EnRiMa: Energy Efficiency and Risk Managementin Public Buildings, funded by the EC.
The overall objective of EnRiMa is to develop adecision-support system (DSS) for operators ofenergy-efficient buildings and spaces of public use.
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 5/1
Consortium
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 6/1
Outline
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 7/1
EnRiMa DSS
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 8/1
Outline
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 9/1
Optimization Scope
Strategic Model
Strategic decisions concerningwhich technologies to installand/or decommission in the longterm
Operational Model
Energy portfolio selection in theshort term
Interaction
The strategic model includesa simplified version ofoperational energy-balanceconstraints
The operational modelincludes the realisation ofthe strategic decisions asparameters
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 9/1
Optimization Scope
Strategic Model
Strategic decisions concerningwhich technologies to installand/or decommission in the longterm
Operational Model
Energy portfolio selection in theshort term
Interaction
The strategic model includesa simplified version ofoperational energy-balanceconstraints
The operational modelincludes the realisation ofthe strategic decisions asparameters
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 9/1
Optimization Scope
Strategic Model
Strategic decisions concerningwhich technologies to installand/or decommission in the longterm
Operational Model
Energy portfolio selection in theshort term
Interaction
The strategic model includesa simplified version ofoperational energy-balanceconstraints
The operational modelincludes the realisation ofthe strategic decisions asparameters
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 10/1
Scheme of the Project
EnRiMaDSSStrategicModule
OperationalModule
StrategicDVs
StrategicConstraints
Upper-LevelOperational DVs
Upper-LevelEnergy-BalanceConstraints
Lower-LevelEnergy-BalanceConstraints
Lower-LevelOperational DVs
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 11/1
Scenario trees
Decision Time
1 2 543 6 7 98
Stage 1 Stage 2 Stage 3
Scenario 1
Scenario 2
Scenario 3
Scenario 4
Scenario 5
Scenario 6
Illustrative scenario tree
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 12/1
Outline
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 13/1
Objective Function (example)
min∑p∈P
∑i∈I
CI p,0i ·Gi · sipi
∑j∈J
CISp,0j ·GSj · xi
pj
+∑i∈I
Gi
p∑a1=0
CDp−a1i
p∑a2=a1+1
sda1,a2i
+∑j∈J
p∑a1=0
CDSp−a1j
p∑a2=a1+1
xda1,a2j
+
∑m∈M
DM pm
∑i∈I
∑k∈K
∑t∈T
COp,m,ti,k · zp,m,t
i,k
+∑
m∈MDM p
m
∑j∈J
∑k∈K
∑t∈T
COSp,m,tk,j · rp,m,t
k,j
−∑
m∈MDM p
m
∑i∈I
∑k∈K
∑n∈NS(k)
∑mm∈MA
∑t∈T
PPp,m,ti,k,n · u
p,m,t,mmk,n
−∑
m∈MDM p
m
∑i∈I
∑k∈K
∑n∈NS(k)
∑mm∈MS
∑t∈T
SPp,m,ti,k,n · w
p,m,t,mmk,n
−∑i∈I
SU pi ·Gi · si
pi
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 14/1
Constraints (two examples)
Energy Balance (operational):∑i∈I
zp,m,ti,k +
∑n∈NB(k)
∑mm∈MA
up,m,t,mmk,n
−∑i∈I
yp,m,ti,k −
∑mm∈MS
∑n∈NS(k)
wp,m,t,mmk,n
∑j∈JS
qip,m,tk,j ≥ Dp,m,t
k
−∑j∈JS
qop,m,tk,j −
∑j∈JPS
Φp,m,tj −
∑j∈JPU
ODk,j · xpj ·D
p,m,tk
p ∈ P, m ∈M, t ∈ T, k ∈ K
Emissions limit (strategic):
∑m∈M
DM pm
∑i∈I
∑k∈K
∑t∈T
Hi,k,l · yp,m,ti,k
∑n∈N
∑k∈K
∑t∈T
Ci,l,n · up,m,t,mmk,n
≤ PLpl
p ∈ P, l ∈ L
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 15/1
Outline
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 16/1
Symbolic Model Specification
The formulation reached models complex systems
Moreover, the Symbolic Model Specification should be:
FlexibleReplicableReproducibleScalablePortable
Thus, a suitable structure is needed
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 17/1
Data model
Model and Instance Classes, data attributes, input/output methods
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 18/1
Outline
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 19/1
Algebraic Languages
Needs
Statistical Software
Data Visualization
Data Analysis
MathematicalRepresentation
Solver InputGeneration
OutputDocumentation
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 20/1
R as an Integrated Environment
Advantages
Open Source
Reproducible Research and Literate Programming capabilities.
Integrated framework for SMS, data, equations and solvers.
Data Analysis (pre- and post-), graphics and reporting.
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 21/1
R Code Example
> cat(getEq(mySMS , 1, format = "gams"), "\n")
genTechAvail(p,i) .. s(i,p) =e= G(i)*Sum((a), AG(i,a)*(
si(i,p)-Sum((q), sd(i,p,q))) ;
> cat(getEq(mySMS , 1, format = "tex"), "\n")
\mathit{s}_{i}^{p} = \mathit{G}_{i}^{} \cdot \sum _{a
\in \mathcal{ A }} \mathit{AG}_{i}^{a} \cdot \left (
\mathit{si}_{i}^{p}- \sum _{q \in \mathcal{ Q }} \
mathit{sd}_{i}^{p,q} \right ) \qquad \forall \;p \in
\mathcal{ P },\; i \in \mathcal{ I }
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 22/1
Solution and report
Sweave file example:
%
\documentclass[a4paper ]{ article}
\usepackage{Sweave}
\title{Example Symbolic Model Specification}
\author{urjc}
\begin{document}
\maketitle
\section{Data analysis}
<<>>=
# Some code for importing the
# Symbolic Model and analyzing the
# input data ...
#Generate tex file
wProblem(myImplem ,
filename = "myImplem.tex",
format = "tex",
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 23/1
Solution and report (cont.)
solver = "lp" )
#generate gams file
wProblem(initStochImplem ,
filename = "myImplem.gms",
format = "gams",
solver = "lp" )
@
\section{Symbolic Model Specification}
%Write the LaTeX equations
\input{myImplem}
\section{Call to solver}
<<>>=
require(gdxrrw)
gams("myImplem.gms --outfile=mySol.gdx")
@
\section{Solution Analysis}
<<>>=
lst <- list(name= ' solvestat ' ,form= ' full ' ,compress=TRUE)solverResults <- rgdx("mySol.gdx", lst)
#Some analysis and charts over solverResults object
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 24/1
Solution and report (cont.)
@
\end{document}
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 25/1
Summary
In this presentation the models developed for the EnRiMaDSS have been described
An integrated framework allows to integrate analysis,representation and solution of optimization problems
Examples of use have been presented
Outlook
Integration of scenarios for stochastic optimizationExtend representation formats: HTML, ODF, . . .Further formats: AMPL, MPS, XML, . . .A contributed package?
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 25/1
Summary
In this presentation the models developed for the EnRiMaDSS have been described
An integrated framework allows to integrate analysis,representation and solution of optimization problems
Examples of use have been presented
Outlook
Integration of scenarios for stochastic optimizationExtend representation formats: HTML, ODF, . . .Further formats: AMPL, MPS, XML, . . .A contributed package?
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 26/1
References
[1] Michel Berkelaar and others. lpSolve: Interface to Lp solve v. 5.5 to solvelinear/integer programs, 2011. URLhttp://CRAN.R-project.org/package=lpSolve. R package version 5.6.6.
[2] COIN-OR Foundation. Internet, 2012. URL http://www.coin-or.org/. retrieved2012-06-12.
[3] A.J. Conejo, M. Carrion, and J.M. Morales. Decision Making Under Uncertainty inElectricity Markets. International Series in Operations Research and ManagementScience Series. Springer, 2010. ISBN 9781441974204. URLhttp://books.google.es/books?id=zta0qWS_W98C.
[4] EnRiMa. Energy efficiency and risk management in public buildings.www.enrima-project.eu, 2012.
[5] GAMS. gdxrrw: interfacing gams and R. Internet, 2012. URLhttp://support.gams-software.com/doku.php?id=gdxrrw:
interfacing_gams_and_r. retrieved 2012-03-06.
[6] Chris Marnay, Joseph Chard, Kristina Hamachi, Tim Lipman, Mithra Moezzi,Boubekeur Ouaglal, and Afzal Siddiqui. Modeling of customer adoption ofdistributed energy resources. Technical report, Lawrence Berkeley NationalLaboratory, 2001. URL http://der.lbl.gov/publications/
modeling-customer-adoption-distributed-energy-resources.
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 27/1
References (cont.)
[7] R Development Core Team. R: A Language and Environment for StatisticalComputing. R Foundation for Statistical Computing, Vienna, Austria, 2012. URLhttp://www.R-project.org/. ISBN 3-900051-07-0.
[8] Afzal S. Siddiqui, Chris Marnay, Jennifer L. Edwards, Ryan Firestone, SrijayGhosh, and Michael Stadler. Effects of carbon tax on microgrid combined heatand power adoption. Journal of Energy Engineering, 131(1):2–25, 2005. doi:10.1061/(ASCE)0733-9402(2005)131:1(2). URLhttp://link.aip.org/link/?QEY/131/2/1.
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 28/1
Acknowledgements
R-project
GAMS Software
EnRiMa project partners
Project RIESGOS-CM: code S2009/ESP-1685
This work has been partially funded by the projects:
Energy Efficiency and Risk Management in Public Buildings (EnRiMa) EC’s FP7project (number 260041)AGORANET project (IPT-430000-2010-32)HAUS: IPT-2011-1049-430000EDUCALAB: IPT-2011-1071-430000DEMOCRACY4ALL: IPT-2011-0869-430000CORPORATE COMMUNITY: IPT-2011-0871-430000
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation
Use R! 2012, Vanderbilt University, Nashville, June 14 2012 29/1
Discussion
Thanks for your attention !
@emilopezcano
Emilio L. Cano and Javier M. Moguerza Decision Making under Uncertainty: R implementation