Created
February 18, 2014 21:12
-
-
Save rocarvaj/9080219 to your computer and use it in GitHub Desktop.
Example of algorithm/algorithmic packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\usepackage{algorithm} | |
\usepackage{algorithmic} | |
\renewcommand{\algorithmicensure}{\textbf{Output:}} | |
\begin{algorithm}[!ht] | |
\caption{Solving the Lagrangian dual for (CF)} | |
\label{alg:lower_bound} | |
\begin{algorithmic}[1] | |
\ENSURE Lower bound $\underbar z$ and upper bound $\bar z$. | |
\STATE $S = \emptyset$, $\lambda = 0$, $\pi = 0$ | |
\WHILE{Termination condition is not met} | |
\FOR{$l\in L$} | |
\STATE Compute $z_l = \min\{F_l(x^l, y^l; \lambda, \pi)\colon | |
y^l\in Y\setminus S, x^l\in X_l(y^l)\}$\label{alg:solve_subproblem} | |
\STATE Let $(\bar x^l, \bar y^l)$ be the optimal solution obtained. | |
\ENDFOR | |
\STATE \emph{//Lower bound} | |
\STATE Compute $\underbar{z} = \sum_{l\in L} z_l$ | |
\STATE | |
\STATE \emph{//Upper bound} | |
\FOR{$l\in L$} | |
\STATE Evaluate $\bar y^l$ and update $\bar z$\label{alg:evaluate}. | |
\STATE $S \leftarrow S\cup\{\bar y^l\}$\label{alg:add_cut} | |
\ENDFOR | |
\STATE Update $\lambda$ and $\pi$.\label{alg:update_lambda} | |
\ENDWHILE | |
\end{algorithmic} | |
\end{algorithm} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment