\section{Introduction}
\label{sec:intro}

With the discovery of a new scalar particle the Higgs boson~\cite{HIGG-2012-27,CMS-HIG-12-028} at the LHC~\cite{Evans:2008zzb} by the ATLAS and CMS collaborations with a mass of 125 GeV~\cite{HIGG-2016-33,HIGG-2013-12,HIGG-2014-14,CMS-HIG-14-009}, the whole content of the Standard Model (SM) of particle physics became complete. A priority of the ATLAS and CMS collaborations has been to better understand its properties and couplings.
After the EWSB and the higgs field acquires the vev, the higgs potential obtained in Equation.. can be obtained as following:
\begin{align}
	V(\phi) \rightarrow V(\phi)_{\text{EWSB}} =  -\lambda \nu^2 h^2 - \lambda \nu h^3 - \frac{1}{4} \lambda h^4 + \text{const.}
	\label{eq:higgs_pot}
\end{align}
The first term of the above equation is the Higgs mass term, and the remaining are the trilinear and quadri-linear Higgs-self couplings,
\begin{align}
	\underbrace{m_{h} = \sqrt{ - 2 \mu^2} = \sqrt{ 2 \lambda v^2 }}_\text{Higgs boson mass} \hspace{1cm} \underbrace{\lambda_{hhh} \propto \frac{m_h^2}{v} \hspace{1cm} \lambda_{hhhh} \propto \frac{m_h^2}{v^2}}_\text{Trilinear and quadri-linear Higgs self-couplings}.
	\label{eq:higgs_self_couplings}
\end{align}
A measurements of this couplings would therefore give a hint about the actual structure of the potential, whose shape can have  theoretical consequences. The quartic Higgs coupling, $\lambda_{hhhh}$, can not be measured at LHC since the cross-section of triple Higgs production is small~\cite{PhysRevD.74.113008}~\cite{PhysRevD.93.035026}, while the trilinear coupling can be probed directly in Higgs pair production.

The trilinear coupling leads to non-resonant pair production of Higgs bosons, where an off-shell
Higgs decays to a pair of Higgs bosons, the leading production mechanism being $gg$-fusion.
Direct observation of Higgs pair production would lead to measurements directly sensitive to
$\lambda$ but in the SM there are competing diagrams, proceeding via quark (re: top quark) loops
that are instead senstive to the Yukawa coupling of the Higgs rather than the trilinear coupling
$\lambda$. These \dihiggs production mechanisms are illustrated in the Feynman diagrams presented
in Figure \ref{fig:sm_nonres_hh}. Not only does the quark-loop induced process present
itself as an irreducible background to the process senstive to the Higgs self-coupling, but
it interfereces \textit{destructively} with the latter, making the observation of this
type of Higgs pair production more challenging.

% Due to its lower cross section, diHiggs production is not expected to be observed in the current data taking setup, however it is possible to define limits on the measurement to constrain the BSM physics theories.
\begin{figure}[!htb]
    \centering
    \includegraphics[width=0.9\textwidth]{figures/sm_nonres_hh_production}
    \caption{Representative diagrams that contribute to non-resonant \hh production.
    \textit{Left}: Diagram that is sensitive to the trilinear coupling, $\lambda$.
    \textit{Right}: Box diagram that interferese destructively with the $\lambda$-sensitive
    process.}
    \label{fig:sm_nonres_hh}
\end{figure}

As a result of the destructive interference, and the already relatively large Higgs mass of
125 \GeV, the SM \dihiggs production has a total cross-section of $\sim 33.4$ fb ~\cite{CERN-YR-4}
at a \pp center-of-mass collision energy of 13 \TeV. The inclusive cross-section for the pair-production
of top quarks, which will be one of the dominant SM backgrounds in the present
analysis, is nearly 1000 pb, or $1\times10^6$ fb ~\cite{TOPQ-2015-09, ATLAS-CONF-2015-049}. That
of \textit{single} Higgs production is $\sim 50$ pb, or $5 \times 10^4$ fb ~\cite{ATLAS-CONF-2015-060}.

Furthermore, enhancements to the di-Higgs production rate, either non-resonantly or through a resonance, may be observable with the full Run2 dataset and would point to new physics beyond the Standard Model, making such analyses interesting now. The wide class of two Higgs double models (2HDM) predict an altered and enlarged
Higgs sector from which the currently Higgs is built.
The Minimal Supersymmetric Standard Model
(MSSM) is a  class of 2HDM. For the latter set, one such model is a Randall-Sundrum
type graviton or the lightest Kaluza-Klein excitation which have masses of at least
$2\times$ the mass of the SM Higgs boson. The presence of such BSM scenarios would act to alter
the measured value of $\lambda$ with respect to that of the SM, potentially enlarging it.
As a result, early evidence for the pair-production of Higgs bosons within the current
Run-2 dataset may indicate the presence of new physics without having to resort to
precision measurements of $\lambda$. Examples of such decay
scenarios are illustrated in example Feynman diagrams in Figure \ref{fig:2hdm_feynman_diagrams}.

\begin{figure}[!htb]
    \centering
    \includegraphics[width=0.8\textwidth]{figures/mg5_hh_heavy_scalar.png}
    \includegraphics[width=0.8\textwidth]{figures/mg5_hh_2hdm_cp_even.png}
    \caption
    {
        Diagrams contributing to enhanced $hh$ production scenarios.
        \textit{Top}: A heavy scalar, $H$, that couples to the Standard Model Higgs
        boson, $h$, contributes to the Standard Model processes (left two diagrams).
        \textit{Bottom}: CP-even diagrams in 2HDM scenario that contribute to enhanced
        non-resonant production of Standard Model Higgs bosons as well as resonant
        channels with the heavy CP-even Higgs, $H^0$, decaying to the Standard Model
        low-mass CP-even Higgs, $h$.
    }
    \label{fig:2hdm_feynman_diagrams}
\end{figure}

In addition to the hh production mechanisms described above, the searches for evidence of an dditional extended Higgs sector model that introduces two new heavy Higgs bosons, X and S~\cite{vonBuddenbrock:2016rmr}. In this model, $X$ couples strongly to both $S$ and $h$. $S$ couples weakly to SM particles, suppressing direct production, but has the same mass-dependent branching ratios as $h$.

Searches for resonant Higgs pair production have been performed in a number of final states, $b\bar{b}b\bar{b}$, $b\bar{b}\tau^{\pm}\tau^{\mp}$, $b\bar{b}\gamma\gamma$, $W^{\pm}W^{\mp *}\gamma\gamma$, $b\bar{b}VV$ (With $V$ either $Z$ or $W$) and $W^+W^-W^+W^-$ at $\sqrt{s}=8\,\TeV$ and $\sqrt{s}=13\,\TeV$ by ATLAS~\cite{HIGG-2013-33,Aad:2019uzh} and CMS collaborations~\cite{CMS-HIG-13-032,CMS-HIG-15-013,PhysRevLett.122.121803} including the combination of multiple final states.

In this note, the searches for the \dihiggs non-resonant production in multilepton final states is described. Typically the decay modes of \dihiggs of $W^+W^-W^+W^-$, $ZZ^*bb$, $VV\tauh\tauh$, $\tauh\tauh\tauh\tauh$, $ZZZZ$ are the dominant ones which corresponds to 5.7\% of all \dihiggs decays. Additionally, $\gamma\gamma + X$ final states are studied which corresponds to 0.13\% of \dihiggs decays. Simple extension of the SM by introducing two new scalars $gg \rightarrow X \rightarrow SH$ signature is investigated.

This note is organised as follows: Section~\ref{sec:dataset} describes the Monte Carlo (MC) samples as well as the
recorded dataset used in this analysis. The object definition and event preselection are detailed in Section~\ref{sec:objselec}.
The signal region definitions and the multivariate analysis discriminants are described in Section~\ref{sec:eventselec}.
The reducible background estimates using data-driven method are explained in Section~\ref{sec:nonpromptbkg}.
%Section~\ref{sec:bkgval} shows the data and MC agreement of the prompt lepton background contributions in
various validation regions.
Theoretical and experimental systematic uncertainties are described in Section~\ref{sec:systematics}.
An overview of the signal regions before the fit can be found in Section~\ref{sec:signalregion}.
Section~\ref{sec:results} describes the expected fit results for each individual channel and the
expected and observed fit results for the combination.
Finally, the conclusions are summarised in Section~\ref{sec:conclusion}.


\section{Introduction}\label{sec:intro}

Fish population (aka "stock")  assessment models determine the impact of past fishing on the historical and current abundance of the population, evaluate sustainable rates of removals (catch), and project future levels of catch reflecting one or more risk-averse catch rules.  These catch rules are codified in regional Fishery Management Plans according to requirements of the Sustainable Fisheries Act.  In the U.S., approximately 500 federally managed fish and shellfish populations are managed under approximately 50 Fishery Management Plans.  About 200 of these populations are assessed each year, based on a prioritized schedule for their current status. Despite this, many minor species have never been quantitatively assessed.  Although the pace is slower than that for weather forecasting, fish stock assessments are operational models for fisheries management.

Assessment models typically assimilate annual catches, data on fish abundance from diverse surveys and fishery sources, and biological information regarding fish body size and proportions at age.  A suite of models is available depending on the degree of data availability and unique characteristics of the fish population or its fishery.  Where feasible, environmental time series are used as indicators of changes in population or observation processes, especially to improve the accuracy of the projections of abundance and sustainable catch into the future.  Such linkages are based principally on correlations given the challenge of conducting field observations on an appropriate scale.  The frontier of model development is in the rapid estimation of parameters to include random temporal effects, in the simultaneous modeling of a suite of interacting species, and in the explicit treatment of the spatial distribution of the population.

Assessment models are loosely coupled to other models. For example, an ocean-temperature or circulation model or benthic-habitat map may be directly included in the pre-processing of the fish abundance survey.  A time series of a derived ocean factor, like the North Atlantic Oscillation, can be included as an indicator of a change in a population process.  Output of a multi-decadal time series of derived fish abundance can be an input to ecosystem and economic models to better understand cumulative impacts and benefits.

Stock Synthesis is an age- and size-structured assessment model in the class of models termed integrated analysis models. Stock Synthesis has evolved since its initial inception in order to model a wide range of fish populations and dynamics.  The most recent major revision to Stock Synthesis occurred in 2016, when version 3.30 was introduced. This new version of Stock Synthesis required major revisions to the input files relative to earlier versions (see the \hypertarget{ConvIssues}{Converting Files} section for more information). The acronym for Stock Synthesis has evolved over time with earlier versions being referred to as SS2 (SS v.2.+), SS3 (SS v.3.+), or just simply SS.  The current official abbreviation of Stock Synthesis is SS3 for all versions greater than SS v.3.+.

SS3 has a population sub-model that simulates a stock's growth, maturity, fecundity, recruitment, movement, and mortality processes, an observation sub-model estimates expected values for various types of data, a statistical sub-model characterizes the data’s goodness of fit and obtains best-fitting parameters with associated variance, and a forecast sub-model projects needed management quantities.  SS3 outputs the quantities, with confidence intervals, needed to implement risk-averse fishery control rules. The model is coded in C++ with parameter estimation enabled by automatic differentiation (\href{http://www.admb-project.org}{admb}).  Windows, Linux, and iOS versions are available.  Output processing and associated tools are in R, and a graphical interface is in QT.  SS is available from NOAA’s VLAB. The rich feature set in SS allows it to be configured for a wide range of situations.  SS3 has become the basis for a large fraction of U.S. assessments and many other assessments around the world.

This manual provides a guide for using SS. The guide contains a description of the input and output files and usage instructions. An overview and technical description of the model itself is in \citet{methotstock2013}. However, SS3 has continued to evolve and grow since the publication in 2013, with this manual reflecting the most up to date information regarding SS.  The model and a graphical user interface are available from the NOAA \href{https://vlab.noaa.gov/group/stock-synthesis/home}{VLAB}. The VLAB site also provides a user forum for posting questions and for accessing various additional materials.  An output processor package, r4ss, in R is available for download from CRAN or \href{https://github.com/r4ss/r4ss}{GitHub}.

Additional guidance for new users can be found in the SS3 \href{https://vlab.noaa.gov/group/stock-synthesis/document-library}{document library} within the NOAA VLAB website.  The "Begin Here - Introduction to Stock Synthesis" folder located in the Document Library contains step-by-step guidance for running Stock Synthesis.

\pagebreak

\section{File Organization}\label{FileOrganization}
	\subsection{Input Files}
	\begin{enumerate}
		\item starter.ss: required file containing filenames of the data file and the control file plus other run controls (required).
		\item datafile: file containing model dimensions and the data (required)
		\item control file: file containing set-up for the parameters (required)
		\item forecast.ss: file containing specifications for reference points and forecasts (required)
		\item ss.par: previously created parameter file that can be read to overwrite the initial parameter values in the control file (optional)
		\item wtatage.ss: file containing empirical input of body weight by fleet and population and empirical fecundity-at-age (optional)
		\item runnumber.ss: file containing a single number used as run number in output to CumReport.sso and in the processing of profilevalues.ss (optional)
		\item profilevalues.ss: file contain special conditions for batch file processing (optional)
	\end{enumerate}

	\subsection{Output Files}
	\begin{enumerate}
		\item data.ss\textunderscore new: Contains a user-specified number of datafiles, generated through a parametric bootstrap procedure, and written sequentially to this file.
		\item control.ss\textunderscore new: Updated version of the control file with final parameter values replacing the initial parameter values.
		\item starter.ss\textunderscore new: New version of the starter file with annotations.
		\item Forecast.ss\textunderscore new: New version of the forecast file with annotations.
		\item warning.sso: This file contains a list of warnings generated during program execution.
		\item echoinput.sso: This file is produced while reading the input files and includes an annotated echo of the input. The sole purpose of this output file is debugging input errors.
		\item Report.sso: This file is the primary report file.
		\item ss\_summary.sso: Output file that contains all the likelihood components, parameters, derived quantities, total biomass, summary biomass, and catch. This file offers an abridged version of the report file that is useful for quick model evaluation. This file is only available in SS3 v.3.30.08.03 and greater.
		\item CompReport.sso: Observed and expected composition data in a list-based format.
		\item Forecast-report.sso: Output of management quantities and for forecasts.
		\item CumReport.sso: This file contains a brief version of the run output, output is appended to current content of file so results of several runs can be collected together.  This is useful when a batch of runs is being processed.
		\item Covar.sso: This file replaces the standard ADMB ss.cor with an output of the parameter and derived quantity correlations in database format.
		\item ss.par: This file contains all estimated and fixed parameters from the model run.
		\item ss.std, ss.rep, ss.cor etc.:  Standard ADMB output files.
		\item checkup.sso: Contains details of selectivity parameters and resulting vectors.  This is written during the first call of the objective function.
		\item Gradient.dat: New for SS3 v.3.30, this file shows parameter gradients at the end of the run.
		\item rebuild.dat: Output formatted for direct input to Andre Punt's rebuilding analysis package.  Cumulative output is output to REBUILD.SS (useful when doing MCMC or profiles).
		\item SIS\_table.sso: Output formatted for reading into the NMFS Species Information System.
		\item Parmtrace.sso: Parameter values at each iteration.
		\item posteriors.sso, derived\_posteriors.sso, posterior\_vectors.sso: Files associated with MCMC.
	\end{enumerate}

	\subsection{Auxiliary Files}
	These files are additional files (e.g. excel files) which allow for exploration or understanding of specific parameterization which can assist in selecting appropriate starting values.  These files are available for download from the Vlab website.
	\begin{enumerate}
		\item SS3-OUTPUT.xls: Excel file with macros to read report.sso and display results.
		\item SS\_330\_Control\_Setup.xls:
		\begin{enumerate}
			\item Shows how to setup an example control file for SS.
		\end{enumerate}
		\item SS\_330\_Data\_Input.xls:
		\begin{enumerate}
			\item Shows how to setup an example data input file for SS.
		\end{enumerate}
		\item SS\_330\_Starter\&Forecast.xls:
		\begin{enumerate}
			\item Shows how to setup an example starter and forecast input files for SS.
		\end{enumerate}

	\end{enumerate}

\pagebreak

\section{Starting Stock Synthesis}
SS3 is typically run through the command line interface, although it can also be called from another program, R, the SS-GUI or a script file (such as a DOS batch file). SS3 is compiled for Windows, Mac, and Linux operating systems. The memory requirements depend on the complexity of the model you run, but in general, SS3 will run much slower on computers with inadequate memory. See the Running Stock Synthesis section on page \pageref{sec:RunningSS} for additional notes on methods of running SS3.

Communication with the program is through text files.  When the program first starts, it reads the file starter.ss, which typically must be located in the same directory from which SS3 is being run.  The file starter.ss contains required input information plus references to other required input files, as described in the File Organization section on page \pageref{FileOrganization}.  The names of the control and data files must match the names specified in the starter.ss file.  File names, including starter.ss, are case-sensitive on Linux and Mac systems but not on Windows. The echoinput.sso file outputs how the executable read each input file and can be used for troubleshooting when trying to setup a model correctly.  Output from SS3 consists of text files containing specific keywords.  Output processing programs, such as the SS3 GUI, Excel, or R can search for these keywords and parse the specific information located below that keyword in the text file.

\pagebreak


 \documentclass [12pt]{article}

\usepackage {amsmath}
\usepackage {amsthm}
\usepackage {amssymb}
\usepackage {graphicx}
\usepackage {float}
\usepackage {multirow}
\usepackage {xcolor}
\usepackage [ruled,vlined,commentsnumbered,titlenotnumbered]{algorithm2e} \usepackage {array}
\usepackage {booktabs}
\usepackage {url}
\usepackage {parskip}
\usepackage [margin=1in]{geometry}
\usepackage [T1]{fontenc}
\usepackage {cmbright}
\usepackage [many]{tcolorbox}
\usepackage [colorlinks = true,
            linkcolor = blue,
            urlcolor  = blue,
            citecolor = blue,
            anchorcolor = blue]{hyperref}
\usepackage {enumitem}
\usepackage {xparse}
\usepackage {verbatim}
\usepackage{algpseudocode}
\usepackage{listings}
\usepackage{xcolor}
\lstset { %
    language=C++,
    backgroundcolor=\color{black!5}, % set backgroundcolor
    basicstyle=\footnotesize,% basic font setting
}
\newtheorem{theorem}{Theorem}
\newtheorem{remark}{Remark}
\newtheorem{lemma}[theorem]{Lemma}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\newtheorem{claim}{Claim}

\DeclareTColorBox {Solution}{}{breakable, title={Solution}} \DeclareTColorBox {Solution*}{}{breakable, title={Solution (provided)}} \DeclareTColorBox {Instruction}{}{boxrule=0pt, boxsep=0pt, left=0.5em, right=0.5em, top=0.5em, bottom=0.5em, arc=0pt, toprule=1pt, bottomrule=1pt} \DeclareDocumentCommand {\Expecting }{+m}{\textbf {[We are expecting:} #1\textbf {]}} \DeclareDocumentCommand {\Points }{m}{\textbf {(#1 pt.)}}

\begin {document}

\vspace {1em}
\begin {Instruction}
Adapted From Virginia Williams' lecture notes.
\end {Instruction}

{\LARGE \textbf {COMP 285 (NC A\&T, Spr `22)}\hfill \textbf {Lecture 27} }

\begin{centering}
\section*{Dynamic Programmig V - 0/1 Knapsack and Maximal Independent Set}
\end{centering}

\section{The Knapsack Problem}

This is a classic problem, defined as the following:

We have $n$ items, each with a value and a positive weight. The $i$-th item has weight $w_i$ and value $v_i$. We have a knapsack that holds a maximum weight of $W$. Which items do we put in our knapsack to maximize the value of the items in our knapsack? For example, let’s say that $W = 10$; that is, the knapsack holds a weight of at most 10. Also suppose that we have four items, with weight and value:

\begin{table}[h!]
\centering
\begin{tabular}{c|c|c}
Item & Weight & Value \\
\hline
A & 6 &  25 \\
B & 3 & 13 \\
C & 4 & 15 \\
D & 2 & 8
\end{tabular}
\end{table}

We will talk about two variations of this problem, one where you have infinite copies of each item (commonly known as Unbounded Knapsack), and one where you have only one of each item (commonly known as 0-1 Knapsack).

What are some useful subproblems? Perhaps it’s having knapsacks of smaller capacities, or maybe it’s having fewer items to choose from. In fact, both of these ideas for subproblems are useful. As we saw last lecture, the first idea is useful for the Unbounded Knapsack problem, and a combination of the two ideas is useful for the 0-1 Knapsack problem.

\subsection{The 0-1 Knapsack Problem}

We consider what happens when we can take at most one of each item. Going back to the initial example, we would pick item $A$ and item $C$, having a total weight of $10$ and a total value of $40$.

The subproblems that we need must keep track of the knapsack size as well as which items are allowed to be used in the knapsack. Because we need to keep track of more information in our state, we add another parameter to the recurrence (and therefore, another dimension to the DP table). Let $K(x, j)$ be the maximum value that we can get with a knapsack of capacity $x$ considering only items at indices from $1, \cdots , j$. Consider the optimal solution for $K(x, j)$. There are two cases:

\begin{enumerate}
  \item Item $j$ is used in $K(x, j)$. Then, the remaining items that we choose to put in the knapsack must be the optimum solution for $K(x - w_j , j - 1)$. In this case, $K(x, j) = K(x - w_j , j - 1) + v_j$ .
  \item Item $j$ is not used in $K(x, j)$. Then, $K(x, j)$ is the optimum solution for K(x, j - 1). In this case, $K(x, j) = K(x, j - 1)$.
\end{enumerate}

So, our recurrence relation is: $K(x, j) = \max\{K(x -w_j , j -1) +v_j , K(x, j -1)\}$. Now, we’re done: we simply calculate each entry up to $K(W, n)$, which gives us our final answer. Note that this also runs in $O(nW)$ time despite the additional dimension in the DP table. This is because at each entry of the DP table, we do $O(1)$ work.

\begin{algorithm}
\caption{ZeroOneKnapsack(W, n, w, v)}
\label{alg:zerooneknapsack}
\begin{algorithmic}
\State \For{$j = 1, \cdots, n$}{
  $K[0,j] \gets 0$
}
\State \For{$x = 0, \cdots, W$}{
    $K[x, 0] \gets 0$
}
\State \For{$x = 1, \cdots, W$} {
  \State \For{$j = 1, \cdots, n$} {
    \State $K[x, j] \gets K[x, j-1]$
    \State \If {$w_j <= x$} {
        $K[x, j] = \max\{K[x - w_j, j-1] + v_j, K[x, j] \}$
    }
  }
}
\State \Return $K[W, n]$
\end{algorithmic}
\end{algorithm}

\section{The Independent Set Problem}

This problem is as follows:

Say that we have an undirected graph $G = (V, E)$. We call a subset $S \subseteq V$ of vertices ``independent'' if there are no edges between vertices in $S$. Let vertex $i$ have weight $w_i$ , and denote $w(S)$ as the sum of weights of vertices in $S$. Given $G$, find an independent set of maximum weight $arg\max_{S\subseteq V} w(S)$.

Actually, this problem is NP-hard for a general graph $G$. However, if our graph is a tree, then we can solve this problem in linear time. In the following figure, the maximum weight independent set is highlighted in blue.

\begin{remark}
Dynamic programming is especially useful to keep in mind when you are solving a problem that involves trees. The tree structure often lends itself to dynamic programming solutions.
\end{remark}

\begin{figure}[h!]
\centering
\includegraphics[scale=0.5]{max_is.png}
\end{figure}

As usual, the key question to ask is, ``What should our subproblem(s) be?'' Intuitively, if the problem has to do with trees, then subtrees often play an important role in identifying our subproblems. Let's pick any vertex $r$ and designate it as the root. Denoting the subtree rooted at $u$ as $T_u$, we define $A(u)$ to be the weight of the maximum weight independent set in $T_u$. How can we express $A(u)$ recursively? Letting $S_u$ be the maximum weight independent set of $T_u$, there are two cases:

\begin{enumerate}
    \item If $u \notin S_u$, then $A(u) = \sum_{v} A(v )$ for all children $v$ of $u$.
    \item If $u \in S_u$, then $A(u) = w_u + \sum_{v} A(v )$ for all grandchildren $v$ of $u$.
\end{enumerate}

To avoid solving the subproblem for trees rooted at grandchildren, we introduce $B(u)$ as the weight of the maximum weight independent set in $T_u \setminus \{u\}$. That is, $B(u) = \sum_{v} A(v )$ for all children $v$ of $u$. Equivalently, we have the following cases:

\begin{enumerate}
    \item If $u \notin S_u$, then $A(u) = \sum_{v} A(v )$ for all children $v$ of $u$.
    \item If $u \in S_u$, then $A(u) = w_u + \sum_{v} B(v )$ for all children $v$ of $u$.
\end{enumerate}

So, we can calculate the weight of the maximum weight independent set:
$$
A(u) = \max\left\{w(u) + \sum_{v \in Children(u)} B(u), \sum_{v \in Children(u)} A(v)  \right\}
$$

To create an algorithm out of this recurrence, we can compute the $A(u)$ and $B(u)$ values in a bottom-up manner (a post-order traversal on the tree), arriving at the answer, $A(r)$. This
takes $O(|V|)$ time.

\begin{algorithm}
\caption{MaxWeightIndependentSet(G)}
\label{alg:MaxWeightIndependentSet}
\begin{algorithmic}
\State \texttt{// G is a tree}
\State $r \gets \text{ArbitraryVertex}(G)$
\State $T \gets \text{RootTreeAt}(r)$
\Procedure{SolveSubtreeAt}{$u$}
    \State \eIf{Children$(T, u) = \emptyset$} {
        \State $A(u) \gets w_u$
        \State $B(u) \gets 0$
    }{
        \State \For{$v \in \text{Children}(u)$} {
            \State \texttt{SolveSubTreeAt}(v)
        }
        \State $A(u) \gets \max\left\{\sum_{v \in \text{Children}(u)} A(v), w_u + \sum_{v \in \text{Children}(u)} B(v) \right\}$
        \State $B(u) \gets \sum_{v \in \text{Children}(u)} A(v)$
    }
\EndProcedure
\State \texttt{SolveSubtreeAt}$(r)$
\State \Return $A(r)$
\end{algorithmic}
\end{algorithm}

\end{document}