https://github.com/evya1/cvx-optimization-to-ml
Convex Optimization and Polynomial System Solver with Dockerized Symbolic Computation via msolve, Sagemath & C++
https://github.com/evya1/cvx-optimization-to-ml
convex convex-optimization cvx cvx-pipeline-framework cvxopt linear-algebra msolve pose-detection pose-estimation rigid-transformations
Last synced: 6 months ago
JSON representation
Convex Optimization and Polynomial System Solver with Dockerized Symbolic Computation via msolve, Sagemath & C++
- Host: GitHub
- URL: https://github.com/evya1/cvx-optimization-to-ml
- Owner: evya1
- Created: 2025-06-06T12:50:30.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-07-15T22:31:35.000Z (6 months ago)
- Last Synced: 2025-07-16T21:32:13.194Z (6 months ago)
- Topics: convex, convex-optimization, cvx, cvx-pipeline-framework, cvxopt, linear-algebra, msolve, pose-detection, pose-estimation, rigid-transformations
- Language: C++
- Homepage:
- Size: 42 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ง cvx-optimization-to-ml
**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`](https://msolve.lip6.fr/) 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.
---
## ๐ฆ Features
- ๐งฎ 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.
---
## ๐ Quick Start Guide
### โ
Requirements
Make sure the following tools are installed **on your host machine**:
- [Docker Desktop](https://www.docker.com/products/docker-desktop/)
- [Git](https://git-scm.com/)
- Optionally: `make` and `cmake` (if you want to build outside Docker)
---
### ๐ฅ Clone the Repository
```bash
git clone https://github.com/evya1/cvx-optimization-to-ml.git
cd cvx-optimization-to-ml
```
---
### ๐ณ Build and Run via Docker (Recommended)
#### 1. Build the Docker Image
```bash
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.
#### 2. Run the Main Program (Binary)
```bash
make docker-run
```
This runs `/cvx-optimization-to-ml` inside the container.
#### 3. Run msolve on an Example
```bash
make msolve-test-real-roots-sec4p1
make show-msolve-output-sec4p1
```
This will:
- Run `msolve` on `ms_test_inputs/real_roots_sec4p1.ms`
- Output the result to `ms_outputs/real_roots_sec4p1.out`
- Print the content to your terminal
---
## ๐ ๏ธ Developer Workflow (Local Build)
### 1. Build Locally
```bash
make build
```
### 2. Run the Program
```bash
make run
```
### 3. Run Tests (optional)
```bash
make test
```
> โ ๏ธ Currently a placeholder โ you'll need to implement test cases under `/tests`.
---
## ๐งช Directory Structure
```text
.
โโโ 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
```
---
## ๐ Technologies Used
- **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
---
## ๐ง Example Problem Solved
The provided `real_roots_sec4p1.ms` solves the following polynomial system:
```text
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.
---
## ๐ค Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change or add.
---
## ๐ Acknowledgments
- [msolve authors](https://msolve.lip6.fr/)
- [Eigen](https://eigen.tuxfamily.org/)
- [FLINT](http://flintlib.org/)