Overview
Constraint Satisfaction Problem (CSP) solvers form the mathematical foundation of Pricing Intelligence. By modeling pricing configurations as constraint problems, the system can:- Validate pricing models for logical consistency
- Enumerate all valid subscription configurations
- Optimize plan selection based on objectives (minimize cost, maximize features)
- Filter configurations by user requirements
What is a CSP?
A Constraint Satisfaction Problem consists of:Variables
Decision points (e.g., “Which plan?”, “Which add-ons?”)
Domains
Possible values for each variable (e.g., plans = )
Constraints
Rules that valid solutions must satisfy
Pricing as a CSP
In Pricing Intelligence, a subscription configuration is modeled as:Solver Architecture
Pricing Intelligence uses a two-tier solver architecture:Solver Backends
- MiniZinc: General-purpose CSP modeling language (default)
- Choco: Java-based constraint solver library
Analysis Operations
The Analysis API exposes four CSP-based operations:1. Validation
Checks if a pricing model is mathematically consistent. What is validated:Plan Coherence
Features and limits don’t contradict between plans
Add-On Compatibility
Add-ons reference valid plans and features
Feature Dependencies
Linked features and limits are consistent
Price Consistency
All prices are non-negative and well-defined
Configuration Space Size: The number of valid subscription combinations. A pricing model with 4 plans and 3 add-ons might have hundreds or thousands of valid configurations depending on constraints.
2. Subscriptions Enumeration
Enumerates all valid subscription configurations, optionally filtered.- “Show me all Buffer plans under $50 with hashtag management”
- “How many configurations include SSO?”
- “What are my options for 10-50 users?”
3. Optimal Configuration
Finds the best configuration according to an objective function. Objectives:minimize: Find the cheapest configuration satisfying filtersmaximize: Find the most expensive configuration (or maximum revenue potential)
- “What’s the cheapest way to get 50 users and SSO?”
- “Find the most expensive GitHub plan” (useful for revenue analysis)
- “Best value for my requirements”
4. Summary Statistics
Provides high-level structural insights about a pricing model.- “How many features does Buffer offer?”
- “What’s the price range for Salesforce plans?”
- “Does this pricing have annual payment options?”
The
summary operation does NOT use CSP solvers — it’s a simple structural analysis of the YAML. This makes it very fast but limited to catalog-level insights.Filter Semantics
Filters define constraints that solutions must satisfy:How Filters Become Constraints
Feature Constraints
Each feature in Where
features array becomes:effective_features is computed from plan defaults + plan overrides + add-on additions.Usage Limit Constraints
Each entry in Where
usageLimits becomes:effective_limits = plan limits + add-on extensions.Example: Filter Translation
Solver Comparison
Pricing Intelligence supports two solver backends:MiniZinc (Default)
MiniZinc
Language: High-level constraint modelingPros:
- Expressive modeling language
- Multiple backend solvers (Gecode, Chuffed, etc.)
- Widely used in research and industry
- Better optimization performance
- Requires external binary installation
- Slightly slower for simple enumeration
Choco
Choco
Language: Java libraryPros:
- Native Java integration
- Fast for enumeration
- No external dependencies
- Good for large configuration spaces
- Less expressive than MiniZinc
- Requires Java runtime
- Optimization can be slower
Implementation Details
YAML to Solver Translation
The Analysis API converts Pricing2Yaml to solver-specific formats:Generate Solver Model
For MiniZinc: Generate
.mzn model file and .dzn data fileFor Choco: Build Java constraint model programmaticallyExample: MiniZinc Model Excerpt
Asynchronous Job Processing
CSP solving can be time-consuming, so the Analysis API uses background jobs:Performance Considerations
Computational Complexity
CSP solving is NP-complete in the general case. Performance depends on:Configuration Space
More plans × more add-ons = exponentially more combinations
Constraint Complexity
Interdependent features/limits increase solving time
Filter Selectivity
Tighter constraints = smaller search space = faster solving
Solver Heuristics
MiniZinc and Choco use different search strategies
Optimization Tips
Prefer optimal over subscriptions
Finding one optimal solution is faster than enumerating all solutions
Timeout Configuration
The Analysis API enforces timeouts:TIMEOUT status.
Real-World Example
Let’s trace how a question becomes a CSP:Solver Execution
MiniZinc finds:
- AGENCY plan (10 channels built-in) = $120
- ESSENTIALS + 9 add-ons (1 + 9 = 10 channels) = 6 + 9*6 = $60
Next: MCP Protocol
Learn how Harvey communicates with the MCP server to invoke these CSP operations
Further Reading
Analysis API Reference
Full API documentation
MiniZinc Docs
MiniZinc constraint modeling language
Choco Solver
Choco constraint solver documentation
CSP Theory
Wikipedia: Constraint satisfaction problems