Savanty

Quickstart

Install Savanty, describe a problem in English, and get a guaranteed answer set. Three interfaces, one solver.

1. Install

Savanty needs Python 3.10+. Clingo ships with it.

pip install savanty
export OPENAI_API_KEY=sk-...       # or OLLAMA_API_KEY for Ollama Cloud

2. Solve from Python

from savanty import solve_optimization_problem

result = solve_optimization_problem("""
    Schedule 4 nurses (Alice, Bob, Carol, Dave) for morning/evening
    shifts over 5 days. Each shift needs 1 nurse. No nurse works two
    shifts on the same day. Max 4 shifts per person.
""")

print(result.solution)   # parsed assign/2 atoms
print(result.asp_code)    # the generated encoding, for inspection

If the problem is satisfiable, result.solution holds a consistent assignment. If it is not, Savanty reports faithful infeasibility (after the repair loop confirms the constraints, not the encoding, are the problem).

3. Or use the CLI and REST server

# CLI
savanty -p "Assign 5 tasks to 3 workers, balance the workload"

# REST server (FastAPI, OpenAPI docs at /docs)
savanty --web --port 8000
curl -X POST localhost:8000/solve -H 'content-type: application/json' \
  -d '{"problem": "Colour 4 regions with 3 colours, no two adjacent the same"}'

Optional extras: pip install savanty[desktop] installs a Slint GUI; the repo also ships a Vue.js frontend in frontend/.