1

i'm not an expert of latex and i can't solve the following problem. I have a long algorithm and this occupies an entire column, the problem is that compiler add a blank space before it, and i need that is aligned with the text.

I've tried with \vspace and \floatsep but not solve the problem.

This is an exactly example of the my problem: Image to explain better: example

and the code to reproduce the problem:

\documentclass[a4paper, twocolumn, 10pt]{article}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage[italian]{babel}

\begin{document}
\begin{algorithm}
\caption{Optimization with Tabu Search of the }\label{alg1}
\begin{algorithmic}[1]
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm
\State row of algorithm

\end{algorithmic}
\end{algorithm}

Tabu search, created by Fred W. Glover in 1986[1] and formalized in 1989,[2][3] is a metaheuristic search method employing local search methods used for mathematical optimization.

Local (neighborhood) searches take a potential solution to a problem and check its immediate neighbors (that is, solutions that are similar except for one or two minor details) in the hope of finding an improved solution\footnote{this is a footnote, it can be userful and i have it on this point and it have two rows}. Local search methods have a tendency to become stuck in suboptimal regions or on plateaus where many solutions are equally fit.

Tabu search enhances the performance of local search by relaxing its basic rule. First, at each step worsening moves can be accepted if no improving move is available (like when the search is stuck at a strict local mimimum). In addition, prohibitions (henceforth the term tabu) are introduced to discourage the search from coming back to previously-visited solutions.

The implementation of tabu search uses memory structures that describe the visited solutions or user-provided sets of rules.[2] If a potential solution has been previously visited within a certain short-term period or if it has violated a rule, it is marked as "tabu" (forbidden) so that the algorithm does not consider that possibility repeatedly.

Tabu search uses a local or neighborhood search procedure to iteratively move from one potential solution x to an improved solution x' in the neighborhood of x, until some stopping criterion has been satisfied (generally, an attempt limit or a score threshold). Local search procedures often become stuck in poor-scoring areas or areas where scores plateau. In order to avoid these pitfalls and explore regions of the search space that would be left unexplored by other local search procedures, tabu search carefully explores the neighborhood of each solution as the search progresses. The solutions admitted to the new neighborhood, N (x), are determined through the use of memory structures. Using these memory structures, the search progresses by iteratively moving from the current solution x to an improved solution x' in N (x).

These memory structures form what is known as the tabu list, a set of rules and banned solutions used to filter which solutions will be admitted to the neighborhood N (x) to be explored by the search. In its simplest form, a tabu list is a short-term set of the solutions that have been visited in the recent past (less than n iterations ago, where n is the number of previous solutions to be stored - is also called the tabu tenure). More commonly, a tabu list consists of solutions that have changed by the process of moving from one solution to another. It is convenient, for ease of description, to understand a solution to be coded and represented by such attributes.

The memory structures used in tabu search can roughly be divided into three categories:[6]
Short-term: The list of solutions recently considered. If a potential solution appears on the tabu list, it cannot be revisited until it reaches an expiration point.
Intermediate-term: Intensification rules intended to bias the search towards promising areas of the search space.
 Long-term: Diversification rules that drive the search into new regions (i.e. regarding resets when the search becomes stuck in a plateau or a suboptimal dead-end).
\end{document}

PS: despite i've set italian language, the algorithm's title still remain "Algorithm 1" (in english). There is a way to override this text and set "Algoritmo 1"?

1

1 Answer 1

1

In twocolumn-mode each column is treated as a page of its own. The algorithm in this case is placed on a float page, and we have to follow what is said in How to place a float at the top of a floats-only page?

To rename the name of algorithms, we can use the optional argument when loading the package, thanks egreg.

Here the complete example.

\documentclass[a4paper, twocolumn, 10pt]{article}
\usepackage[Algorithmo]{algorithm}
\usepackage{algpseudocode}
\usepackage[italian]{babel}

\makeatletter
\setlength{\@fptop}{0pt}
\setlength{\@fpbot}{0pt plus 1fil}
\makeatother

\begin{document}
\begin{algorithm}[tbph]
    \caption{Optimization with Tabu Search of the }\label{alg1}
    \begin{algorithmic}[1]
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm
        \State row of algorithm

    \end{algorithmic}
\end{algorithm}

Tabu search, created by Fred W. Glover in 1986[1] and formalized in 1989,[2][3] is a metaheuristic search method employing local search methods used for mathematical optimization.

Local (neighborhood) searches take a potential solution to a problem and check its immediate neighbors (that is, solutions that are similar except for one or two minor details) in the hope of finding an improved solution\footnote{this is a footnote, it can be userful and i have it on this point and it have two rows}. Local search methods have a tendency to become stuck in suboptimal regions or on plateaus where many solutions are equally fit.

Tabu search enhances the performance of local search by relaxing its basic rule. First, at each step worsening moves can be accepted if no improving move is available (like when the search is stuck at a strict local mimimum). In addition, prohibitions (henceforth the term tabu) are introduced to discourage the search from coming back to previously-visited solutions.

The implementation of tabu search uses memory structures that describe the visited solutions or user-provided sets of rules.[2] If a potential solution has been previously visited within a certain short-term period or if it has violated a rule, it is marked as "tabu" (forbidden) so that the algorithm does not consider that possibility repeatedly.

Tabu search uses a local or neighborhood search procedure to iteratively move from one potential solution x to an improved solution x' in the neighborhood of x, until some stopping criterion has been satisfied (generally, an attempt limit or a score threshold). Local search procedures often become stuck in poor-scoring areas or areas where scores plateau. In order to avoid these pitfalls and explore regions of the search space that would be left unexplored by other local search procedures, tabu search carefully explores the neighborhood of each solution as the search progresses. The solutions admitted to the new neighborhood, N (x), are determined through the use of memory structures. Using these memory structures, the search progresses by iteratively moving from the current solution x to an improved solution x' in N (x).

These memory structures form what is known as the tabu list, a set of rules and banned solutions used to filter which solutions will be admitted to the neighborhood N (x) to be explored by the search. In its simplest form, a tabu list is a short-term set of the solutions that have been visited in the recent past (less than n iterations ago, where n is the number of previous solutions to be stored - is also called the tabu tenure). More commonly, a tabu list consists of solutions that have changed by the process of moving from one solution to another. It is convenient, for ease of description, to understand a solution to be coded and represented by such attributes.

The memory structures used in tabu search can roughly be divided into three categories:[6]
Short-term: The list of solutions recently considered. If a potential solution appears on the tabu list, it cannot be revisited until it reaches an expiration point.
Intermediate-term: Intensification rules intended to bias the search towards promising areas of the search space.
 Long-term: Diversification rules that drive the search into new regions (i.e. regarding resets when the search becomes stuck in a plateau or a suboptimal dead-end).
 \end{document}
6
  • The name can be set as an option to algorithm: \usepackage[Algoritmo]{algorithm}
    – egreg
    Commented Jun 20, 2015 at 11:21
  • @egreg Ah, i keep forgetting this. Thanks :-)
    – Johannes_B
    Commented Jun 20, 2015 at 11:39
  • thank you so much, both of you. Working perfect. but after the algorithm the text from the next column won't climb and there is a large blank space after the algorithm. any idea to solve this? (\vspace not working) Commented Jun 20, 2015 at 12:22
  • 1
    The algorithm is placed on its own page right now, there will not be any text. You can use [tbh] to prevent this, but the output will differ significantly.
    – Johannes_B
    Commented Jun 20, 2015 at 12:29
  • ok, I think that this space can be tollerated. thanks again! Commented Jun 20, 2015 at 12:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .