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:
- Start a Conversation with the AI Agent - Simply describe your problem in plain language – no maths required.
- Collaborative Model Building & Refinement - The AI automatically builds your mathematical model, adding objectives and constraints while you provide feedback and request changes.
- 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.
“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.”
“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.
I have a transportation problem with warehouses and stores...
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:
Constraints
The AI adds constraints based on your problem description:
How You Guide the Process:
- • “Why did you add that capacity constraint?”
- • “What data will I need for this model?”
- • “Explain the mathematical formula”
- • “Remove the time window constraint”
- • “Make this a minimization problem”
- • “Add a driver working hours limit”
- • Paste CSV data samples
- • Describe edge cases
- • Clarify business rules
- • 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.
customers
requiredarray<object>List of customer locations with demand
[{"id":1,"location":{"lat":40.7128,"lng":-74.006},"demand":15,"time_window":{"earliest":"09:00","latest":"17:00"}}]
id
integerCustomer ID
location
objectlat
numberlng
numberdemand
numberPackage demand in units
time_window
objectearliest
stringlatest
stringdepots
requiredarray<object>Delivery depot locations
id
integerlocation
objectlat
numberlng
numbercapacity
numberTotal depot capacity
vehicles
requiredarray<object>Available delivery vehicles
id
integercapacity
numberVehicle capacity in units
cost_per_km
numberOperating cost per kilometer
distance_matrix
array<array>Distance matrix between all locations
Output Schema (Auto-Generated)
The AI defines the structure of optimization results returned by your solver.
routes
array<object>Optimized delivery routes for each vehicle
vehicle_id
integerID of assigned vehicle
route
array<object>Ordered sequence of customer visits
customer_id
integerarrival_time
stringservice_duration
numberMinutes spent at customer
total_distance
numberTotal route distance in km
total_load
numberTotal packages on this route
optimization_summary
objecttotal_cost
numberTotal delivery cost
total_distance
numberSum of all route distances
vehicles_used
integerNumber of vehicles deployed
customers_served
integerNumber of customers served
solution_time
numberSolver runtime in seconds
unserved_customers
array<object>Customers that could not be served (if any)
customer_id
integerreason
stringWhy 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”
“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:
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.