% ---------------------------------------------------------------------------------------
% -----------------------------------   PREAMBLE PART -----------------------------------
% ---------------------------------------------------------------------------------------

\documentclass[8pt,usenames,dvipsnames]{beamer}
% \usepackage{etex}  % to jest trick dla konfliktow pakietow ('No room for a new \dimen'). Pakiet booktabs koliduje tutaj z pakietem listings

% ---- jezyk
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}

% --------------------- BEAMER ---------------------------------------------

\usetheme{CambridgeUS} 
\usecolortheme{whale} %comment out to get the default color theme, beaver for CambridgeUS

\useoutertheme{infolines} %comment out when color theme is beaver
%\useoutertheme[subsection=false]{miniframes}

\setbeamercolor{frametitle}{bg=gray!60} %comment out when color theme is beaver

%gets rid of bottom navigation bars
\setbeamertemplate{footline}[page number]{}
%gets rid of navigation symbols
\setbeamertemplate{navigation symbols}{}

%\setbeamertemplate{itemize items}[default]
%\setbeamertemplate{itemize subitem}[default]
%\setbeamertemplate{enumerate items}[default]

\setbeamertemplate{itemize item}{\color{RoyalBlue}$\blacktriangleright$}

\setbeamerfont{section number projected}{family=\rmfamily, series=\bfseries, size=\normalsize}
\setbeamercolor{section number projected}{bg=RoyalBlue,fg=white}
\setbeamertemplate{section in toc}[square]

\setbeamerfont{subsection number projected}{family=\rmfamily, series=\bfseries, size=\normalsize}
\setbeamercolor{subsection number projected}{bg=RoyalBlue}
\setbeamertemplate{subsection in toc}[square]

\usepackage{appendixnumberbeamer}

\newif\ifshowtoc
\showtoctrue% toggles to show the toc

\AtBeginSection{%
\ifshowtoc
\begin{frame}
    \tableofcontents[current, subsectionstyle=shaded/shaded/shaded]
\end{frame}
\fi
}

\AtBeginSubsection[] { % Frame added before each subsection
	\frame<handout:0>{                             
	   \tableofcontents[current, currentsubsection] % Highlight current section/subsection
	}
}

% ---- title page from leidenuniv

\setbeamerfont{frametitle}{series=\bfseries, size=\LARGE}
\setbeamerfont{framesubtitle}{series=\mdseries}
\setbeamerfont{title}{series=\bfseries, size=\LARGE}
\setbeamerfont{subtitle}{series=\mdseries}

\defbeamertemplate*{title page}{leidenuniv}[1][]
{
	\vspace{-1pt}
	\begin{beamercolorbox}[wd=1\paperwidth,ht=0.6\paperheight,left,sep=1ex]{title}
		  \usebeamerfont{title}\leftskip=0.1\paperwidth \noindent \inserttitle\par
		  %\usebeamerfont{subtitle}\usebeamercolor{subtitle}\insertsubtitle\par
		  \begin{center}
		  \usebeamercolor{titlegraphic}\inserttitlegraphic
		  \end{center}
	\end{beamercolorbox}
\vspace{2pt}
	\begin{beamercolorbox}[wd=\paperwidth,left]{}
		  \hskip0.1\paperwidth\insertauthor
		  \hskip0.1\paperwidth 
		  \parbox{0.6\paperwidth}{
			  \usebeamerfont{author}{}
		  }
	\end{beamercolorbox}
	%\vfill
	
	\przerwa\przerwa\przerwa\przerwa
	\begin{center}
		\usebeamerfont{institute}\insertinstitute\par
		\usebeamerfont{date}\insertdate
	\end{center}

}

% ---- title page from leidenuniv

% --------------------- POZOSTALE------------------------------------------

\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{marvosym}

\usepackage{amssymb, mathtools, amsfonts, amsthm, latexsym} % MOSTLY MATHEMATICAL SYMBOLS

\usepackage{fontawesome}
\usepackage{pifont} % More styles for bullets

\usepackage{wrapfig}
\usepackage{lipsum}

\usepackage{changepage} % potrzebne dla adjustwidth - srodowiska zmieniajacego wielkosc marginesow

\usepackage{dcolumn} % dla tabelki - wyrownanie do separatora dziesietnego

\usepackage{pifont} % dla \xmark

\usepackage[en-GB]{datetime2} % dla: last updated
\DTMlangsetup[en-GB]{ord=level}

\usepackage{marvosym} % Telephone and email icons

\definecolor{mygray}{gray}{0.6}
%\definecolor{myblue}{RGB}{86, 157, 217}
\definecolor{myblue}{RGB}{0,0,88}


\newcommand{\circled}[1]{%
	\scalebox{0.5}{\tikz\node%
		[outer sep=0pt, inner sep=2pt,
		line width=0pt,text=white,fill=blue!50,draw,circle,shading=ball]{#1};%
	}%
}
\newcommand{\bref}[1]{\circled{\ref{#1}}}

\usepackage[authoryear, sort, comma, longnamesfirst]{natbib}
%\usepackage[authoryear,square]{natbib}
\bibliographystyle{dcu_harvard_chicago}
\renewcommand{\bibfont}{\footnotesize}
\renewcommand{\bibsection}{}

\definecolor{bluencs}{rgb}{0.0, 0.53, 0.74}

%\newcommand{\argmin}{\operatornamewithlimits{argmin}}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\newcommand{\przerwa}{\vspace{\baselineskip}}
\newcommand{\vect}[1]{\mathbf{#1}}
\newcommand{\card}[1]{\lvert #1 \rvert} % cardinality of a set
% \newcommand{\card}[1]{\overline{\overline{#1}}} % cardinality of a set

\usepackage{tikz}
\usetikzlibrary{calc, arrows.meta, positioning, shapes, automata}

\usepackage{algorithmicx}
\algrenewcommand{\alglinenumber}[1]{\footnotesize Step #1:}

\def\N{{\mathbb N}}
\def\R{{\mathbb R}}

\def\A{\mathcal A}
\def\B{\mathcal B}
\def\C{\mathcal C}
\def\D{\mathcal D}
\def\L{\mathcal L}
\def\U{\mathcal U}
\def\V{\mathcal V}
\def\H{\mathcal H}
\def\Y{\mathcal Y}

\def\Lt{\widetilde{\mathcal L}}
\def\Ut{\widetilde{\mathcal U}}

\def\x{\underline x}
%\def\x{\mathbf x}

\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{remark}{Remark}[section]
\theoremstyle{definition}
\newtheorem{conjecture}{Conjecture}[section]
\newtheorem{assumption}{Assumption}

\newcommand{\ind}[1]{\mathrlap{\qquad #1}} % to handle index
\newcommand{\texteq}{\mathrm}

\usepackage{listings}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\definecolor{asparagus}{rgb}{0.53, 0.66, 0.42}
\definecolor{aren}{rgb}{0.29, 0.33, 0.13}
\definecolor{brass}{rgb}{0.71, 0.65, 0.26}
\lstset{ %
	language=R,                     % the language of the code
	basicstyle=\footnotesize,       % the size of the fonts that are used for the code
	keywordstyle=\color{black},
	numbers=left,                   % where to put the line-numbers
	numberstyle=\tiny\color{gray},  % the style that is used for the line-numbers
	stepnumber=1,                   % the step between two line-numbers. If it's 1, each line
	% will be numbered
	numbersep=5pt,                  % how far the line-numbers are from the code
	backgroundcolor=\color{white},  % choose the background color. You must add \usepackage{color}
	showspaces=false,               % show spaces adding particular underscores
	showstringspaces=false,         % underline spaces within strings
	showtabs=false,                 % show tabs within strings adding particular underscores
	frame=single,                   % adds a frame around the code
	rulecolor=\color{black},        % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. commens (green here))
	tabsize=2,                      % sets default tabsize to 2 spaces
	captionpos=b,                   % sets the caption-position to bottom
	breaklines=true,                % sets automatic line breaking
	breakatwhitespace=false,        % sets if automatic breaks should only happen at whitespace
	%  title=\lstname,                 % show the filename of files included with \lstinputlisting;
	% also try caption instead of title
	% keywordstyle=\color{blue},      % keyword style
	commentstyle=\color{brass},   % comment style
	% stringstyle=\color{mauve},      % string literal style
	escapeinside={\%*}{*)},         % if you want to add a comment within your code
	morekeywords={*,...}            % if you want to add more keywords to the set
} 


% --------------------- KNITR PART ---------------------------------------------


\definecolor{shadecolor}{rgb}{0.99, 0.99, 0.99}
%\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
\definecolor{fgcolor}{rgb}{0.200, 0.200, 0.200}
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}%
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}%
\newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}%
\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
\newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}%
\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}%
\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}%
\newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}%
\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}%

\usepackage{framed}
\makeatletter
\newenvironment{kframe}{%
 \def\at@end@of@kframe{}%
 \ifinner\ifhmode%
  \def\at@end@of@kframe{\end{minipage}}%
  \begin{minipage}{\columnwidth}%
 \fi\fi%
 \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
 \colorbox{shadecolor}{##1}\hskip-\fboxsep
     % There is no \\@totalrightmargin, so:
     \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
 \MakeFramed {\advance\hsize-\width
   \@totalleftmargin\z@ \linewidth\hsize
   \@setminipage}}%
 {\par\unskip\endMakeFramed%
 \at@end@of@kframe}
\makeatother

\definecolor{shadecolor}{rgb}{.97, .97, .97}
\definecolor{messagecolor}{rgb}{0, 0, 0}
\definecolor{warningcolor}{rgb}{1, 0, 1}
\definecolor{errorcolor}{rgb}{1, 0, 0}
\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX

\usepackage{alltt}
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}

% dodatki

\usepackage{caption} % zeby np wylaczyc prefix w etykiecie tabeli dzieki \captionsetup[table]{labelformat=empty}
\usepackage{booktabs} % xtable w minipage
%\reserveinserts{28} % to jest trick (wraz z pakietem jest etex) dla konfliktow pakietow ('No room for a new \dimen'). Pakiet booktabs koliduje tutaj z pakietem listings

% --------------------- KNITR PART ---------------------------------------------

% ---------------------------------------------------------------------------------------
% -----------------------------------   PREAMBLE PART -----------------------------------
% ---------------------------------------------------------------------------------------

\title{Optimum Sample Allocation Under Box Constraints.\\ The RNABOX Algorithm.}
%\subtitle{Master Thesis in Mathematics}
\date{July 3-5, 2023, Warsaw, Poland} %\date{\today}
\author{Wojciech Wójciak (with J. Wesołowski and R. Wieczorkowski)}
\institute{MET2023 - Methodology of Statistical Research}
\selectlanguage{english}

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TITLE PAGE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\begin{frame}[plain]
%
%%	\begin{figure}[h!]
%%	   \includegraphics[scale=0.6]{./title_page/img/wut.png}
%%	 \end{figure}
%	 
%	 \titlepage
%	 
%	 \begin{minipage}[t]{0.5\textwidth}
%	     \vspace{-3cm}
%	     \begin{flushleft}
%	     	{ \textit{Author}:\vspace*{0.1cm} \\ Wojciech Wójciak }
%	     \end{flushleft}
%	\end{minipage}%
%	%
%	\begin{minipage}[t]{0.5\textwidth}
%	    \vspace{-3cm}
%	    \begin{flushright}
%	    	{\textit{Supervisor}:\vspace*{0.1cm} \\ Prof. dr hab. inż Jacek Wesołowski \\}
%	    \end{flushright}    
%	\end{minipage}%
%	
%	\vspace{-0.7cm}
%	\begin{center}      
%	\begin{minipage}[b]{0.5\textwidth}
%	    \centering  
%	    \small  
%	    July 2nd, 2019
%	\end{minipage}%
%	\end{center}  
%   
%\end{frame}

%\begin{frame}
%	\frametitle{Table of contents}
%	\tableofcontents[hidesubsections]
%\end{frame}
%
\begin{frame}[plain]
  \maketitle
\end{frame}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 														Introduction
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: Stratified Sampling
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Stratified sampling}
	\setlength{\tabcolsep}{9pt} % Default value: 6pt
	\renewcommand{\arraystretch}{2} % Default value: 1
	\begin{tabular}{ p{2.6cm} r p{5.5cm} }
		\noindent{\color{RoyalBlue} $\blacktriangleright$} $U = \{1, 2, \ldots, N\}$ & - & a finite {\bf population} consisting of $N$ elements. \\
		\noindent{\color{RoyalBlue} $\blacktriangleright$} $\theta$  & - & {\bf parameter} of principal interest of a single study 
		variable $\Y$ in $U$, e.g. $\theta = \sum_{k \in U}\, \Y(k)$. \\
		\multicolumn{3}{l}{\noindent{\color{RoyalBlue} $\blacktriangleright$} To {\bf estimate} $\theta$, we consider the {\bf 
		stratified sampling}. }
	\end{tabular}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: Stratified Sampling
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Stratified sampling}
	\begin{center}
	\begin{tikzpicture}[
		base/.style = {draw, font=\small\ttfamily, align = center},
		population/.style = {base, rectangle, fill = olive!40, minimum width = 6.5cm, minimum height = 1.1cm, inner sep = 3pt, anchor = north, text depth = 0.5cm},
		population_strat/.style = {base, rectangle split, rectangle split horizontal, rectangle split parts = 4, rectangle split part align = top,  fill = olive!40, minimum width = 1cm, minimum height = 1.1cm, inner sep = 3pt},
		strat/.style = {text width=1.4cm},
		sample/.style = {base, circle, fill = pink!20},
		line/.style = {draw, -{Latex}}
	]
		\node[population] (P) {Population $U$ ($N$ units)};
		\node[population_strat, below=of P] (PS) {
			\nodepart[strat]{one}Stratum $U_1$ \\ $N_1$ units
			\nodepart[strat]{two}Stratum $U_2$ \\ $N_2$ units
			\nodepart[strat, rectangle split part align=base]{three}$\cdots$
			\nodepart[strat]{four}Stratum $U_H$ \\ $N_H$ units
		};
		\path[line] let \p1=(P.south), \p2=(PS.one north) in (P.south) -- +(0,0.5*\y2-0.5*\y1) -| (PS.one north);
		\path[line] let \p1=(P.south), \p2=(PS.two north) in (P.south) -- +(0,0.5*\y2-0.5*\y1) -| (PS.two north);
		\path[line] let \p1=(P.south), \p2=(PS.four north) in (P.south) -- +(0,0.5*\y2-0.5*\y1) -| (PS.four north);
	
		\path[line] (PS.one south) -- +(0,-1.5) node[sample, anchor=north](S1) {Sample 1 \\ $n_1$ units};
		\path[line] (PS.two south) -- +(0,-1.5) node[sample, anchor=north](S2) {Sample 2 \\ $n_2$ units};
		\path[line]  (PS.four south) -- +(0,-1.5) node[sample, anchor=north](S4) {Sample $H$ \\ $n_H$ units};
		\node at ($(S2)!.5!(S4)$) {$\cdots$};
		
		\node[anchor=base, align=left, right=of P] (PSN) {$U = \{1, 2, \ldots, N\}$};
		\node[anchor=base, align=left, right=of PS] (PSN) {$\H = \{1, 2, \ldots, H\}$ \\  $\sum_{h \in \H} N_h = N$};
		\node[anchor=base, align=left, right=of S4] (SN) {$\sum_{h \in \H} n_h = n$};
	\end{tikzpicture}
	\end{center}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: Classical Optimum Allocation Problem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Classical problem of optimum sample allocation}
	The {\bf stratified estimator} $\hat{\theta}_{st}$ of $\theta$ and its {\bf variance} can be worked out for some 
	elementary parameters (such as total or mean) and for wide range of sampling designs used within strata. Suppose that 
	\begin{equation}
		Var(\hat{\theta}_{st}) = \sum_{h \in \H}\, \tfrac{A_h^2}{n_h} - A_0,
	\end{equation}
	where  $A_0$ and $A_h > 0$ do not depend on $n_h,\, h \in \H$ \citep[see e.g.][3.7.2-3.7.3, p.~101-106]{Sarndal}.

	\przerwa
	\begin{block}{Problem R-BC (classical problem of optimum sample allocation)}
		Given set $\H \neq \emptyset$ and numbers $A_h > 0,\, M_h > 0,\, n > 0$, such that $M_h \leq N_h,\, h \in \H$, and $n 
		\leq \sum_{h \in \H}\, M_h$, 
		\begin{align}
			\underset{\x \in \R_+^{\card{\H}}}{\texteq{minimize ~\,}}  & \quad f(\x) = \sum_{h \in \H} \tfrac{A_h^2}{x_h} \\
			\text{subject to}	& \quad \sum_{h \in \H} x_h = n \\
										  & \quad x_h \le M_h,  \ind{h \in \H,}
		\end{align}
		where $\x = (x_h,\, h \in \H)$.
	\end{block}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: Optimal Allocation Problem (Box Constraints)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Problem of optimum sample allocation under box constraints}
	\begin{block}{Problem BC (optimum non-integer allocation, finite lower and finite upper bounds)} \label{pr:BC}
		Given set $\H \neq \emptyset$ and numbers $A_h > 0,\, m_h > 0,\, M_h > 0,\, n > 0$, such that $m_h < M_h \leq N_h,\, 
		h \in \H$, and $\sum_{h \in \H}\, m_h \leq n \leq \sum_{h \in \H}\, M_h$,
		\begin{align}
			\underset{\x \in \R_+^{\card{\H}}}{\texteq{minimize ~\,}}  & \quad f(\x) = \sum_{h \in \H} \tfrac{A_h^2}{x_h} \label{pr:obj} 
			\\
			\text{subject to}	& \quad \sum_{h \in \H} x_h = n \\
										  & \quad m_h \leq x_h \leq M_h, \ind{h \in \H,}
		\end{align}
		where $\x = (x_h,\, h \in \H)$.
	\end{block}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: Approaches
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Selected approaches to Problem BC}
	\begin{itemize}
		\item \citet*{GGM}
			\begin{itemize}
				\item {\tt noptcond()}: based on sorting, it does not guarantee \eqref{pr:obj}.
			\end{itemize}
		\item \citet*{MSW}
			\begin{itemize}
				\item marvellous ideas proposed, but
				\item root finding methods: challenges with finding a good starting value of the parameter,
				\item fixed point iteration: may not converge, not suitable when optimal solution is vertex (see below).
			\end{itemize}
		\item Integer-valued allocation algorithms by \cite{Wright2017}, or {\it Capacity Scaling} by \cite{Friedrich}
		\begin{itemize}
			\item great in principles since no need for rounding but relatively slow performance.
		\end{itemize}
	\end{itemize}
	\przerwa \przerwa \przerwa
	Our approach: \\
	\przerwa
	\begin{center}
		Sufficient optimality conditions (convex optimization) \\
		\MVArrowDown{} \\
		(recursive) Algorithms \\	
	\end{center}
\end{frame}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 														Optimality Conditions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Optimality Conditions}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: Convex Problem and the KKT conditions.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Convex optimization problem and Karush-Kuhn-Tucker cond.}
	
	\begin{block}{Problem CONV (particular type of convex optim. problem, i.e. $f,\, h_i,\, g_j$ of {\it class} $C^1$ and 
	$g_j$ affine)} 
		\begin{align}
			\underset{\x \in \R^p}{\text{minimize}}  & \quad f(\x) \\
			\text{subject to}	& \quad h_i(\x) = 0, \ind{i = 1, \dots, k,}  \\
			& \quad g_j(\x) \leq 0,  \ind{j = 1, \dots, \ell,}
		\end{align}
		$~ f: \R^p \rightarrow \mathbb{R}$, $f \in \mathit{C}^1$, $f$ is convex,\\  
		$h_i: \R^p \rightarrow \mathbb{R}$, $h_i \in \mathit{C}^1$, $h_i$ is affine, \quad $i = 1, \dots, k$, \\
		$g_j: \R^p \rightarrow \mathbb{R}$, $g_j \in \mathit{C}^1$, $g_j$ is affine, \quad $j = 1, \dots, \ell$, 
		\hspace{2.8cm} where $p, k, \ell \geq 1$.
	\end{block}  
	
	\begin{theorem}[KKT necessary and sufficient conditions for CONV]
		$\x^* \in \R^p$ solves CONV iff there exist numbers $\lambda_i  \in \R$, $i = 1, \ldots, k$, and $\mu_j \geq 0$, $j = 1, 
		\ldots, \ell$, s.t.
		\begin{equation*}
			\begin{alignedat}{2}
				&\frac{\partial}{\partial x_h} f(\x^*) + 
					\sum\limits_{i=1}^{k} \lambda_i \frac{\partial}{\partial x_h} h_i(\x^*) +
					\sum\limits_{j=1}^{\ell} \mu_j \frac{\partial}{\partial x_h} g_j(\x^*) = 0, \quad h = 1, \dots, p, \\
				&h_i(\x^*) = 0, \mathrlap{\quad i= 1, \dots, k,} \\
				&g_j(\x^*) \leq 0, \mathrlap{\quad j = 1, \dots, \ell,} \\
				&\mu_j g_j(\x^*) = 0, \mathrlap{\quad j = 1, \dots, \ell, \hspace{3.7cm} \text{ where } p, k, \ell \geq 1.}
			\end{alignedat}
		\end{equation*}
	\end{theorem}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide:  Definition: s(L, U),  (L, U)-allocation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Set function $s(\L, \U)$ and $(\L, \U)$-allocation vector}
	Notation: $\V^c = \H \setminus \V$, for any $\V \subseteq \H$.

	% s(L, U)
	\begin{definition}[$s(\L, \U)$]
		\label{def:s}
		For disjoint $\L, \U$, such that $\L \cup \U \subsetneq \H$ we define a set function $s$ as
		\begin{equation}
			\label{eq:s}
			s(\L, \U) = \frac{n - \sum_{h \in \L} m_h - \sum_{h \in \U} M_h}{\sum_{h \in (\L \cup \U)^c} A_h}
		\end{equation}
	\end{definition}
	
	% (L, U)-allocation
	\begin{definition}[$(\L, \U)$-allocation vector]
	\label{def:LU}
		Let $\L, \U$ be disjoint, such that $\L \cup \U \subseteq \H$. Vector  $\x^{(\L, \U)} = (x_h^{(\L, \U)},\, h \in \H)$ with 
		entries 
		of the form
		\begin{equation}
			\label{eq:xLU}
			x_h^{(\L, \U)} = 
			\begin{cases}
				m_h,											& \ind{h \in \L} \\
				M_h,											& \ind{h \in \U} \\
				A_h\, s(\L, \U) \in (m_h,M_h),	& \ind{h \in (\L \cup \U)^c,}
			\end{cases}
		\end{equation}	
		will be called the $(\L, \U)$-allocation vector.
	\end{definition}

Note: $s(\L, \U)$ is not defined in case of $\L \cup \U = \H$. But then, the last line of \eqref{eq:xLU} does not apply as $(\L 
\cup \U)^c = \emptyset$. 
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide:  Regular vs. vertex allocation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Regular vs. vertex allocation}
	\begin{itemize}
		\item Problem BC becomes trivial if:
		\begin{itemize}
			\item $n = \sum_{h \in \H}\, m_h$, then $\x^* = (m_h,\, h \in \H)$,
			\item $n = \sum_{h \in \H}\, M_h$, then $\x^* = (M_h,\, h \in \H)$.
		\end{itemize}
		\item These two are boundary cases of the {\bf vertex allocation}, i.e. an allocation $\x^* = (x_h^*,\, h \in \H)$ of the form
		\begin{equation*}
			x^*_h = 
			\begin{cases}
				m_h, & ~ h \in \L \\
				M_h, & ~ h \in \U,
			\end{cases}
		\end{equation*}
		where $\L \cup \U = \H$ and $\L \cap \U = \emptyset$.
		\item It is called a vertex allocation as $\x^*$ is a vertex of the hyper-rectangle $\times_{h \in \H}\,[m_h,\, M_h]$.
		\item A non-vertex allocation $\x^*$ will be called a {\bf regular allocation}.
	\end{itemize}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: Sufficient Optimality Conditions for Problem BC
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Sufficient optimality conditions for Problem BC}
	It appears that the solution to Problem BC is necessarily of the form \eqref{eq:xLU}.
	\begin{theorem}[Optimality conditions]
		\label{th:optcond}
		The optimization Problem BC has the unique solution $\x^*= \x^{(\L, \U)}$, with $\L, \U \subseteq \H$ such that one of 
		the 
		following two cases holds:
		\begin{enumerate}
			\item $\L \cup \U \subsetneq \H$ and
			\begin{equation}
				\label{eq:optcond}
				\begin{gathered}
					\L = \left\{h \in \H:\, s(\L, \U) \leq \tfrac{m_h}{A_h} \right\}, \\
					\U = \left\{h \in \H:\, s(\L, \U) \geq \tfrac{M_h}{A_h} \right\}.
				\end{gathered}
			\end{equation}
			Then, $\x^{(\L, \U)}$ is a regular allocation.
			\item $\L \cup \U = \H$ and
			\begin{gather}
				\max_{h \in \U} \tfrac{M_h}{A_h} \leq \min_{h \in \L} \tfrac{m_h}{A_h}, \label{eq:optcond_vertex} \\
				\sum_{h \in \L} m_h + \sum_{h \in \U} M_h = n. \label{eq:optcond_vertex_n}
			\end{gather}
			Then, $\x^{(\L, \U)}$ is a vertex allocation.
		\end{enumerate}
	\end{theorem}
	\przerwa
	\begin{center}
		{\bf How to determine sets $\L$, $\U$?}
	\end{center}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 														RNABOX - Algorithm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{{\em RNABOX}}
\subsection{The algorithm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: RNA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Recursive Neyman Algorithm (RNA) for Problem R-BC}
	\textbf{Input variables:} $\H,\, (A_h)_{h \in \H},\, (M_h)_{h \in \H}, n$
	\vspace{0.5cm}
	
	% Define block styles
	\tikzstyle{ss} = [rounded rectangle, draw, fill=green!20, thick, rounded corners, align=center, font=\ttfamily, inner sep=6]
	\tikzstyle{io} = [trapezium, draw, trapezium left angle=75, trapezium right angle=105, trapezium stretches, fill=pink!20, inner sep=6]
	\tikzstyle{decision} = [diamond, draw, fill=yellow!20, diamond, text width=4.5em, text badly centered, node distance=1.7cm, inner sep=0pt]
	\tikzstyle{operation} = [rectangle, draw, fill=blue!20, text centered, rounded corners, inner sep=6]
	\tikzstyle{line} = [draw, -{Latex}]
	\begin{tikzpicture}[node distance = 1.3cm, auto]
		% Place nodes
		\node [operation] (init) {$\U = \emptyset$};
		\node [ss, left of=init, node distance=6.5cm] (start) {START};
		\node [operation, below of=init] (U) {$\Ut = \{h \in \H \setminus \U:\, A_h\, s(\emptyset, \U) \geq M_h\}$};
		\node [decision, below of=U] (decide) {$\Ut == \emptyset$};
		\node [operation, left of=decide, node distance=4cm] (update) {$\U = \U \cup \Ut$};
		\node[io, below of=decide, node distance=2cm] (solution) {
			$x^*_h = 
				\begin{cases}
					M_h, 	& ~ h \in \U \\
					A_h\, s(\emptyset, \U) < M_h,   & ~ h \in \H \setminus \U
				\end{cases}$
		};
		\node [ss, left of=solution, node distance=6.5cm] (stop) {STOP};
		
		% Draw edges
		\path [line] (start) -- (init);
		\path [line] (init) -- (U);
		\path [line] (U) -- (decide);
		\path [line] (decide) -- node [near start] {no} (update);
		\path [line] (update) |- (U);
		\path [line] (decide) -- node {yes}(solution);
		\path [line] (solution) -- (stop);
	\end{tikzpicture} 
	\przerwa \\
	For more details, see e.g. \citet[Remark 12.7.1, p.~466]{Sarndal} or \citet{WWW}.
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: RNABOX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{RNABOX for Problem BC}
	\textbf{Input variables:} $\H,\, (A_h)_{h \in \H},\, (m_h)_{h \in \H},\, (M_h)_{h \in \H}, n$
	\vspace{0.2cm}
	
	% Define block styles
	\tikzstyle{ss} = [rounded rectangle, draw, fill=green!20, thick, rounded corners, align=center, font=\ttfamily, inner sep=6]
	\tikzstyle{io} = [trapezium, draw, trapezium left angle=75, trapezium right angle=105, trapezium stretches, fill=pink!20]
	\tikzstyle{decision} = [diamond, draw, fill=yellow!20, diamond, text width=4.5em, text badly centered, node distance=1.7cm, inner sep=0pt]
	\tikzstyle{operation} = [rectangle, draw, fill=blue!20, text centered, rounded corners]
	\tikzstyle{line} = [draw, -{Latex}]
	\begin{tikzpicture}[node distance = 1.3cm, auto]
		% Place nodes
		\node [operation] (init) {$\L = \emptyset,\, \V = \H$};
		\node [ss, left of=init, node distance=6.5cm] (start) {START};
		\node [operation, below of=init] (rna) {
			$\begin{aligned}
				(x^{**}_h)_{h \in \V} &= RNA[n,\, \V,\, (A_h)_{h \in \V},\, (M_h)_{h \in \V}] \\
				\U &= \{h \in \V:\, x^{**}_h = M_h\}
			\end{aligned}$
		};
		\node [operation, below of=rna] (L) {$\Lt = \{h \in \V \setminus \U: x^{**}_h \leq m_h \}$};
		\node [decision, below of=L] (decide) {$\Lt == \emptyset$};
		\node [operation, left of=decide, node distance=4cm] (update) {
			$\begin{aligned}
				n  &= n -  \sum_{h \in \Lt} m_h \\
				\V &= \V \setminus \Lt \\
				\L &= \L \cup \Lt
			\end{aligned}$
		};
		\node[io, below of=decide, node distance=2cm] (solution) {
			$x^*_h = 
			\begin{cases}
				m_h, \qquad\qquad\qquad\qquad\qquad\qquad\qquad\,\,\,\,\,\,\,\,\, h \in \L \\
				x^{**}_h = 
				\begin{cases}
					M_h,\, & ~ h \in \U \\
					A_h\, \tfrac{n - \sum_{i \in \U} M_i}{\sum_{i \in (\L \cup \U)^c} A_i} \in (m_h, M_h), & ~ h \in (\L \cup \U)^c
				\end{cases}
			\end{cases}$
		};
		\node [ss, left of=solution, node distance=6.5cm] (stop) {STOP};

		% Draw edges
		\path [line] (start) -- (init);
		\path [line] (init) -- (rna);
		\path [line] (rna) -- (L);
		\path [line] (L) -- (decide);
		\path [line] (decide) -- node [near start] {no} (update);
		\path [line] (update) |- (rna);
		\path [line] (decide) -- node {yes}(solution);
		\path [line] (solution) -- (stop);
	\end{tikzpicture} 
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: RNABOX - choinka
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Example of RNABOX on a population with 10 strata}
	\newcommand{\xmark}{\ding{90}}%
	\newcolumntype{d}[1]{D{.}{.}{#1}}
	Settings:
	\begin{itemize}
		\item $\theta = \sum_{k \in U}\, \Y(k)$,
		\item $\hat{\theta}_{st}$ - stratified $\pi$ estimator of $\theta$,
		\item stratified simple random sampling without replacement design in all strata,
		\item $n = 5110$.
	\end{itemize}

	\begin{table}
	\begin{tabular}{lrrr||ccc|d{3.2}}
	\hline
	$h$ & $A_h$ & $m_h$ & $M_h$ & take-min & take-max & take-Neyman & $\x*$ \\ 
	\hline
	1 	& 2700 & 750  & 900     & \xmark &     			  &				& 750 \\
	2 	& 2000 & 450 & 500	   & \xmark &     			 &			   & 450 \\
	3 	& 4200 & 250 & 300	   &			  &    			  & \xmark & 261.08 \\
	4 	& 4400 & 350 & 400     & \xmark &    			&	   		  & 350 \\
	5 	& 3200 & 150  & 200     &			   &    		  & \xmark & 198.92 \\
	6 	& 6000 & 550 & 600     & \xmark  &    			&			  & 550 \\
	7 	& 8400 & 650 & 700      & \xmark &    			&			  & 650 \\
	8	& 1900 & 50	   & 100      &   			 & \xmark &				 & 100 \\
	9 	& 5400 & 850 & 900     &  \xmark &   			&			  & 850  \\
	10 & 2000 & 950 & 1000	  &  \xmark &   		   &			 & 950\\
	\hline
	SUM & 	 	& 5000 & 5600 & 7 			& 1 		  & 2			&  5110 \\ 
	\hline
	\end{tabular}
	\end{table}
	\przerwa
	\hspace{0.7cm} $Var(\hat{\theta}_{st}) = 33791.45$
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: RNABOX - choinka
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Example of RNABOX on a population with 10 strata}
	\begin{figure}[ht]
		\begin{center}
			\includegraphics[scale=0.45]{rnabox_fig_choinka_H10.pdf}
		\end{center}
	\end{figure}
	Numbers above the squares are the values of set function $s(\L, \U)$ for $\L$ and $\U$ with elements indicated by the 
	coordinates of a given square. For example, for $\blacksquare$ at coordinates $(8, 7)$, we have $s(\{10, 1, 2, 9, 6, 4, 7\}, 
	\{8\}) = 0.0622$.
\end{frame}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 														RNABOX - The proof
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The proof of the optimality}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: RNABOX - Theorem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{RNABOX optimality theorem}
	\begin{theorem}[RNABOX optimality]
		\label{th:rnabox}
		The RNABOX algorithm provides the optimal solution to optimization Problem BC.
	\end{theorem}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: RNABOX - Important and interesting properties of some interim objects
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Important and interesting properties of some interim objects}
	\begin{tikzpicture}
		\draw
			(0,0) rectangle ++(5.5,2.5) node [text=black,above] {$\H$}
			(0,2.5) node [text=black,above] {$1$}
			(1.5,1.25) circle (1.1) (1.5+0.5,1.25+0.5) node [text=black,above] {$\A$}
			(1.5,1.25) circle (0.7) (1.5+0.8,1.25+0.8) node [text=black,above] {$\B$}
			(4,1.25) circle (1.1) (4+0.5,1.25+0.5) node [text=black,above] {$\C$}
			(4,1.25) circle (0.7) (4+0.8,1.25+0.8) node [text=black,above] {$\D$}
			
			(6.4,0) rectangle ++(5.4,2.5) node [text=black,above] {$\H$}
			(6.4,2.5) node [text=black,above] {$2$}
			(8.2,1.25) circle (1.1) (8.2+0.5,1.25+0.5) node [text=black,above] {$\A$}
			(8.2,1.25) circle (0.7) (8.2+0.8,1.25+0.8) node [text=black,above] {$\B$}
			(10.1,1.25) circle (1.1) (10.1+0.5,1.25+0.5) node [text=black,above] {$\C$}
			(10.1,1.25) circle (0.7) (10.1+0.8,1.25+0.8) node [text=black,above] {$\D$};
	\end{tikzpicture}
	
	\begin{lemma}
		\label{lem:smono} 
		Let set function $s$ be as defined in \eqref{eq:s} and $\A \subseteq \B \subsetneq \H$, $\C \subseteq \D \subsetneq 
		\H$.
		\begin{enumerate}
			\item If $\B \cup \D \subsetneq \H$ and $\B \cap \D = \emptyset$, then
			\begin{equation*}
				s(\A, \C) \geq s(\B, \D) \quad \Leftrightarrow \quad s(\A, \C) \left( \sum_{h \in \B \setminus \A} A_h + \sum_{h \in \D 
				\setminus \C} A_h \right) \leq \left( \sum_{h \in \B \setminus \A} m_h + \sum_{h \in \D \setminus \C} M_h \right).
			\end{equation*}
			\item If $\A \cup \D \subsetneq \H$, $\A \cap \D = \emptyset$, $\B \cup \C \subsetneq \H$, $\B \cap \C = \emptyset$, 
			then
			\begin{equation*}
				s(\A, \D) \geq s(\B, \C) \quad \Leftrightarrow \quad s(\A, \D) \left( \sum_{h \in \B \setminus \A} A_h - \sum_{h \in \D 
				\setminus \C} A_h \right) \leq \left( \sum_{h \in \B \setminus \A} m_h - \sum_{h \in \D \setminus \C} M_h \right).
			\end{equation*}
		\end{enumerate}
	\end{lemma}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: RNABOX - Important and interesting properties of some interim objects
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Important and interesting properties of some interim objects}
	Iteration index $r$:
	\begin{itemize}
		\item $\U_r,\, \L_r,\, \Lt_r$ denote sets $\U,\, \L,\, \Lt$ respectively, in the $r$-th iteration of the {\em RNABOX} algorithm, 
		at the moment after {\footnotesize Step 3 ($\Lt$)} and before {\footnotesize Step 4 (decision)}, $r = 1, \ldots, r^*$.
		\item $r^* \leq \card{\H} +1 < \infty$ indicates the final iteration of the algorithm.
	\end{itemize}
	\przerwa\przerwa
	\begin{lemma}
		\label{lem:s_in_rnabox}
		If the optimal solution to Problem BC is a {\bf regular} solution, then
		\begin{equation}
			\label{eq:lem:s_in_rnabox_any}
			s(\L_{r-1}, \U_{r-1}) \geq s(\L_r, \U_r), \ind{r = 2, \ldots, r^* \geq 2.}
		\end{equation}
	\end{lemma}
	\przerwa
	\begin{lemma}
		\label{lem:U} 
		\begin{equation}
			\label{eq:lem:U}
			\U_{r-1} \supseteq \U_r, \ind{r = 2, \ldots, r^* \geq 2.}
		\end{equation}
	\end{lemma}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 														Execution time comparisons
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Execution time comparisons}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: RNABOX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Comparison for 20 and 691 strata}
	\begin{figure}
		\includegraphics[width=\linewidth]{fig_rnabox_3_2.pdf} 	
	\end{figure}
	{\em FPIA} - our R implementation of a fixed point iteration algorithm by \citet*{MSW}. \\
	Number of iterations are given in brackets. For {\em RNABOX} we report a vector, of which i-th element gives a number of 
	iterations of the {\em RNA} at the i-th iteration of the {\em RNABOX}. 
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: RNABOX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Comparison for 703 and 1405 strata}
	\begin{figure}
		\includegraphics[width=\linewidth]{fig_rnabox_11_22.pdf} 	
	\end{figure}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 														STRATALLO
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{R Package {\tt stratallo}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: STRATALLO
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Key features}
	\begin{itemize}
		\item Provides {\bf functions} that {\bf solve the optimum allocation} Problem BC (and some of its relaxed versions).
		\item Employs best coding practices to meet specific requirements of modern computing tools:
			\begin{itemize}
				\item {\bf quality} (code styling, documentation, vignettes, version control) and
				\item {\bf validation} (extensive unit tests, argument assertions).
			\end{itemize}
		\item Data structures: {\bf simple numerical vectors}.
		\item Almost no {\bf dependency} on external R packages.
		\item {\bf CRAN}: \href{https://cran.r-project.org/package=stratallo}{https://cran.r-project.org/package=stratallo}
		\item {\bf GitHub}: \href{https://github.com/wwojciech/stratallo}{https://github.com/wwojciech/stratallo}
	\end{itemize}
	\przerwa\przerwa\przerwa
	User functions:
	\begin{itemize}
		\item Allocation functions: {\tt opt(), optcost()}.
		\item Helper functions: {\tt ran\_round(), round\_oric(), var\_st(), var\_st\_tsi(), asummary().}
	\end{itemize}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: STRATALLO
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Example of use}

\begin{adjustwidth}{2em}{2em}
{\color{bluencs} \faCogs ~ opt(), var\_st(), asummary().} 
\begin{lstlisting}[language=R]
> # Example population with 4 strata.
> a <- c(3000, 4000, 5000, 2000)
> # Lower bounds.
> m <- c(100, 90, 500, 50)
> # Upper bounds.
> M <- c(300, 400, 800, 90)
> # Total sample size.
> n <- 1285
>
> # Optimal allocation under box constraints.
> (xopt <- opt(n, a, m, M))
[1] 297.8571 397.1429 500.0000  90.0000
>
> # Value of the variance of the stratified pi estimator.
> var_st(xopt, a, a0 = 20)
[1] 164928
>
> # Allocation summary.
> asummary(xopt, a, m, M)
						 a   m    M   allocation take_m take_M take_Neyman
Stratum_1 3000 100  300 			 297.9                         *
Stratum_2 4000  90  400 			 397.1                         *
Stratum_3 5000 500  800 			 500.0      *                   
Stratum_4 2000  50   90 			  90.0             *            
SUM            740 1590				1285.0      1      1           2
>
> # Rounding.
> round_oric(xopt)
[1] 298 397 500  90
\end{lstlisting}
\end{adjustwidth}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 														Summary
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Summary}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: Summary
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Optimum Sample Allocation Under Box Constraints. The RNABOX Algorithm.}
	\begin{enumerate}
		\item Problem BC
			\begin{align*}
				\underset{\x \in \R_+^{\card{\H}}}{\texteq{minimize ~\,}}  & \quad f(\x) = \sum_{h \in \H} \tfrac{A_h^2}{x_h} \\
				\text{subject to}	& \quad \sum_{h \in \H} x_h = n \\
				& \quad m_h \leq x_h \leq M_h, \ind{h \in \H.}
			\end{align*}
		\item Optimality conditions \\
			 $\x^*$ is an optimal (regular) solution to Problem BC if and only if $\x^* = (x_h^{(\L, \U)},\, h \in \H)$, where 
			\begin{equation*}
				x_h^{(\L, \U)} = 
				\begin{cases}
					m_h,											& \ind{h \in \L} \\
					M_h,											& \ind{h \in \U} \\
					A_h\, s(\L, \U) \in (m_h,M_h),	& \ind{h \in (\L \cup \U)^c,}
				\end{cases}
			\end{equation*}
			with $\L \cup \U \subsetneq \H$ such that
			\begin{equation*}
				\begin{gathered}
					\L = \left\{h \in \H:\, s(\L, \U) \leq \tfrac{m_h}{A_h} \right\}, \qquad\quad
					\U = \left\{h \in \H:\, s(\L, \U) \geq \tfrac{M_h}{A_h} \right\}.
				\end{gathered}
			\end{equation*}
		
		\item \colorbox{yellow}{\textcolor{red}{New {\em RNABOX} algorithm that solves Problem BC (and generalizes 
		existing {\em RNA}).}}
		\item R package {\tt stratallo}.
	\end{enumerate}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide: References
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[plain]{References}
	
	\begin{thebibliography}{1}
		
		\harvarditem{Boyd \harvardand\ Vandenberghe}{2004}{Boyd}
		Boyd, S. \harvardand\ Vandenberghe, L.  \harvardyearleft 2004\harvardyearright.
		\newblock {\em {Convex Optimization}}, Cambridge University Press, Cambridge.
		
		\harvarditem{Cont \harvardand\ Heidari}{2014}{Cont}
		Cont, R. \harvardand\ Heidari, M.  \harvardyearleft 2014\harvardyearright .
		\newblock Optimal rounding under integer constraints. \newline
		\url{https://arxiv.org/abs/1501.00014}
		
		\harvarditem[Friedrich et~al.]{Friedrich, Münnich, {de Vries} \harvardand\
			Wagner}{2015}{Friedrich}
		Friedrich, U., Münnich, R., {de Vries}, S. \harvardand\ Wagner, M.
		\harvardyearleft 2015\harvardyearright .
		\newblock {Fast integer-valued algorithms for optimal allocations under
			constraints in stratified sampling}, {\em Computational Statistics \& Data
			Analysis}, 92, pp.~1--12.
		\newline
		\url{https://www.sciencedirect.com/science/article/pii/S0167947315001413}
		
		\harvarditem[Gabler et~al.]{Gabler, Ganninger \harvardand\ Münnich}{2012}{GGM}
		Gabler, S., Ganninger, M. \harvardand\ Münnich, R.  \harvardyearleft
		2012\harvardyearright .
		\newblock {Optimal allocation of the sample size to strata under box
			constraints}, {\em Metrika}, 75(2), pp.~151--161.
		\newline \url{https://doi.org/10.1007/s00184-010-0319-3}
		
		\harvarditem[Münnich et~al.]{Münnich, Sachs \harvardand\ Wagner}{2012}{MSW}
		Münnich, R.~T., Sachs, E.~W. \harvardand\ Wagner, M.  \harvardyearleft
		2012\harvardyearright .
		\newblock {Numerical solution of optimal allocation problems in stratified
			sampling under box constraints}, {\em AStA Advances in Statistical Analysis},
		96(3), pp.~435--450.
		\newline \url{https://doi.org/10.1007/s10182-011-0176-z}
		
		\harvarditem[Särndal et~al.]{Särndal, Swensson \harvardand\
			Wretman}{1992}{Sarndal}
		Särndal, C.-E., Swensson, B. \harvardand\ Wretman, J.  \harvardyearleft
		1992\harvardyearright .
		\newblock {\em {Model Assisted Survey Sampling}}, Springer, New York.
		
		\harvarditem[Wesołowski et~al.]{Wesołowski, Wieczorkowski \harvardand\
			Wójciak}{2021}{WWW}
		Wesołowski, J., Wieczorkowski, R. \harvardand\ Wójciak, W.  \harvardyearleft
		2021\harvardyearright .
		\newblock {Optimality of the Recursive Neyman Allocation}, {\em Journal of
			Survey Statistics and Methodology}, 10(5), pp.~1263--1275.
		\newline
		\url{https://academic.oup.com/jssam/article-pdf/10/5/1263/46878255/smab018.pdf} \newline
		\url{https://arxiv.org/abs/2304.07034}
		
		\harvarditem{Wright}{2017}{Wright2017}
		Wright, T.  \harvardyearleft 2017\harvardyearright .
		\newblock {Exact optimal sample allocation: More efficient than Neyman}, {\em Statistics \& Probability Letters}, 129, 
		pp.~50--57.
		\newline
		\url{https://www.sciencedirect.com/science/article/pii/S0167715217301657}
		
		\harvarditem[Wójciak et~al.]{Wójciak, Wesołowski \harvardand\ Wieczorkowski}{2023}{stratallo_src}
		Wójciak, W., Wesołowski, J. \harvardand\ Wieczorkowski, R.  \harvardyearleft 2023\harvardyearright .
		\newblock {R Package stratallo - source code}.
		\newline \url{https://github.com/wwojciech/stratallo}
		
		\harvarditem{Wójciak}{2023}{stratallo}
		Wójciak, W.  \harvardyearleft 2023\harvardyearright .
		\newblock {\em {{\tt stratallo}: Optimum Sample Allocation in Stratified Sampling}}.
		\newblock R package version 2.2.1.
		\url{https://CRAN.R-project.org/package=stratallo}

	\end{thebibliography}
	
	% Footer
	\vspace*{\fill}
	\przerwa\przerwa
	\begin{flushright}
		\begin{footnotesize}
			\textcolor{mygray}{\Letter ~wojciech.wojciak.dokt@pw.edu.pl} \\
			\textcolor{mygray}{Last updated: \DTMsetstyle{iso}\today} 
		\end{footnotesize}
	\end{flushright}

\end{frame}

\end{document}