Update on Overleaf.

master
Atri Rudra 2022-06-08 15:31:23 +00:00 committed by node
parent 960bcf9b8b
commit 3363910fbf
1 changed files with 10 additions and 4 deletions

View File

@ -95,18 +95,24 @@ Given the above, the algorithm is a sampling based algorithm for the above sum:
to $\abs{\coef}$ and compute $\vari{Y}=\indicator{\isInd{\encMon}}
\cdot \prod_{X_i\in \monom} p_i$.
Repeating the sampling an appropriate number of times
and computing the average of $\vari{Y}$ gives us our final estimate. To illustrate the sampling procedure using~\Cref{fig:circuit}, \onepass recursively computes $\abs{\circuit}\inparen{1,\ldots, 1}$ for any subcircuit whose sink is gate \circuit. The gray values in~\Cref{fig:circuit} illustrate these computations, as seen, for example in the leftmost $\circplus$ (red) gate, where $\abs{\circuit}\inparen{1,\ldots, 1}$ is the sum of its children's values. The probability of sampling the left child of the red gate is then the computed sum of its left child divided by the red gate's computed sum, $\frac{1}{3}$.% = \abs{\circuit_\linput}\inparen{1,\ldots, 1} + \abs{\circuit_\rinput}\inparen{1,\ldots, 1}$, the sum of its children's values.
and computing the average of $\vari{Y}$ gives us our final estimate.
We illustrate \sampmon (\Cref{alg:sample}), using the circuit $\circuit$ in \Cref{fig:circuit}. As a pre-processing step, \onepass (\Cref{alg:one-pass-iter}) recursively (for each sub-circuit) computes $\abs{\circuit}\inparen{1,\ldots, 1}$ in the obvious manner.
%for any subcircuit whose sink is gate \circuit.
The \textcolor{gray}{gray} values in~\Cref{fig:circuit} represent the value $\abs{\circuit'}\inparen{1,\ldots, 1}$ for each sub-circuit $\circuit'$ rooted at the corresponding node. E.g. in the bottom right $\circmult$ (\textcolor{blue}{blue}) gate, the value is $1\times 1=1$ (where the left child has $Y=1$ and the right child has $\abs{-1}=1$).
%The probability of sampling the left child of the red gate is then the computed sum of its left child divided by the red gate's computed sum, $\frac{1}{3}$.% = \abs{\circuit_\linput}\inparen{1,\ldots, 1} + \abs{\circuit_\rinput}\inparen{1,\ldots, 1}$, the sum of its children's values.
% visits each gate \circuit exactly once, computing $\abs{\circuit}\inparen{1,\ldots, 1}$. %for each gate \circuit.
%If we consider the leftmost source gates, \onepass computes $\abs{\circuit}\inparen{1,\ldots,1} = 1$ for $\circuit.\val = X$ and $\abs{\circuit}\inparen{1,\ldots, 1} = 2$ for $\circuit.\val = 2$. For the leftmost $\circmult$ gate, \onepass computes $\abs{\circuit}\inparen{1,\ldots, 1} = 2\circmult 1$, i.e. $\abs{\circuit_\linput}\inparen{1,\ldots, 1} \times \abs{\circuit_\rinput}\inparen{1,\ldots, 1}$ for children $\circuit_\linput$ and $\circuit_\rinput$. A level higher, the leftmost $\circplus$ gate recursively adds the values of its two children deriving $\abs{\circuit}\inparen{1,\ldots, 1} = 2 \circplus 1$, while using the expression $\frac{\abs{\circuit_i}\inparen{1,\ldots, 1}}{\abs{\circuit}\inparen{1,\ldots, 1}}$ for $i\in\inset{\linput, \rinput}$ to simultaneously compute the weights $\frac{1}{3}$ and $\frac{2}{3}$ for its children. The final sum value is then computed in similar fashion. % yielding $\abs{\circuit}\inparen{1,\ldots, 1} = 3 \circmult 3 = 9$.
%Given the computed values of \onepass, \sampmon picks a sampling path by traversing both children of a $\circmult$ gate and randomly choosing a child from a $\circplus$ gate according to the weight $\frac{\abs{\circuit_i}\inparen{1,\ldots, 1}}{\abs{\circuit}\inparen{1,\ldots, 1}}$ for $i\in\inset{\linput, \rinput}$.
%then uses the weights provided by \onepass to randomly select a monomial from $\expansion{\circuit}$.
To sample the monomial $\inparen{XY, -1}$ in~\Cref{fig:circuit}, \sampmon recursively traverses both children of the sink $\circmult$ gate. Since both red and purple children are $\circplus$ gates, \sampmon then randomly selects the left child of red gate with the aforementioned probability and the right child of the purple gate with probability $\frac{1}{3}$, computed likewise. Note that the probabilty for choosing both the red and purple gates is $\frac{1}{9}$, which is indeed the ratio of the number of $\inparen{XY, -1}$ terms to the total number of terms in $\expansion{\circuit}$, thus a correct sampling probability. For the recursive call on the red gate, $\inparen{X, 1}$ is returned, while the purple gate recursively visits both children of the sampled $\circmult$ gate, returning $\inparen{Y, 1}$. %Multiplying $-1 \circmult XY$, concludes the random sampling of monomial $-XY$. Suppose \sampmon also randomly samples $X$ and $-Y$ from $\rpoly$ in a call to \approxq. To estimate $\rpoly\inparen{\vct{\prob}}$, \approxq computes $\prob_X - \prob_X\prob_Y - \prob_Y$ and scales the accumulation accordingly.
We now consider a partial run of \sampmon that samples $\inparen{XY, -1}$ in~\Cref{fig:circuit}. It recursively traverses \emph{both} children of the sink $\circmult$ gate. For the \textcolor{red}{red} and \textcolor{green}{green} children, which are both $\circplus$ gates, we randomly choose one of their children. Specifically \sampmon then randomly picks the right child (\textcolor{blue}{blue} $\circmult$ gate that represents $-Y$ and is computed by recursing on both children of the (\textcolor{blue}{blue} $\circmult$ gate) with probability of $\frac{1}{3}$ (where the numerator and denominator are the values computed by \onepass for the \textcolor{blue}{blue} $\circmult$ and \textcolor{green}{green} $\circplus$ gates respectively). Similarly at the left \textcolor{red}{red} $\circplus$ gate we sample the left child (representing $X$ and is computed by recursing to the leaf node $X$) with probability $\frac{1}{3}$. Note that the probability for choosing $\inparen{XY, -1}$ overall is $\frac{1}{3}\cdot \frac{1}{3}=\frac{1}{9}$, which is indeed the ratio of the coefficient of $\inparen{XY, -1}$ to the sum of all coefficients in $\abs{\circuit}$, as needed. %For the recursive call on the red gate, $\inparen{X, 1}$ is returned, while the purple gate recursively visits both children of the sampled $\circmult$ gate, returning $\inparen{Y, 1}$. %Multiplying $-1 \circmult XY$, concludes the random sampling of monomial $-XY$. Suppose \sampmon also randomly samples $X$ and $-Y$ from $\rpoly$ in a call to \approxq. To estimate $\rpoly\inparen{\vct{\prob}}$, \approxq computes $\prob_X - \prob_X\prob_Y - \prob_Y$ and scales the accumulation accordingly.
%such that a source gate \circuit has $\abs{\circuit}\inparen{1,\ldots, 1} = \circuit.\val$ when \circuit.\type $=$ \num and $\abs{\circuit}\inparen{1,\ldots,1} = 1$ otherwise. For every gate \circuit, \onepass computes $\abs{\circuit}\inparen{1,\ldots, 1}$ as seen in the lighter font of~\Cref{fig:circuit}. \onepass further weights each child $\circuit_i$ for $i\in\inset{\linput, \rinput}$, by the expression $\frac{\abs{\circuit_i}\inparen{1,\ldots, 1}}{\abs{\circuit}\inparen{1,\ldots, 1}}$. These weight are the basis for the sampling performed by \sampmon.
All algorithm details are in \Cref{sec:proofs-approx-alg}.
All algorithm details, including those for \approxq (\Cref{alg:mon-sam}) are in \Cref{sec:proofs-approx-alg}.
%%%%%%%%%%%%%%%%%%%%%%%
\mypar{Runtime analysis} We can argue the following runtime for the algorithm outlined above (which solves \Cref{prob:intro-stmt}):
\mypar{Runtime analysis} We can argue the following runtime for the \approxq (which solves \Cref{prob:intro-stmt}):
\begin{Theorem}
\label{cor:approx-algo-const-p}
Let \circuit be an arbitrary \emph{\abbrOneBIDB} circuit, define $\poly(\vct{X})=\polyf(\circuit)$, let $k=\degree(\circuit)$, and let $\gamma=\gamma(\circuit)$. Further let it be the case that $\prob_i\ge \prob_0$ for all $i\in[\numvar]$. Then for all $\epsilon'>0$, an estimate $\mathcal{E}$ of $\rpoly(\prob_1,\ldots, \prob_\numvar)$