System Architecture

Service mesh for monce-optimization.


┌─────────────────────────────────────────────────────────────────────┐
│                         Client (Python / Web)                        │
└───────────────────────────────┬─────────────────────────────────────┘
                                │
                    pip install monce-optimization
                                │
┌───────────────────────────────▼─────────────────────────────────────┐
│                    monce-optimization (local)                         │
│                                                                       │
│  ┌──────────┐    ┌─────────────────┐    ┌──────────────────┐        │
│  │ Encoders │───►│   Uniformizer   │───►│ DIMACS serialize  │        │
│  │ (7 types)│    │ (BCP + balance) │    │                    │        │
│  └──────────┘    └─────────────────┘    └────────┬───────────┘        │
│                         ~10ms local               │                   │
└───────────────────────────────────────────────────┼───────────────────┘
                                                    │ HTTPS POST
                                                    ▼
┌───────────────────────────────────────────────────────────────────────┐
│                    npdollars.aws.monce.ai                              │
│                                                                       │
│  ┌─────────────┐    ┌───────────────┐    ┌────────────────┐          │
│  │ DIMACS parse │───►│  SAT solver   │───►│ Assignment out │          │
│  │             │    │ (budget EC2)  │    │                │          │
│  └─────────────┘    └───────────────┘    └────────────────┘          │
│                                                                       │
│  Budget: 1-60s EC2 compute per call                                   │
│  Responds within budget + 3s                                          │
│  .ncnf taboo transfer between calls                                   │
└───────────────────────────────────────────────────────────────────────┘
                                │
                                ▼ SAT assignment
┌───────────────────────────────────────────────────────────────────────┐
│                    monce-optimization (local)                          │
│                                                                       │
│  ┌────────────────────┐    ┌──────────────────────┐                   │
│  │ Variable map decode │───►│ Domain-level answer  │                   │
│  │ (strip aux vars)   │    │ (grid, coloring, ..) │                   │
│  └────────────────────┘    └──────────────────────┘                   │
└───────────────────────────────────────────────────────────────────────┘
        

Service Mesh

ServiceURLRole
monce-optimizationmonce-optimization.aws.monce.aiPlayground + API (this site)
npdollarsnpdollars.aws.monce.aiSAT solver backend
uniform-3-satuniform-3-sat.aws.monce.aiResearch site + reduction API
polyaumaauma.aws.monce.aiContinuous optimization (sibling)

Deployment

# Terraform — EC2 t3.small, nginx, gunicorn, certbot
cd terraform/
terraform init
terraform apply -var="vpc_id=..." -var="subnet_id=..." -var="key_name=..." -var="hosted_zone_id=..."

# Deploy code
rsync -avz --exclude='.git' . ubuntu@IP:/opt/mopt/app/
ssh ubuntu@IP "cd /opt/mopt && venv/bin/pip install fastapi uvicorn gunicorn && sudo systemctl restart mopt"

# HTTPS
ssh ubuntu@IP "sudo certbot --nginx -d monce-optimization.aws.monce.ai --non-interactive --agree-tos -m admin@monce.ai"

Scaling

The compute is in npdollars, not here. This server only does:

A single t3.small handles hundreds of concurrent requests. The bottleneck is always npdollars budget.