% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_B.R
\name{.active_set_refine}
\alias{.active_set_refine}
\title{Partition-Wise Active-Set Refinement for Inequality Constraints}
\usage{
.active_set_refine(
  result,
  X,
  y,
  K,
  p_expansions,
  A,
  R_constraints,
  constraint_value_vectors,
  Lambda,
  Ghalf,
  GhalfInv,
  family,
  qp_Amat,
  qp_bvec,
  qp_meq,
  Xy_or_uncon,
  is_path3,
  parallel_aga,
  parallel_matmult,
  cl,
  chunk_size,
  num_chunks,
  rem_chunks,
  tol,
  max_as_iter = 50
)
}
\arguments{
\item{result}{List of current coefficient column vectors by partition.}

\item{X, y}{Lists of partition-specific design matrices and responses.}

\item{K, p_expansions}{Integer dimensions.}

\item{A}{Original equality constraint matrix.}

\item{R_constraints}{Number of columns of \code{A}.}

\item{constraint_value_vectors}{Constraint RHS list.}

\item{Lambda}{Shared penalty matrix.}

\item{Ghalf, GhalfInv}{Lists of \eqn{\mathbf{G}^{1/2}_k} and
\eqn{\mathbf{G}^{-1/2}_k} matrices.}

\item{family}{GLM family object.}

\item{qp_Amat}{Inequality constraint matrix.}

\item{qp_bvec}{Inequality constraint RHS.}

\item{qp_meq}{Number of equality constraints within \code{qp_Amat}
(leading columns).}

\item{Xy_or_uncon}{Cross-products (Path 2) or unconstrained estimates
(Path 3).}

\item{is_path3}{Logical.}

\item{parallel_aga, parallel_matmult}{Logical flags.}

\item{cl, chunk_size, num_chunks, rem_chunks}{Parallel parameters.}

\item{tol}{Convergence tolerance.}

\item{max_as_iter}{Maximum active-set iterations (default 50).}
}
\value{
A list with components:
\describe{
  \item{result}{List of refined coefficient column vectors by partition.}
  \item{qp_info}{List with active constraint information, or NULL.}
  \item{converged}{Logical; TRUE if active-set method converged.}
}
}
\description{
Replaces the dense \code{.qp_refine} SQP loop with a partition-wise
active-set method that reuses the existing Lagrangian projection
machinery. The key insight is that an active inequality constraint
can be treated as an additional equality constraint and absorbed into
the augmented constraint matrix \eqn{\mathbf{A}_{\mathrm{aug}}},
after which the standard \eqn{\mathbf{G}^{1/2}\mathbf{r}^*} trick
applies without ever forming the full \eqn{P \times P} information
matrix.
}
\details{
The active-set loop:
\enumerate{
  \item Solve the equality-constrained subproblem (Lagrangian projection)
    with current active set.
  \item Check primal feasibility: any violated inactive inequalities?
  \item Check dual feasibility: any negative multipliers on active
    inequalities?
  \item If both satisfied, return (KKT conditions met).
  \item Otherwise, add most-violated constraint or drop most-negative
    multiplier, and repeat.
}

Falls back to \code{.qp_refine} if the active-set method does not
converge within \code{max_as_iter} iterations.
}
\keyword{internal}
