Uber Polya

Uber Polya is an AI-powered math problem solver that translates real-world issues into verified solutions.

<div align="center">

uber-polya

Don't guess. Solve.

The first math problem-solver for AI coding assistants. Free, open-source, and works across 7+ platforms.

GitHub Stars GitHub Forks License: Apache 2.0 Python 3.10+ Version CI

Docs | Tutorial | Manifesto | Contributing

<!-- Add social links once created: [![Discord](https://img.shields.io/badge/Discord-Join-5865F2?style=flat&logo=discord&logoColor=white)](YOUR_DISCORD_LINK) [![X (Twitter)](https://img.shields.io/badge/Follow-000000?style=flat&logo=x&logoColor=white)](YOUR_X_LINK) [![LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-0A66C2?style=flat&logo=linkedin&logoColor=white)](YOUR_LINKEDIN_LINK) --> </div>

You describe what you're trying to figure out. uber-polya finds the mathematical structure hiding inside your problem, solves it with the right algorithm, checks the answer, and gives you the result: a schedule, a plan, a decision, a budget, a ranking, a proof -- whatever you need.

/uber-polya Schedule 12 nurses across 3 shifts so nobody works more than 5 days

uber-polya:
  1. Understands  -> "This is a constraint satisfaction problem"
  2. Models       -> ILP with 252 binary variables, 48 constraints
  3. Solves       -> Optimal schedule in 0.3 seconds
  4. Verifies     -> All constraints satisfied, optimality proven
  5. Delivers     -> A shift schedule you can use today

Describe your problem. Get a verified solution. Optionally, get a professional PDF report. That's it.


<details> <summary><strong>Why uber-polya?</strong></summary> <br>

Most real-world problems -- business or personal -- have a mathematical structure hiding inside them. Scheduling is graph coloring. Budgeting is linear programming. Pricing is optimization. Route planning is TSP. But finding that structure, picking the right algorithm, writing correct solver code, and verifying the answer takes expertise most people don't have.

uber-polya does all of that in one conversation. It implements George Polya's four-phase problem-solving cycle (How to Solve It, 1945) as an executable pipeline:

  1. Understand -- Socratic dialogue to extract what you really need
  2. Model -- Finds the mathematical structure, classifies the problem
  3. Solve -- Selects the right algorithm, writes verified solver code, runs it
  4. Interpret -- Translates the answer into actionable insight with visualizations

The pipeline is collaborative: uber-polya asks questions, you confirm understanding, and the solution is built together -- not dictated.

</details>

Quick Start

1. Install

git clone https://github.com/agtm1199/uber-polya.git
cd uber-polya
bash install.sh

The installer asks whether to install globally (~/.claude/skills/, available in all projects) or locally (./.claude/skills/, current project only).

2. Solve a problem

Open Claude Code and type:

/uber-polya I need to schedule 4 exams into time slots so no student has two exams at the same time.

3. Get a verified result

uber-polya handles the entire pipeline automatically. One command, one conversation, one verified result.

3b. Get a PDF report (optional)

When you invoke /uber-polya, you can choose from three output formats:

FormatWhat you get
Python (default)Solver script + console output + solution.json
LaTeX/PDFProfessional .pdf report with equations, tables, and branded styling
BothFull Python output AND compiled PDF report

PDF generation uses fpdf2 + matplotlib.mathtext -- pure Python, no system LaTeX installation required. The .tex source is always saved for optional higher-quality compilation with pdflatex.

# Install PDF report dependencies
pip install jinja2 fpdf2 matplotlib

Under the hood, /uber-polya orchestrates three internal skills (/uber-model, /uber-solve, /uber-interpret) that you can also use individually for finer control.


How It Works

/uber-polya (orchestrator)

/uber-model            /uber-solve             /uber-interpret
"What IS the           "What is the            "What does it
 problem?"              ANSWER?"                MEAN?"

 Real-world    -->     Formal Model    -->     Verified       -->    Actionable
 problem               (math)                 Solution              Insight

 Polya Phases          Polya Phase            Polya Phase
 1-2: Understand       3: Execute             4: Look Back
 & Plan

Each skill's output feeds the next. The pipeline is Socratic: uber-polya asks questions, you confirm understanding, and the solution is built collaboratively.


What Can uber-polya Solve?

Every problem in these tables has a mathematical structure. uber-polya finds it and solves it.

<details> <summary><strong>Business Problems</strong> (18 problem types)</summary> <br>
ProblemYou say...uber-polya finds...You get...
Shift scheduling"Schedule 12 nurses across 3 shifts"Constraint satisfaction / ILPA shift schedule (table)
Project selection"Pick the best 5 of 20 projects under budget"Knapsack optimizationRanked list + ROI analysis
Task assignment"Assign inspectors to regions, minimize travel"Bipartite matchingAssignment matrix
Route planning"Route 4 trucks across 30 delivery stops"Vehicle routing (TSP variant)Optimized routes + map
Pricing"Price this product to maximize revenue"Optimization with demand modelRecommended price + sensitivity
A/B testing"Is this test result statistically real?"Hypothesis testingYes/no + confidence + power analysis
Portfolio allocation"Allocate investments to minimize risk"Quadratic programmingEfficient frontier + allocation
Build vs. buy"Should we build or buy this component?"Decision tree / expected valueRecommendation + break-even
Sales forecasting"Forecast next quarter's revenue"Time series (SARIMA / Holt-Winters)Forecast + confidence intervals
Customer churn"Predict which customers will leave"Classification (Random Forest)Risk scores + key factors
Training impact"Did our training program boost sales?"Causal inference (DiD / propensity)Effect size + confidence interval
Call center staffing"How many agents for 95% SLA?"Queuing theory (M/M/c)Staffing table + cost analysis
Subscriber retention"When will customers cancel?"Survival analysis (Cox PH)Survival curves + risk factors
Inventory ordering"How much to order, when to reorder?"Inventory optimization (EOQ)Order quantity + reorder point
Container loading"Pack 50 shipments into fewest trucks"Bin packing (ILP)Packing plan + utilization
Vendor ranking"Rank vendors balancing cost, quality, speed"Multi-objective optimization (Pareto)Pareto frontier + trade-offs
Product configuration"Can we build this with all customer requirements?"SAT / constraint satisfactionValid configuration or proof of infeasibility
Demand patterns"Model customer arrival patterns for staffing"Stochastic processes (Markov / Poisson)Arrival model + peak hours
</details> <details> <summary><strong>Personal Problems</strong> (15 problem types)</summary> <br>
ProblemYou say...uber-polya finds...You get...
Meal planning"Plan meals for the week within budget"Linear programmingMeal plan + grocery list
Rent splitting"Split rent fairly among 3 roommates"Fair division / allocationDollar amounts per person
Study schedule"Schedule study sessions across 5 subjects"Graph coloring / schedulingWeekly study timetable
Apartment ranking"Pick the best apartment from these 10"Multi-criteria decision analysisRanked list + trade-offs
Expense splitting"Split trip expenses among friends"Fair allocationSplit table
Refinancing"Should I refinance my mortgage?"NPV / break-even analysisYes/no + savings timeline
Budget forecasting"Will I stay within budget this year?"Time series forecastingMonthly forecast + alerts
Garden fencing"Maximize garden area with 100 ft of fence"Calculus optimizationOptimal dimensions + layout
Room painting"How much paint for these oddly-shaped rooms?"Computational geometryQuantity + cost estimate
Solar payback"When does my solar panel investment pay off?"Root finding / break-evenPayback date + savings curve
Recipe scaling"Scale this recipe for 50 people"Linear algebra (systems of equations)Adjusted ingredient quantities
Raffle odds"What are my chances of winning this raffle?"Discrete probabilityProbability + expected value
Medication timing"When do drug levels peak and trough?"ODE modeling (pharmacokinetics)Dosing schedule + level chart
Moving logistics"Fit all furniture into fewest truck loads"Bin packingLoading plan + trips needed
House hunting"Balance commute, price, and schools across 15 houses"Multi-objective optimization (Pareto)Shortlist of non-dominated options
</details>

Worked Examples

36 fully worked examples with solver code, verification, and sample output.

<details> <summary><strong>Everyday Problems</strong> (11 examples)</summary> <br>
ExampleProblemAlgorithm
Shift SchedulingSchedule 8 nurses across 3 shifts over 7 daysILP (PuLP/CBC)
Budget OptimizationSelect projects to maximize ROI under budget0/1 Knapsack ILP
Fair RentSplit rent fairly among 3 roommatesHungarian + envy-free adjustment
Route PlanningShortest delivery route across 8 stopsHeld-Karp DP (exact TSP)
Project PrioritizationRank 8 features by weighted criteriaMCDA weighted scoring
Study ScheduleConflict-free study timetable for 6 subjectsGraph coloring (NetworkX)
Meal PlanningPlan 7 dinners minimizing cost, meeting nutrition targetsILP (PuLP/CBC)
Team AssignmentAssign 6 developers to 6 projectsHungarian algorithm (SciPy)
Break-Even AnalysisFind break-even quantity for product launchSymbolic algebra (SymPy)
Event SeatingSeat 12 wedding guests at 3 tables with constraintsILP (PuLP/CBC)
Mortgage ComparisonCompare 3 mortgage options with refinancing analysisNPV + amortization (numpy-financial)
</details> <details> <summary><strong>Technical Showcases</strong> (25 examples)</summary> <br>
ExampleDomainAlgorithm
Milking CowsInterval mergingSort + sweep, O(N log N)
Inspector AssignmentBipartite ILPPuLP/CBC solver
Portfolio OptimizationConvex QPcvxpy (Markowitz)
Tournament HamiltonianGraph proofInduction + Z3
A/B TestingStatistical inferencez-test + Bayesian + bootstrap
Cafe TipsStatistical inferencet-test + Mann-Whitney + bootstrap
Traffic FlowLinear algebraGaussian elimination (numpy)
Water TankCalculus optimizationSymbolic differentiation (SymPy)
Land SurveyComputational geometryShoelace + convex hull (shapely)
Nash EquilibriumGame theorySupport enumeration (nashpy)
Vendor SelectionDecision analysis (MCDA)AHP + TOPSIS (numpy)
Pareto OptimizationMulti-objective optimizationEpsilon-constraint + Pareto filter
Sales ForecastTime series analysisSARIMA + Holt-Winters (statsmodels)
Anomaly DetectionTime series analysisZ-score + PELT change point (ruptures)
Customer SurvivalSurvival analysisKaplan-Meier + Cox PH (lifelines)
Customer Churn ClassificationMachine learningRandom Forest + Gradient Boosting (scikit-learn)
Customer SegmentationMachine learningK-Means + DBSCAN + GMM (scikit-learn)
Feature ImportanceMachine learningPCA + Feature Selection + Model Comparison
Call Center QueuingQueuing theoryM/M/c + simpy DES verification
SIR Epidemic ModelNumerical ODEsSIR ODE + vaccination analysis (scipy)
Monte Carlo Project RiskSimulationMC risk simulation + convergence analysis
Root Finding & InterpolationNumerical methodsBisection + Newton + Brent + cubic spline
Causal InferenceCausal inferencePropensity matching + DiD + doubly robust
Inventory OptimizationOperations researchEOQ + newsvendor + safety stock
Bin PackingOperations researchFirst Fit Decreasing + ILP optimal
</details>

What's Under the Hood

<details> <summary><strong>The Knowledge Base</strong> -- 305 algorithms, 91 structures, 26 solver libraries</summary> <br>
CatalogEntries
Polya's Heuristics17 heuristics with Socratic questions
Structure Catalog91 structures across 24 mathematical domains
Problem ClassificationDecision tree + pattern table for rapid matching
Algorithm Catalogs305 algorithms (discrete math, continuous optimization, statistics, time series, stochastic processes, survival analysis, machine learning, simulation, queuing theory, ODEs, numerical methods, causal inference, extended OR, linear algebra, calculus, geometry, financial math, game theory, decision analysis, multi-objective optimization)
Solver Ecosystem26 Python libraries (NetworkX, PuLP, Z3, SymPy, SciPy, OR-Tools, cvxpy, statsmodels, PyMC, shapely, numpy-financial, nashpy, pymoo, prophet, arch, ruptures, lifelines, scikit-learn, xgboost, umap-learn, simpy, dowhy, and more)
Interpretation PatternsDomain-specific math-to-reality translation
Visualization Guide37 chart types with matplotlib templates
LaTeX/PDF TemplatesJinja2 templates + polya.sty branded style in templates/latex/
</details> <details> <summary><strong>PDF Report Generation</strong> -- Professional mathematical reports</summary> <br>

uber-polya can generate branded PDF reports from any solved problem. The report system uses:

  • Jinja2 templates in templates/latex/ with custom delimiters (\VAR{}, \BLOCK{})
  • polya.sty custom LaTeX style with branded environments and colors
  • fpdf2 for pure-Python PDF generation (no system LaTeX needed)
  • matplotlib.mathtext for rendering LaTeX math expressions as images

The data flows through three dataclasses in utils/latex_data.py:

DataclassPhaseContents
FormalModelPhase AUniverse, variables, constraints, objective, mapping
SolutionReportPhase BAnswer, algorithm, verification checks, solver code
InterpretationReportPhase CQuestion, answer, sensitivity, recommendations, figures

To generate a PDF report from an existing example:

python utils/render_example.py examples/team-assignment/
# Output: examples/team-assignment/report/report.pdf

All 36 worked examples ship with pre-generated reports in their report/ subdirectories.

</details> <details> <summary><strong>25 Domains Covered</strong></summary> <br>

Graph Theory, Combinatorics, Set Theory, Logic, Number Theory, Relations & Orders, Optimization, Discrete Probability, Continuous Optimization, Statistical Inference, Time Series Analysis, Stochastic Processes, Survival Analysis, Machine Learning, Simulation & ODEs, Numerical Methods, Causal Inference, Extended Operations Research, Linear Algebra, Calculus, Geometry & Trigonometry, Financial Mathematics, Game Theory, Decision Analysis, Multi-Objective Optimization.

</details> <details> <summary><strong>Expansion Roadmap</strong></summary> <br>
DomainStatusWhat It Adds
Discrete MathematicsShipped86 algorithms, 32 structures, 8 solver libraries
Continuous OptimizationShipped8 algorithms, 5 structures, cvxpy/scipy
Statistical InferenceShipped45 algorithms, 6 structures, 6 solver libraries
Linear AlgebraShipped12 algorithms, 4 structures, numpy.linalg/scipy.linalg
CalculusShipped10 algorithms, 3 structures, SymPy/scipy.integrate
Geometry & TrigonometryShipped10 algorithms, 4 structures, shapely/scipy.spatial
Financial MathematicsShipped8 algorithms, 1 structure, numpy-financial
Game TheoryShipped12 algorithms, 3 structures, nashpy
Decision AnalysisShipped10 algorithms, 3 structures, numpy/scipy
Multi-Objective OptimizationShipped8 algorithms, 3 structures, pymoo
Time Series AnalysisShipped15 algorithms, 3 structures, prophet/arch/ruptures
Stochastic ProcessesShipped5 algorithms, 3 structures, scipy
Survival AnalysisShipped5 algorithms (3 new + 2 existing), lifelines
Machine LearningShipped22 algorithms, 5 structures, scikit-learn/xgboost/umap-learn
Simulation & ODEsShipped23 algorithms (10 ODE + 13 simulation), 8 structures, simpy/scipy.integrate
Numerical MethodsShipped13 algorithms, 3 structures, scipy.optimize/interpolate/integrate
Causal InferenceShipped7 algorithms, 2 structures, dowhy/scikit-learn
Extended Operations ResearchShipped8 algorithms, 3 structures, PuLP/OR-Tools
Partial Differential EquationsPlannedHeat, wave, diffusion equations -- FEniCS, FiPy
Dynamical Systems & ChaosPlannedStability, attractors, bifurcation analysis
Spatial StatisticsPlannedGeostatistics, spatial autocorrelation -- geopandas, PySAL
Spherical Geometry / GeodesyPlannedGreat circle distance, geodesic calculations -- geopy
Option PricingPlannedBlack-Scholes, binomial lattice -- QuantLib
Risk ManagementPlannedVaR, CVaR, stress testing
Agent-Based ModelingPlannedAgent simulation, emergent behavior -- mesa
Fourier Analysis / Spectral MethodsPlannedFFT, spectral decomposition -- scipy.fft
Digital Signal ProcessingPlannedFiltering, convolution, spectral analysis -- scipy.signal
Information TheoryPlannedEntropy, mutual information, KL divergence -- scipy.stats
Classical ControlPlannedPID control, stability margins -- python-control
Modern ControlPlannedState-space, LQR, Kalman filtering -- python-control, filterpy
Population DynamicsPlannedLotka-Volterra, predator-prey models (extends Simulation & ODEs)
EpidemiologyPlannedSIR, SEIR, compartmental models (extends Simulation & ODEs)

Domains marked Shipped are fully integrated. Planned domains have clear implementation paths and are accepting contributions. New domains plug in as reference files without changing the core Polya workflow.

</details>

Cross-Platform Compatibility

uber-polya ships native instruction files for 7+ AI coding assistants. Each tool gets the full Polya methodology (Model -> Solve -> Interpret) through its native config format.

<p align="center"> <img src="https://img.shields.io/badge/Claude_Code-191919?style=for-the-badge&logo=anthropic&logoColor=white" alt="Claude Code" /> <img src="https://img.shields.io/badge/OpenAI_Codex-412991?style=for-the-badge&logo=openai&logoColor=white" alt="OpenAI Codex" /> <img src="https://img.shields.io/badge/GitHub_Copilot-000000?style=for-the-badge&logo=githubcopilot&logoColor=white" alt="GitHub Copilot" /> <img src="https://img.shields.io/badge/Cursor-000000?style=for-the-badge&logo=cursor&logoColor=white" alt="Cursor" /> <img src="https://img.shields.io/badge/Windsurf-5865F2?style=for-the-badge&logo=codeium&logoColor=white" alt="Windsurf" /> <img src="https://img.shields.io/badge/Amazon_Kiro-FF9900?style=for-the-badge&logo=amazon&logoColor=white" alt="Amazon Kiro" /> <img src="https://img.shields.io/badge/Qoder-1E90FF?style=for-the-badge&logo=alibabadotcom&logoColor=white" alt="Qoder" /> <img src="https://img.shields.io/badge/Antigravity-4285F4?style=for-the-badge&logo=google&logoColor=white" alt="Antigravity" /> </p> <details> <summary><strong>Platform config details</strong></summary> <br>
ToolConfig File(s)Format
Anthropic Claude CodeCLAUDE.md + skills/*/SKILL.mdSkills with YAML frontmatter
OpenAI CodexAGENTS.mdPlain markdown (cross-tool standard)
Copilot GitHub Copilot.github/copilot-instructions.md + AGENTS.mdMarkdown
Cursor Cursor.cursor/rules/uber-polya.mdc, solver-conventions.mdcMarkdown with glob targeting
Windsurf Windsurf.windsurf/rules/uber-polya.md, solver-conventions.mdMarkdown
Kiro Amazon Kiro.kiro/steering/uber-polya.md, solver-conventions.mdMarkdown with YAML frontmatter
Qoder Antigravity + othersAGENTS.mdCross-tool standard (60K+ repos)

The reference files (skills/*/references/) are pure markdown -- readable by any tool. The 36 worked examples use standard Python with no tool-specific dependencies.

</details>

Requirements

  • Claude Code (Anthropic's CLI) -- the runtime for skills
  • Python 3.10+ -- for running generated solver code
<details> <summary><strong>Optional Python packages</strong> (installed as needed)</summary> <br>
pip install networkx pulp z3-solver sympy scipy matplotlib numpy cvxpy statsmodels shapely numpy-financial nashpy pymoo prophet arch ruptures lifelines scikit-learn xgboost umap-learn simpy dowhy jinja2 fpdf2
</details>

Design Principles

  1. Socratic, not didactic. Asks questions that could have occurred to you. Never lectures.
  2. Verify everything. Every solution includes independent verification.
  3. Right tool for the job. Algorithm selection based on problem class and instance size.
  4. Audience adaptation. Results adapted for technical, decision-maker, or general audiences.
  5. Knowledge transfer. Every problem teaches a reusable modeling pattern.
  6. Modular expansion. New domains plug in without changing the core workflow.

Documentation

Contributing

Contributions welcome! Whether it's a new domain, algorithm, worked example, or bug fix -- see CONTRIBUTING.md for guidelines.

Please note that this project follows the Contributor Covenant Code of Conduct.

Citation

If you use uber-polya in your work, please cite it:

@software{uber_polya,
  title = {uber-polya: Universal Problem-Solving Engine},
  url = {https://github.com/agtm1199/uber-polya},
  license = {Apache-2.0},
  year = {2025}
}

Or in text:

uber-polya: Universal Problem-Solving Engine. https://github.com/agtm1199/uber-polya. Apache-2.0 License.

License

Apache 2.0 -- free to use, modify, and distribute.

Acknowledgments

George Polya, How to Solve It (1945). The heuristic framework, Socratic questioning methodology, and four-phase problem-solving cycle that underpin this project are adapted from his work.


<div align="center">

Star History

Star History Chart

</div>