Formulating Optimization Problems with OptiGen

A step-by-step walkthrough showing how to go from a plain-language idea to a fully specified optimisation model inside OptiGen.

Overview

OptiGen lets you describe an optimisation problem in natural language and then iteratively refine that problem using an AI assistant until you are ready to generate a solver.

This guide walks you through the three key stages of formulating a problem:

  1. Start a Conversation with the AI Agent - Simply describe your problem in plain language – no maths required.
  2. Collaborative Model Building & Refinement - The AI automatically builds your mathematical model, adding objectives and constraints while you provide feedback and request changes.
  3. Validate with Generated Examples - The AI can generate realistic test instances to verify the formulation works as intended.

Tip: The AI handles all the technical details. Your job is to communicate your business goals clearly and provide feedback on what the agent proposes.

1. Start a Conversation with the AI Agent

From the dashboard click “New Project” and you'll be taken directly to a chat interface. You can either describe a specific optimization problem you have in mind, or simply tell the AI about your industry or business - it will help identify optimization opportunities.

Specific Problem Example

“I need to optimize delivery routes for a food delivery service. We have multiple drivers, restaurants, and customer orders with different priorities and time windows.”

Industry/Business Description

“I run a manufacturing company that produces automotive parts. We have multiple production lines, varying demand, and supply chain constraints.”

💡 Don't Have a Specific Problem?

No problem! Simply describe your industry, business model, or operational challenges. The AI agent will help identify optimization opportunities you might not have considered - from inventory management and resource allocation to scheduling and cost reduction strategies.

The AI will immediately start asking clarifying questions and automatically generate a project title and description based on your input.

Chat Interface Preview

I have a transportation problem with warehouses and stores...

10:30 AM, Jan 15

I understand you have a transportation optimization problem. Let me help you formulate this. I've created a project titled “Warehouse-Store Transportation Optimization” and I'm adding some initial constraints...

2. Collaborative Model Building & Refinement

As you chat with the AI, it will automatically build your mathematical model by adding objectives, constraints, and data schemas based on your conversation. This is an interactive process where you provide feedback and the AI refines the formulation in real-time.

The AI Automatically Creates:

Objective Function

The AI identifies and formulates your optimization goal:

Minimize Total Delivery Cost
Minimize the total cost including transportation, fuel, and driver overtime costs
\min \sum_{i,j} (c_{ij} \cdot x_{ij} + f_i \cdot y_i + o_i \cdot t_i)

Constraints

The AI adds constraints based on your problem description:

Customer Demand Satisfaction
Each customer must be served by exactly one delivery route
\sum_{i} x_{ij} = 1 \quad \forall j \in \text{Customers}
Vehicle Capacity Constraint
Total demand on each route cannot exceed vehicle capacity
\sum_{j} d_j \cdot x_{ij} \leq Q_i \quad \forall i \in \text{Routes}
Time Window Compliance
Deliveries must occur within customer-specified time windows
e_j \leq t_{ij} \leq l_j \quad \forall i,j : x_{ij} = 1
Driver Working Hours
Each driver cannot work more than 8 hours per day
\sum_{j} s_{ij} \leq 8 \quad \forall i \in \text{Drivers}

How You Guide the Process:

Ask Questions
  • “Why did you add that capacity constraint?”
  • “What data will I need for this model?”
  • “Explain the mathematical formula”
Request Changes
  • “Remove the time window constraint”
  • “Make this a minimization problem”
  • “Add a driver working hours limit”
Provide Context
  • • Paste CSV data samples
  • • Describe edge cases
  • • Clarify business rules
Review & Validate
  • • Check the Model tab
  • • Review mathematical formulas
  • • Verify business logic

Data Schemas

The AI also automatically generates data schemas that define your API structure:

Input Schema (Auto-Generated)

The AI creates this schema to define what data your solver expects.

customersrequiredarray<object>

List of customer locations with demand

Example: [{"id":1,"location":{"lat":40.7128,"lng":-74.006},"demand":15,"time_window":{"earliest":"09:00","latest":"17:00"}}]
idinteger

Customer ID

locationobject
latnumber
lngnumber
demandnumber

Package demand in units

time_windowobject
earlieststring
lateststring
depotsrequiredarray<object>

Delivery depot locations

idinteger
locationobject
latnumber
lngnumber
capacitynumber

Total depot capacity

vehiclesrequiredarray<object>

Available delivery vehicles

idinteger
capacitynumber

Vehicle capacity in units

cost_per_kmnumber

Operating cost per kilometer

distance_matrixarray<array>

Distance matrix between all locations

Output Schema (Auto-Generated)

The AI defines the structure of optimization results returned by your solver.

routesarray<object>

Optimized delivery routes for each vehicle

vehicle_idinteger

ID of assigned vehicle

routearray<object>

Ordered sequence of customer visits

customer_idinteger
arrival_timestring
service_durationnumber

Minutes spent at customer

total_distancenumber

Total route distance in km

total_loadnumber

Total packages on this route

optimization_summaryobject
total_costnumber

Total delivery cost

total_distancenumber

Sum of all route distances

vehicles_usedinteger

Number of vehicles deployed

customers_servedinteger

Number of customers served

solution_timenumber

Solver runtime in seconds

unserved_customersarray<object>

Customers that could not be served (if any)

customer_idinteger
reasonstring

Why customer couldn't be served

💬 Real-Time Collaboration

The AI responds in plain English and automatically updates your project model. You can see all changes reflected immediately in the project tabs (Model, Data, Examples). The AI handles all the mathematical modeling – you focus on ensuring the business logic is correct.

3. Validate with Generated Examples

The AI can automatically generate realistic test instances for your problem. Simply ask:

“Create a small test case with 3 drivers and 10 orders”

or

“Generate an example that tests the capacity constraints”

The AI will create properly formatted JSON examples that match your data schema. You can review these in the Examples tab:

Example 1

A realistic delivery optimization scenario with 3 customers, 1 depot, and 2 vehicles. This example demonstrates time windows, vehicle capacity constraints, and geographic coordinates.

{
  "customers": [
    {
      "id": 1,
      "location": {"lat": 40.7589, "lng": -73.9851},
      "demand": 12,
      "time_window": {
        "earliest": "09:00",
        "latest": "12:00"
      }
    },
    {
      "id": 2,
      "location": {"lat": 40.7505, "lng": -73.9934},
      "demand": 8,
      "time_window": {
        "earliest": "10:00",
        "latest": "15:00"
      }
    },
    {
      "id": 3,
      "location": {"lat": 40.7614, "lng": -73.9776},
      "demand": 15,
      "time_window": {
        "earliest": "13:00",
        "latest": "17:00"
      }
    }
  ],
  "depots": [
    {
      "id": 0,
      "location": {"lat": 40.758, "lng": -73.9855},
      "capacity": 100
    }
  ],
  "vehicles": [
    {"id": 1, "capacity": 25, "cost_per_km": 0.5},
    {"id": 2, "capacity": 20, "cost_per_km": 0.45}
  ],
  "distance_matrix": [
    [0, 1.2, 1.8, 0.9],
    [1.2, 0, 1.1, 1.5],
    [1.8, 1.1, 0, 2],
    [0.9, 1.5, 2, 0]
  ]
}

🎉 Congratulations!

You have successfully formulated an optimisation problem with OptiGen. Continue to the Solver Generation section to learn how to turn this formulation into an executable, benchmark-ready solver.