solve_integer_program_tool
Solve integer or mixed-integer programming problems for discrete decision-making in areas like facility location, project selection, crew scheduling, and capital budgeting using PuLP-based optimization.
Instructions
Solve an integer or mixed-integer programming problem using PuLP.
This tool solves optimization problems where some or all variables must
take integer values, which is useful for discrete decision problems.
Use cases:
- Facility location: Decide where to build warehouses or service centers
- Project selection: Choose which projects to fund (binary decisions)
- Crew scheduling: Assign integer numbers of staff to shifts
- Network design: Design networks with discrete components
- Cutting stock: Minimize waste when cutting materials
- Capital budgeting: Select investments when partial investments aren't allowed
Args:
objective: Objective function with 'sense' and 'coefficients'
variables: Variable definitions with types "continuous", "integer", or "binary"
constraints: List of linear constraints
solver: Solver to use ("CBC", "GLPK", "GUROBI", "CPLEX")
time_limit_seconds: Maximum time to spend solving (optional)
Returns:
Optimization result with integer/binary variable values
Example:
# Binary knapsack: select items to maximize value within weight limit
solve_integer_program(
objective={"sense": "maximize", "coefficients": {"item1": 10, "item2": 15}},
variables={
"item1": {"type": "binary"},
"item2": {"type": "binary"}
},
constraints=[
{"expression": {"item1": 5, "item2": 8}, "operator": "<=", "rhs": 10}
]
)
Input Schema
Name | Required | Description | Default |
---|---|---|---|
constraints | Yes | ||
objective | Yes | ||
solver | No | CBC | |
time_limit_seconds | No | ||
variables | Yes |
Input Schema (JSON Schema)
{
"properties": {
"constraints": {
"items": {
"additionalProperties": true,
"type": "object"
},
"title": "Constraints",
"type": "array"
},
"objective": {
"additionalProperties": true,
"title": "Objective",
"type": "object"
},
"solver": {
"default": "CBC",
"title": "Solver",
"type": "string"
},
"time_limit_seconds": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"title": "Time Limit Seconds"
},
"variables": {
"additionalProperties": {
"additionalProperties": true,
"type": "object"
},
"title": "Variables",
"type": "object"
}
},
"required": [
"objective",
"variables",
"constraints"
],
"type": "object"
}