Repository navigation
PrimalSolver 0.1.0 — primal command line
PrimalSolver 0.1.0 — primal command line
A convex optimization solver written from scratch in portable C99 — LP, MILP,
QP, QCQP, SOCP, SDP, exponential and power cones, and mixed-integer conic
problems — with no dependencies beyond libc and libm.
This release ships the command-line front end primal: it reads a model
file, solves it and prints the solution.
Downloads
| platform | asset |
|---|---|
| macOS arm64 | primal-0.1.0-macos-arm64 |
| Linux x86_64 | primal-0.1.0-linux-x86_64 |
| Linux aarch64 | primal-0.1.0-linux-aarch64 |
| Windows x86_64 | primal-0.1.0-windows-x86_64.exe |
| Windows i686 | primal-0.1.0-windows-i686.exe |
The Linux and Windows builds are statically linked: the Linux ones carry no
glibc dependency, the Windows ones need only the UCRT (Windows 10+). macOS ships
the Apple-silicon build; on Intel macOS build from source (below).
All built from 787cd46 with -std=c99 -Wall -Wextra -pedantic -O2, zero
warnings. macOS may quarantine the downloaded file:
xattr -d com.apple.quarantine ./primal-0.1.0-macos-arm64
Usage
./primal-0.1.0-<platform> model.lp
The input file is the interface. Formats, detected automatically: CPLEX LP
(.lp), MPS (.mps), OPF (.opf), CBF (.cbf). The algorithm is chosen from
the model (LP, QP, SOCP, SDP, exponential/power, MIP), so one binary covers
every class. Options include --brief, --full (duals and slacks),
--solution-file FILE, --write FILE, --max-iter N,
--tol-pfeas/--tol-dfeas/--tol-gap V and --param NAME=VALUE; --help.
A worked input file with its expected output is in the README, and one
ready-to-run input per problem class is under examples/.
Build from source
make # builds out/primal
make test # 4910 checks, 0 failures
make run-samples
make run-examples
POSIX C99 with gcc or clang on Linux, macOS and the BSDs; on Windows use
MinGW-w64 (x86_64-w64-mingw32-gcc or i686-w64-mingw32-gcc) and link with
-pthread -static.
License
Apache-2.0.