🔧 Solver API

🧠 What is the Solver API?

In today’s complex and ever-changing world, making decisions is rarely straightforward. Often, the best solution is not perfect but requires careful balancing of various factors and compromises. This is where the Solver API comes into play, enabling you to score and find the optimal option from a myriad of possibilities while considering a wide range of requirements.

The Solver API is a flexible, intelligent decision engine that helps you identify the best option based on your goals and constraints. Whether you’re selecting a product, allocating a budget, or planning a task schedule, Solver finds the optimal solution for you — fast.

🔍 How It Works

  1. Define Items: List the options (e.g., laptops, tasks, ETFs) with their attributes.
  2. Set Requirements: Assign weights or preferences to the attributes that matter.
  3. Get the Best Match: The Solver API returns the optimal option(s), with a clear reasoning trail.

The Core Principle: Descriptors

At the heart of the Solver API’s functionality are descriptors. Descriptors are used to describe the key attributes of items under consideration. They are simple, consisting of a name and a value. Here’s an example of what a descriptor looks like:

{
   "type": "item.color",
   "value": "Red"
}

Descriptors provide the necessary foundation for the Solver API to understand and evaluate items.

Defining the Problem: Requirements

To define the problem to solve, you need to specify the requirements of an optimal solution. A requirement is composed of several components:

  • Type: Aligns with how the possible options were described.
  • Data Type: Specifies the data type of the requirement.
  • Values: One or more desired or undesired values.
  • Scoring Logic: Allows fine control over how the requirement is compared to the possible option attribute. It includes:
    • Comparison Logic (e.g., Greater Than, Less Than, One Of, None Of).
    • Method (Reward or Penalize).
    • Weight (an arbitrary penalty if the requirement is not met).
    • Constraint Hardness (controls the hardness of the penalty, such as soft or hard).
    • Value Range (provides value boundaries for penalty calculation).

Here’s an example of a requirement:

{
    "type": "item.attribute.performance.zero-to-100-kmph-duration-in-s",
    "values": ["3"],
    "valueType": "float",
    "scoringLogic": {
        "comparisonLogic": "GreaterThan",
        "method": "Penalize",
        "weight": 28,
        "constraintHardness": "hard",
        "valueRange": {
            "minimumValue": "1",
            "maximumValue": "20"
        }
    }
}

These requirements help the Solver API understand the criteria for an ideal solution.

Solving Complex Problems

Once you’ve defined both the problem and the possible items, you can set the Solver API to work. It explores various items, evaluating them against the defined requirements. Given the potential complexity of the problem space, the Solver API employs efficient techniques to navigate it. Brute-forcing through the problem is not a viable option.

The Outcome: Scoring Information

After exploring different possibilities, the API returns the best item/solution for the given requirements along with its score. Additionally, it can provide a list of other considered items and their respective scores. The scoring information offers valuable insights into why a particular option was chosen.

Here’s an example of the scoring information returned:

"scoreExplanation": {
    "overallHardScore": -6,
    "overallSoftScore": 0,
    "overallScorePercentage": 0.84210527,
    "requirementsScorePercentage": 0.78571427,
    "budgetScorePercentage": 1.0,
    "brokenRequirements": [
        {
            "type": "item.attribute.performance.zero-to-100-kmph-duration-in-s",
            "scoringLogic": {
                "method": "Penalize",
                "comparisonLogic": "GreaterThan",
                "weight": 28,
                "constraintHardness": "hard",
                "weightRelativePercentage": 1.0,
                "valueRange": {
                    "minimumValue": 1.0,
                    "maximumValue": 20.0
                }
            },
            "values": ["3"],
            "valueType": "float"
        }
    ]
}

In this example, the item incurred a hard penalty of 6 points for not meeting a specific requirement. You can also see the impact in the calculation for the requirements and overall score for the item.

🚀 Key Use Cases

The Solver API’s versatility extends to various use cases:

  • Product Selection: Help users choose the best laptop, ETF, or insurance plan based on custom preferences and weighted criteria.
  • Work Planning:
    • Prioritize and select high-impact tasks within time or resource constraints.
    • Determining the next best action in a given situation.
    • Evaluating items for straight-through processing.
  • Resource Planning: Matching individuals to jobs based on skills and availability.
  • Budget Optimization: Allocate spending across competing priorities to maximize impact.
  • Risk Assessment: Conducting risk assessments by identifying indicators and issues.

Here’s an example where the Solver API was used to power a web site to allow consumer find the best cars based on their requirements:

An example of how the solver API is used in a real-world product

Sample Use Cases

Explore through the following blog posts how the Solver API was used to solve real world problems:

Navigating Grey Zones – Picking an ETF
Navigating Grey Zones – Consistently Picking the Right Tasks

🧑‍💻 Get Started Today

Try the Solver API with your data through RapidAPI. Integrate decision intelligence into your product in minutes.

View Documentation | Try in RapidAPI Playground