C++ Convex Optimization and Polynomial System Solver with Dockerized Symbolic Computation via msolve
This project is a modular C++ pipeline designed for convex optimization and algebraic computation, integrating symbolic solvers like msolve
to compute real roots of polynomial systems within Docker. It uses Eigen for linear algebra operations and supports clean reproducible builds via CMake and Make.
- 🧮 Symbolic solution of multivariate polynomial systems via msolve (Docker-integrated).
- 🌀 Modular structure with Eigen-powered vector/matrix manipulation.
- 🐳 Full Docker environment for reproducible builds and isolated math toolchain (FLINT, GMP, MPFR).
- 🛠️ Developer-friendly
Makefile
with helper targets for running, testing, and Docker workflows.
Make sure the following tools are installed on your host machine:
- Docker Desktop
- Git
- Optionally:
make
andcmake
(if you want to build outside Docker)
git clone https://github.com/evya1/cvx-optimization-to-ml.git
cd cvx-optimization-to-ml
make docker
This builds a two-stage image:
- Stage 1 compiles FLINT and msolve from source.
- Stage 2 produces a minimal runtime image with your binary and tools installed.
make docker-run
This runs /cvx-optimization-to-ml
inside the container.
make msolve-test-real-roots-sec4p1
make show-msolve-output-sec4p1
This will:
- Run
msolve
onms_test_inputs/real_roots_sec4p1.ms
- Output the result to
ms_outputs/real_roots_sec4p1.out
- Print the content to your terminal
make build
make run
make test
⚠️ Currently a placeholder – you'll need to implement test cases under/tests
.
.
├── CMakeLists.txt # CMake project definition
├── Dockerfile # Multi-stage Dockerfile
├── Makefile # All build + docker logic
├── include/ # Header files (rotate.hpp)
├── src/ # Main source code
│ ├── main.cpp
│ └── rotate.cpp
├── ms\_test\_inputs/ # Sample .ms file for msolve
│ └── real\_roots\_sec4p1.ms
├── ms\_outputs/ # Output of msolve runs
│ └── real\_roots\_sec4p1.out
├── build/ (or cmake-build-debug/) # Local CMake build artifacts
└── tests/ # (Placeholder) test files
- C++17, Eigen – Linear Algebra
- FLINT, GMP, MPFR – Number theory / multiprecision
- msolve – Real root solver (symbolic polynomial systems)
- CMake – Build configuration
- Docker – Isolated build + runtime
- Makefile – Workflow automation
The provided real_roots_sec4p1.ms
solves the following polynomial system:
x + 2y + 2z = 1
x^2 + 2y^2 + 2z^2 = x
2xy + 2yz = y
Run make msolve-test-real-roots-sec4p1
to compute its real solutions.
Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change or add.