solve_linear_program_tool | Solve a linear programming problem using PuLP. This tool solves general linear programming problems where you want to
optimize a linear objective function subject to linear constraints.
Use cases:
- Resource allocation: Distribute limited resources optimally
- Diet planning: Create nutritionally balanced meal plans within budget
- Manufacturing mix: Determine optimal product mix to maximize profit
- Investment planning: Allocate capital across different investment options
- Supply chain optimization: Minimize transportation and storage costs
- Energy optimization: Optimize power generation and distribution
Args:
objective: Objective function with 'sense' ("minimize" or "maximize")
and 'coefficients' (dict mapping variable names to coefficients)
variables: Variable definitions mapping variable names to their properties
(type: "continuous"/"integer"/"binary", lower: bound, upper: bound)
constraints: List of constraints, each with 'expression' (coefficients),
'operator' ("<=", ">=", "=="), and 'rhs' (right-hand side value)
solver: Solver to use ("CBC", "GLPK", "GUROBI", "CPLEX")
time_limit_seconds: Maximum time to spend solving (optional)
Returns:
Optimization result with status, objective value, variable values, and solver info
Example:
# Maximize 3x + 2y subject to 2x + y <= 20, x + 3y <= 30, x,y >= 0
solve_linear_program(
objective={"sense": "maximize", "coefficients": {"x": 3, "y": 2}},
variables={
"x": {"type": "continuous", "lower": 0},
"y": {"type": "continuous", "lower": 0}
},
constraints=[
{"expression": {"x": 2, "y": 1}, "operator": "<=", "rhs": 20},
{"expression": {"x": 1, "y": 3}, "operator": "<=", "rhs": 30}
]
)
|
solve_integer_program_tool | 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}
]
)
|
solve_mixed_integer_program | Solve Mixed-Integer Programming (MIP) problems with integer, binary, and continuous variables. Args:
variables: List of variable definitions with bounds and types
constraints: List of constraint definitions with coefficients and bounds
objective: Objective function definition with coefficients and direction
solver_name: Solver to use ("SCIP", "CBC", "GUROBI", "CPLEX")
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with optimal variable values and objective
|
solve_assignment_problem_tool | Solve assignment problem using OR-Tools Hungarian algorithm.
Args:
workers: List of worker names
tasks: List of task names
costs: 2D cost matrix where costs[i][j] is cost of assigning worker i to task j
maximize: Whether to maximize instead of minimize (default: False)
max_tasks_per_worker: Maximum tasks per worker (optional)
min_tasks_per_worker: Minimum tasks per worker (optional)
Returns:
Dictionary with solution status, assignments, total cost, and execution time
|
solve_transportation_problem_tool | Solve transportation problem using OR-Tools.
Args:
suppliers: List of supplier dictionaries with 'name' and 'supply' keys
consumers: List of consumer dictionaries with 'name' and 'demand' keys
costs: 2D cost matrix where costs[i][j] is cost of shipping from supplier i to consumer j
Returns:
Dictionary with solution status, flows, total cost, and execution time
|
solve_knapsack_problem_tool | Solve knapsack optimization problems using OR-Tools. This tool solves knapsack problems where items need to be selected
to maximize value while staying within capacity constraints.
Use cases:
- Cargo loading: Optimize loading of trucks, ships, or planes by weight and volume
- Portfolio selection: Choose optimal set of investments within budget constraints
- Resource allocation: Select projects or activities with limited budget or resources
- Advertising planning: Choose optimal mix of advertising channels within budget
- Menu planning: Select dishes for a restaurant menu considering costs and popularity
- Inventory optimization: Decide which products to stock in limited warehouse space
Args:
items: List of items, each with 'name', 'value', 'weight', and optionally 'volume', 'quantity'
capacity: Weight capacity constraint
volume_capacity: Volume capacity constraint (optional)
knapsack_type: Type of knapsack problem ('0-1', 'bounded', 'unbounded')
max_items_per_type: Maximum items per type for bounded knapsack
Returns:
Knapsack result with total value and selected items
Example:
# Select items to maximize value within weight limit
solve_knapsack_problem(
items=[
{"name": "Item1", "value": 10, "weight": 5, "volume": 2},
{"name": "Item2", "value": 15, "weight": 8, "volume": 3},
{"name": "Item3", "value": 8, "weight": 3, "volume": 1}
],
capacity=10,
volume_capacity=5
)
|
solve_traveling_salesman_problem | Solve Traveling Salesman Problem (TSP) to find the shortest route visiting all locations. Args:
locations: List of location dictionaries with name and coordinates
distance_matrix: Optional pre-calculated distance matrix
start_location: Index of starting location (default: 0)
return_to_start: Whether to return to starting location (default: True)
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with route and total distance
|
solve_vehicle_routing_problem | Solve Vehicle Routing Problem (VRP) to optimize routes for multiple vehicles. Args:
locations: List of location dictionaries with name, coordinates, and demand
vehicles: List of vehicle dictionaries with capacity constraints
distance_matrix: Optional pre-calculated distance matrix
time_matrix: Optional pre-calculated time matrix
depot: Index of depot location (default: 0)
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with routes for all vehicles
|
solve_job_shop_scheduling | Solve Job Shop Scheduling Problem to optimize machine utilization and completion times. Args:
jobs: List of job dictionaries with tasks and constraints
machines: List of available machine names
horizon: Maximum time horizon for scheduling
objective: Optimization objective ("makespan" or "total_completion_time")
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with job schedule and machine assignments
|
solve_employee_shift_scheduling | Solve Employee Shift Scheduling to assign employees to shifts optimally. Args:
employees: List of employee names
shifts: List of shift dictionaries with time and requirements
days: Number of days to schedule
employee_constraints: Optional constraints and preferences per employee
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with employee schedules and coverage statistics
|
optimize_portfolio_tool | Optimize portfolio allocation to maximize return or minimize risk. Args:
assets: List of asset dictionaries with expected return, risk, and sector
objective: Optimization objective ("maximize_return", "minimize_risk", "maximize_sharpe", "risk_parity")
budget: Total budget to allocate (default: 1.0)
risk_tolerance: Maximum acceptable portfolio risk (optional)
sector_constraints: Maximum allocation per sector (optional)
min_allocation: Minimum allocation per asset (default: 0.0)
max_allocation: Maximum allocation per asset (default: 1.0)
solver_name: Solver to use ("CBC", "GLPK", "GUROBI", "CPLEX")
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with optimal portfolio allocation
|
optimize_production_plan_tool | Optimize multi-period production planning to maximize profit or minimize costs. Args:
products: List of product dictionaries with costs and resource requirements
resources: List of resource dictionaries with capacity constraints
periods: Number of planning periods
demand: List of demand requirements per product per period
objective: Optimization objective ("maximize_profit", "minimize_cost", "minimize_time")
inventory_costs: Optional inventory holding costs per product
setup_costs: Optional setup costs per product
solver_name: Solver to use ("CBC", "GLPK", "GUROBI", "CPLEX")
time_limit_seconds: Maximum solving time in seconds (default: 30.0)
Returns:
Optimization result with optimal production plan
|
validate_optimization_input | Validate input data for optimization problems. Args:
problem_type: Type of optimization problem
input_data: Input data to validate
Returns:
Validation result with errors, warnings, and suggestions
|