Skip to main content
Glama

solve_integer_program_tool

Solve integer and mixed-integer programming problems for discrete optimization decisions such as facility location, project selection, crew scheduling, network design, cutting stock, and capital budgeting.

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

TableJSON Schema
NameRequiredDescriptionDefault
objectiveYes
variablesYes
constraintsYes
solverNoCBC
time_limit_secondsNo
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully convey behavior. It does not mention side effects, read-only status, or resource usage. The description only notes the optimization method and return type, leaving behavioral traits unclear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a purpose statement, use cases, args, returns, and example. It is comprehensive but somewhat verbose; every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

All input parameters are explained, and an example is provided. However, there is no output schema, and the return description ('Optimization result with integer/binary variable values') lacks detail on fields like status or objective value.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but the description compensates fully with an 'Args' section explaining each parameter (e.g., objective has 'sense' and 'coefficients', variables have types). It adds meaning beyond the schema fields.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it solves integer/mixed-integer programming problems using PuLP, with explicit use cases like facility location and project selection. It distinguishes itself from sibling tools like solve_linear_program_tool by specifying the integer variable constraint.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear use cases and explains the tool's purpose for discrete decision problems. However, it lacks explicit guidance on when not to use it or alternatives for continuous optimization.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dmitryanchikov/mcp-optimizer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server