% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/read.R
\name{read_cbf}
\alias{read_cbf}
\title{Read a CBF File into an ROI OP Object}
\usage{
read_cbf(file, ...)
}
\arguments{
\item{file}{Character string. Path to the \code{.cbf} (or \code{.CBF})
file.}

\item{...}{Currently unused; present for API compatibility with
\code{\link[ROI]{ROI_plugin_register_reader}}.}
}
\value{
An \code{\link[ROI]{OP}} object.
}
\description{
Parses a file in the Conic Benchmark Format (CBF version 4) and returns
an \code{\link[ROI]{OP}} object representing the encoded optimisation
problem.
}
\details{
Supported features
\itemize{
  \item Scalar variables (VAR) with all non-parametric cone types:
    \code{F.}, \code{L+.}, \code{L-.}, \code{L=.}.
  \item Scalar constraints (CON) with non-parametric cones:
    \code{F.}, \code{L+.}, \code{L-.}, \code{L=.}, \code{Q.}, \code{QR.},
    \code{EXP.}, \code{EXP*.}, \code{SVECPSD.}, \code{GMEANABS.},
    \code{GMEAN.}, and their duals.
  \item Parametric power cones (\code{@k:POW}, \code{@k:POW*}) via the
    POWCONES / POW*CONES lookup tables.
  \item Integer variables (INT section).
  \item Linear and constant-term objective coefficients
    (OBJACOORD, OBJBCOORD).
  \item PSD matrix variables (PSDVAR): each \eqn{X_j \in S^{m_j \times m_j}_+}
    is replaced by its symmetric vectorisation \eqn{\mathrm{svec}(X_j)} of
    length \eqn{m_j(m_j+1)/2}, appended as new scalar variables with a
    \code{K_psd(m_j)} cone constraint.  Objective terms (OBJFCOORD) and
    scalar-constraint terms (FCOORD) involving \eqn{X_j} are translated via
    the trace inner-product identity
    \eqn{\langle F, X_j \rangle = \mathrm{svec}(F)^{\top} \mathrm{svec}(X_j)}.
  \item PSD matrix constraints (PSDCON / HCOORD / DCOORD): each LMI
    \eqn{G_p = \sum_j x_j H_{pj} + D_p \in \mathrm{PSD}^{m_p}} is svec-ed
    into a \code{K_psd(m_p)} conic constraint on the scalar variables.
}

Features that generate a \code{warning()} and are skipped:
\itemize{
  \item Hotstart sequences (CHANGE keyword is treated as end-of-file).
}
}
\examples{
## round-trip: write a simple LP to a temp file then read it back
op <- ROI::OP(
    objective   = ROI::L_objective(c(1, 1)),
    constraints = ROI::L_constraint(
        L   = matrix(c(1, 1), nrow = 1),
        dir = ">=",
        rhs = 1
    )
)
f <- file.path(tempdir(), "lp.cbf")
write_cbf(op, f)
op2 <- read_cbf(f)

}
\seealso{
\code{\link{write_cbf}}
}
