% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/GRCFE.R
\name{generate_2fi_rowcol}
\alias{generate_2fi_rowcol}
\title{Generate a row-column design for main effects and two-factor interactions}
\usage{
generate_2fi_rowcol(
  s,
  p,
  q,
  n,
  mode = c("auto", "theorem", "search"),
  max_iter_nonprime = 5000,
  n_starts_nonprime = 5,
  verbose_nonprime = FALSE,
  max_tries_search = 5000,
  N_max_runs_search = 10000,
  verbose_search = FALSE
)
}
\arguments{
\item{s}{Integer. Number of levels for each treatment factor. Must be at
least 2.}

\item{p}{Integer. Number of row blocking factors.}

\item{q}{Integer. Number of column blocking factors.}

\item{n}{Integer. Number of treatment factors. Must satisfy \code{p + q <= n}.}

\item{mode}{Character. One of \code{"auto"}, \code{"theorem"}, or
\code{"search"}. \code{"auto"} uses theorem/heuristic construction for
\code{k = 0,1} and search for prime-level \code{k = 2,3} cases.}

\item{max_iter_nonprime}{Integer. Maximum heuristic iterations per start for
composite-level or unsupported theorem cases.}

\item{n_starts_nonprime}{Integer. Number of random heuristic starts.}

\item{verbose_nonprime}{Logical. If \code{TRUE}, reports heuristic progress
using \code{message()}. The default is \code{FALSE}.}

\item{max_tries_search}{Integer. Maximum random generator matrices to try in
search mode.}

\item{N_max_runs_search}{Integer. Maximum allowed number of runs for search.}

\item{verbose_search}{Logical. If \code{TRUE}, reports improvements found by
the search routine using \code{message()}. The default is \code{FALSE} so
the function is quiet in normal package use and during examples/tests.}
}
\value{
A list containing the generated design and associated construction
information. The \code{design} component is a data frame with columns
\code{Row}, \code{Col}, and treatment factors \code{F1}, \code{F2}, ...,
\code{Fn}.
}
\description{
Main user-facing wrapper for generating row-column factorial layouts. The
function automatically chooses between theorem-based constructions,
heuristic D-optimal search, and random generator-matrix search depending on
\code{s}, \code{p}, \code{q}, \code{n}, and \code{mode}.
}
\details{
Let \code{k = n - (p + q)}. For non-prime \code{s}, this wrapper currently
supports \code{k} in \code{0:3} through the heuristic path. For prime \code{s},
theorem mode is available for \code{k = 0} or \code{k = 1}; search mode is
intended for \code{k = 2} or \code{k = 3}.
}
\examples{
# A small theorem-based row-column layout using the auto wrapper
res <- generate_2fi_rowcol(s = 3, p = 1, q = 1, n = 2, mode = "auto")
dim(res$design)
head(res$design)
stopifnot(is.data.frame(res$design))

}
\seealso{
\code{\link{generate_2fi_optimal_rowcol}},
\code{\link{search_2fi_optimal_G_k23}}, \code{\link{eval_2fi_from_design}}
}
