\documentclass[11 pt,xcolor={dvipsnames,svgnames,x11names,table}]{beamer}

\usepackage[english]{babel} 
\usepackage{polski}         
\usepackage[skins,theorems]{tcolorbox}
\tcbset{highlight math style={enhanced,
  colframe=red,colback=white,arc=0pt,boxrule=1pt}}

\usetheme[
	bullet=circle,		% Other option: square
	bigpagenumber,		% circled page number on lower right
	topline=true,			% colored bar at the top of the frame 
	shadow=false,			% Shading for beamer blocks
	watermark=BG_lower,	% png file for the watermark
	]{Flip}

%\logo{\kern+1.em\includegraphics[height=1cm]{SHiP-3_LightCharcoal}}
                            

\usepackage[lf]{berenis}
\usepackage[LY1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{emerald}
\usefonttheme{professionalfonts}
\usepackage[no-math]{fontspec}	
\usepackage{listings}
\defaultfontfeatures{Mapping=tex-text}	% This seems to be important for mapping glyphs properly

\setmainfont{Gillius ADF}			% Beamer ignores "main font" in favor of sans font
\setsansfont{Gillius ADF}			% This is the font that beamer will use by default
% \setmainfont{Gill Sans Light}		% Prettier, but harder to read

\setbeamerfont{title}{family=\fontspec{Gillius ADF}}

\input t1augie.fd

%\newcommand{\handwriting}{\fontspec{augie}} % From Emerald City, free font
%\newcommand{\handwriting}{\usefont{T1}{fau}{m}{n}} % From Emerald City, free font
% \newcommand{\handwriting}{}	% If you prefer no special handwriting font or don't have augie

%% Gill Sans doesn't look very nice when boldfaced
%% This is a hack to use Helvetica instead
%% Usage: \textbf{\forbold some stuff}
%\newcommand{\forbold}{\fontspec{Arial}}

\usepackage{graphicx}
\usepackage[export]{adjustbox}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{colortbl}
\usepackage{mathrsfs} 			% For Weinberg-esque letters
\usepackage{cancel}				% For "SUSY-breaking" symbol
\usepackage{slashed}            % for slashed characters in math mode
\usepackage{bbm}                % for \mathbbm{1} (unit matrix)
\usepackage{amsthm}				% For theorem environment
\usepackage{multirow}			% For multi row cells in table
\usepackage{arydshln} 			% For dashed lines in arrays and tables
\usepackage{siunitx}
\usepackage{xhfill}
\usepackage{grffile}
\usepackage{textpos}
\usepackage{subfigure}
\usepackage{tikz}
\usepackage{hyperref}
%\usepackage{hepparticles}    
\usepackage[italic]{hepparticles}     

\usepackage{hepnicenames} 

% Drawing a line
\tikzstyle{lw} = [line width=20pt]
\newcommand{\topline}{%
  \tikz[remember picture,overlay] {%
    \draw[crimsonred] ([yshift=-23.5pt]current page.north west)
             -- ([yshift=-23.5pt,xshift=\paperwidth]current page.north west);}}



% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\usepackage{tikzfeynman}		% For Feynman diagrams
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{trees}
\usetikzlibrary{matrix,arrows} 				% For commutative diagram
% http://www.felixl.de/commu.pdf
\usetikzlibrary{positioning}				% For "above of=" commands
\usetikzlibrary{calc,through}				% For coordinates
\usetikzlibrary{decorations.pathreplacing}  % For curly braces
% http://www.math.ucla.edu/~getreuer/tikz.html
\usepackage{pgffor}							% For repeating patterns

\usetikzlibrary{decorations.pathmorphing}	% For Feynman Diagrams
\usetikzlibrary{decorations.markings}
\tikzset{
	% >=stealth', %%  Uncomment for more conventional arrows
	vector/.style={decorate, decoration={snake}, draw},
	provector/.style={decorate, decoration={snake,amplitude=2.5pt}, draw},
	antivector/.style={decorate, decoration={snake,amplitude=-2.5pt}, draw},
	fermion/.style={draw=gray, postaction={decorate},
		decoration={markings,mark=at position .55 with {\arrow[draw=gray]{>}}}},
	fermionbar/.style={draw=gray, postaction={decorate},
		decoration={markings,mark=at position .55 with {\arrow[draw=gray]{<}}}},
	fermionnoarrow/.style={draw=gray},
	gluon/.style={decorate, draw=black,
		decoration={coil,amplitude=4pt, segment length=5pt}},
	scalar/.style={dashed,draw=black, postaction={decorate},
		decoration={markings,mark=at position .55 with {\arrow[draw=black]{>}}}},
	scalarbar/.style={dashed,draw=black, postaction={decorate},
		decoration={markings,mark=at position .55 with {\arrow[draw=black]{<}}}},
	scalarnoarrow/.style={dashed,draw=black},
	electron/.style={draw=black, postaction={decorate},
		decoration={markings,mark=at position .55 with {\arrow[draw=black]{>}}}},
	bigvector/.style={decorate, decoration={snake,amplitude=4pt}, draw},
}

% TIKZ - for block diagrams, 
% from http://www.texample.net/tikz/examples/control-system-principles/
% \usetikzlibrary{shapes,arrows}
\tikzstyle{block} = [draw, rectangle, 
minimum height=3em, minimum width=6em]




\usetikzlibrary{backgrounds}
\usetikzlibrary{mindmap,trees}	% For mind map
\newcommand{\degree}{\ensuremath{^\circ}}
\newcommand{\E}{\mathrm{E}}
\newcommand{\Var}{\mathrm{Var}}
\newcommand{\Cov}{\mathrm{Cov}}
\newcommand\Ts{\rule{0pt}{2.6ex}}       % Top strut
\newcommand\Bs{\rule[-1.2ex]{0pt}{0pt}} % Bottom strut

\graphicspath{{images/}}	% Put all images in this directory. Avoids clutter.

% SOME COMMANDS THAT I FIND HANDY
% \renewcommand{\tilde}{\widetilde} % dinky tildes look silly, dosn't work with fontspec
%\newcommand{\comment}[1]{\textcolor{comment}{\footnotesize{#1}\normalsize}} % comment mild
%\newcommand{\Comment}[1]{\textcolor{Comment}{\footnotesize{#1}\normalsize}} % comment bold
%\newcommand{\COMMENT}[1]{\textcolor{COMMENT}{\footnotesize{#1}\normalsize}} % comment crazy bold
\newcommand{\Alert}[1]{\textcolor{Alert}{#1}} % louder alert
\newcommand{\ALERT}[1]{\textcolor{ALERT}{#1}} % loudest alert
%% "\alert" is already a beamer pre-defined
\newcommand*{\Scale}[2][4]{\scalebox{#1}{$#2$}}%

\def\Put(#1,#2)#3{\leavevmode\makebox(0,0){\put(#1,#2){#3}}}

\usepackage{gmp}
\usepackage[final]{feynmp-auto}

\usepackage[backend=bibtex,style=numeric-comp,firstinits=true]{biblatex}
\bibliography{bib}
\setbeamertemplate{bibliography item}[text]

\makeatletter\let\frametextheight\beamer@frametextheight\makeatother

% suppress frame numbering for backup slides
% you always need the appendix for this!
\newcommand{\backupbegin}{
	\newcounter{framenumberappendix}
	\setcounter{framenumberappendix}{\value{framenumber}}
}
\newcommand{\backupend}{
	\addtocounter{framenumberappendix}{-\value{framenumber}}
	\addtocounter{framenumber}{\value{framenumberappendix}} 
}


\definecolor{links}{HTML}{2A1B81}
%\hypersetup{colorlinks,linkcolor=,urlcolor=links}

% For shapo's formulas:

% For shapo's formulas:
\def\lsi{\raise0.3ex\hbox{$<$\kern-0.75em\raise-1.1ex\hbox{$\sim$}}}
\def\gsi{\raise0.3ex\hbox{$>$\kern-0.75em\raise-1.1ex\hbox{$\sim$}}}
\newcommand{\lsim}{\mathop{\lsi}}
\newcommand{\gsim}{\mathop{\gsi}}
\newcommand{\wt}{\widetilde}
%\newcommand{\ol}{\overline}
\newcommand{\Tr}{\rm{Tr}}
\newcommand{\tr}{\rm{tr}}
\newcommand{\eqn}[1]{&\hspace{-0.7em}#1\hspace{-0.7em}&}
\newcommand{\vev}[1]{\rm{$\langle #1 \rangle$}}
\newcommand{\abs}[1]{\rm{$\left| #1 \right|$}}
\newcommand{\eV}{\rm{eV}}
\newcommand{\keV}{\rm{keV}}
\newcommand{\GeV}{\rm{GeV}}
\newcommand{\im}{\rm{Im}}
\newcommand{\disp}{\displaystyle}
\def\be{\begin{equation}}
\def\ee{\end{equation}}
\def\ba{\begin{eqnarray}}
\def\ea{\end{eqnarray}}
\def\d{\partial}
\def\l{\left(}
\def\r{\right)}
\def\la{\langle}
\def\ra{\rangle}
\def\e{{\rm e}}
\def\Br{{\rm Br}}
\def\fixme{{\color{red} FIXME!}}
\def\mc{{\color{Magenta}{MC}}}
\def\pdf{{\rm p.d.f.}}
\def\cdf{{\rm c.d.f.}}
\def\ARROW{{\color{JungleGreen}{$\Rrightarrow$}}\xspace}  
\def\ARROWR{{\color{WildStrawberry}{$\Rrightarrow$}}\xspace}  

\author{ {\fontspec{Trebuchet MS}Marcin Chrz\k{a}szcz} (Universit\"{a}t Z\"{u}rich)}
\institute{UZH}
\title[Specific \pdf~generation]{Specific \pdf~generation}
\date{\fixme}
\newcommand*{\QEDA}{\hfill\ensuremath{\blacksquare}}%
\newcommand*{\QEDB}{\hfill\ensuremath{\square}}%

\author{ {\fontspec{Trebuchet MS}Marcin Chrz\k{a}szcz} (Universit\"{a}t Z\"{u}rich)}
\institute{UZH}
\title[Applications of MC methods]{Applications of MC methods}
\date{\fixme}


\begin{document}
\tikzstyle{every picture}+=[remember picture]

{
\setbeamertemplate{sidebar right}{\llap{\includegraphics[width=\paperwidth,height=\paperheight]{bubble2}}}
\begin{frame}[c]%{\phantom{title page}} 
\begin{center}
\begin{center}
	\begin{columns}
		\begin{column}{0.9\textwidth}
			\flushright\fontspec{Trebuchet MS}\bfseries \Huge {Applications of MC methods}
		\end{column}
		\begin{column}{0.2\textwidth}
		  %\includegraphics[width=\textwidth]{SHiP-2}
		\end{column}
	\end{columns}
\end{center}
	\quad
	\vspace{3em}
\begin{columns}
\begin{column}{0.44\textwidth}
\flushright \vspace{-1.8em} {\fontspec{Trebuchet MS} \Large Marcin Chrząszcz\\\vspace{-0.1em}\small \href{mailto:mchrzasz@cern.ch}{mchrzasz@cern.ch}}

\end{column}
\begin{column}{0.53\textwidth}
\includegraphics[height=1.3cm]{uzh-transp}
\end{column}
\end{columns}

\vspace{1em}
%		\footnotesize\textcolor{gray}{With N. Serra, B. Storaci\\Thanks to the theory support from M. Shaposhnikov, D. Gorbunov}\normalsize\\
\vspace{0.5em}
	\textcolor{normal text.fg!50!Comment}{Monte Carlo methods, \\ 26 May, 2016}
\end{center}
\end{frame}
}


\begin{frame}\frametitle{Optimization}
\begin{minipage}{\textwidth}
\begin{exampleblock}{Optimization problem:}
We have a set $X \subset \mathbb{R}^m$ and a function $F : X \to \mathbb{R}$.\\
Task:\\
Find the optimum point:
\begin{align*}
x_{opt} \in X : \forall_{x \in X}~F(x) \geq F(x_{opt})
\end{align*}
\end{exampleblock}
\ARROW This is completely different then normal function minimalization as we choose $x_{opt}$ from a set X. This makes a big differences for numerical computations.\\
\ARROWR The MC algorithms for solving this problem:
\begin{itemize}
\item Hit and miss method - the simplest and the slowest.
\item Sequence methods - MC interpretation of method of further approximations.
\item Genetic methods, stat. optimization. 
\end{itemize}


\end{minipage}

\end{frame}




\begin{frame}\frametitle{Optimization hit and miss}
\begin{minipage}{\textwidth}
\begin{footnotesize}

\ARROWR The algorithm acts as follows:
\begin{itemize}
\item We generate $N$ points $x_1,...,x_N \in X$ from a constant \pdf~on $X$.
\item We calculate the $F$ function value in the points $x_1,...,x_N$:
\begin{align*}
F_1=F(x_1),~~~F_2=F(x_2),~~~...,~~~F_N
\end{align*}
\item We calculate $F^{\ast}=\min \lbrace F_1,F_2,...,F_N \rbrace$.
\item The solution is $x_j: F(x_j)=F^{\ast}$
\end{itemize}
\ARROW Precision:
\begin{exampleblock}{}
If $F^{\ast}=\min_{1\leq j \leq N} \lbrace F(x_j) \rbrace$ where $x_j=1,2,...N$ are random points from uniform \pdf~on $X$. Then with the probability $1-(1-\gamma)^N$ the volume of points $x$ for which $F(x)<F^{\ast}$ is smaller then $\epsilon$. 
\end{exampleblock}
\ARROW We can say that with probability $1-(1-\gamma)^N$ the points $x_{opt}$ was localized with the probability $\gamma$. \\
\ARROW the smaller the volume the better the accuracy.


\end{footnotesize}
\end{minipage}

\end{frame}


\begin{frame}\frametitle{Optimization hit and miss}
\begin{minipage}{\textwidth}
\begin{footnotesize}

\ARROWR The algorithm acts as follows:
\begin{itemize}
\item We generate $N$ points $x_1,...,x_N \in X$ from a constant \pdf~on $X$.
\item We calculate the $F$ function value in the points $x_1,...,x_N$:
\begin{align*}
F_1=F(x_1),~~~F_2=F(x_2),~~~...,~~~F_N
\end{align*}
\item We calculate $F^{\ast}=\min \lbrace F_1,F_2,...,F_N \rbrace$.
\item The solution is $x_j: F(x_j)=F^{\ast}$
\end{itemize}
\ARROW Precision:
\begin{exampleblock}{}
If $F^{\ast}=\min_{1\leq j \leq N} \lbrace F(x_j) \rbrace$ where $x_j=1,2,...N$ are random points from uniform \pdf~on $X$. Then with the probability $1-(1-\gamma)^N$ the volume of points $x$ for which $F(x)<F^{\ast}$ is smaller then $\epsilon$. 
\end{exampleblock}
\ARROW We can say that with probability $1-(1-\gamma)^N$ the points $x_{opt}$ was localized with the probability $\gamma$. \\
\ARROW the smaller the volume the better the accuracy.


\end{footnotesize}
\end{minipage}

\end{frame}



\begin{frame}\frametitle{Optimization hit and miss}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\begin{center}
The smallest $N$ that obeys: $1-(1-\gamma)^N \geq 1 -\epsilon$:
\includegraphics[width=0.7\textwidth]{images/table.png}
\end{center}
\ARROW Example: $\left[0,1\right]^m$ and $F:X \to \mathbb{R}$.\\
How many points we need to generate to ahve $0.9$ probability to be have half of the range of each direction in each precision:
\begin{itemize}
\item For $m=1$: $\gamma=1/2~\rightarrowtail~N=4$.
\item For $m=2$: $\gamma=1/4\rightarrowtail~N=9$.
\item For $m=14$: $\gamma=2^{-14}\rightarrowtail~N>23~000$.

\end{itemize}
\ARROW Inefficient for multi-dimensions. 
\end{footnotesize}
\end{minipage}

\end{frame}





\begin{frame}\frametitle{Optimization sequence}
\begin{minipage}{\textwidth}
\begin{footnotesize}

\ARROW The algorithm:
\begin{itemize}
\item We choose the starting point $x_1 \in X$ from some \pdf~on $X$ set.
\item After generating $x_1,x_2,...,x_n$ check if some conditions are meet.
\begin{itemize}
\item If YES then we stop and we put $x_n$ as solution.
\item If NO then we generate $x_{n+1}$ form a \pdf~ that depends on already generated points. 
\end{itemize}
\end{itemize}

\ARROW The basic sequence algorithm:
\begin{itemize}
\item Choose $x_1$.
\item After we have $x_1,x_2,...,x_n$ then we generate a temporary point $\xi_n$:
\begin{align*}
x_{n+1}=\begin{cases}
x_n,~~~~~~~~~~{\rm if}~F(x_n+\xi_n) \geq F(x_n)-\epsilon\\
x_n+\xi_n,~~{\rm if}~F(x_n+\xi_n) < F(x_n)-\epsilon \end{cases}
\end{align*}
\end{itemize}



\end{footnotesize}
\end{minipage}

\end{frame}




\begin{frame}\frametitle{Optimization sequence}
\begin{minipage}{\textwidth}
\begin{footnotesize}

\ARROW From the above algorithm we will get a sequence:
\begin{align*}
F(x_1) \geq F(x_2) \geq F(x_3) \geq ...\geq F(x_n)\geq F(x_{n+1})...
\end{align*}
\ARROW If the function is bounded from the bottom the the above sequence is converging.\\
\ARROWR How can we be sure it will converge to $x_{opt}$?
\begin{center}
\includegraphics[width=0.6\textwidth]{images/fig2.png}
\end{center}
\ARROW If we choose the correct the $P_n$ every sequence starting from $x^{\prime}$ will converge to $\overline{x}$, where $F$ has a local minimum.




\end{footnotesize}
\end{minipage}

\end{frame}


\begin{frame}\frametitle{Optimization sequence}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW There are two types of algorithms:
\begin{itemize}
\item If the algorithm can find the global minimum then we call it: global algorithm.
\item If the algorithm can find only local minimum the we call it: local algorithm.
\end{itemize}
\ARROWR If in the sequence $\lbrace x_n \rbrace$ we find a point $x^{\prime}$ such that:
\begin{align*}
F(x_{opt}) < F(x^{\prime}) <  F(x_{opt})+\epsilon
\end{align*}
then the above algorithm will converge only to $x^{\prime}$. \\
\ARROW Of course we can change the $\epsilon$ such that we escape the $x^{\prime}$.
\end{footnotesize}
\end{minipage}

\end{frame}



\begin{frame}
\begin{minipage}{\textwidth}

\begin{center}
\begin{Large}
Q \& A
\end{Large}
\end{center}

\end{minipage}

\end{frame}








\backupbegin   

\begin{frame}\frametitle{Backup}


\end{frame}

\backupend			

\end{document}
