Skip to main content
Glama

USolver

by sdiehl

solve_highs_problem

Solve linear or mixed-integer programming problems using HiGHs solver by defining variables, objectives, and constraints. Obtain solutions for optimization tasks with support for dense/sparse matrices and multiple algorithms.

Instructions

Solve a HiGHs linear/mixed-integer programming problem.

This tool takes a HiGHs optimization problem defined with variables, objective, and constraints, and returns a solution if one exists. HiGHs is a high-performance linear programming solver that supports: - Linear programming (LP) - Mixed-integer programming (MIP) - Both dense and sparse constraint matrices - Various solver algorithms (simplex, interior point, etc.) Example problem structure: { "problem": { "sense": "minimize", "objective": { "linear": [1.0, 2.0, 3.0] }, "variables": [ {"name": "x1", "lb": 0, "ub": 10, "type": "cont"}, {"name": "x2", "lb": 0, "ub": null, "type": "cont"}, {"name": "x3", "lb": 0, "ub": 1, "type": "bin"} ], "constraints": { "dense": [ [1, 1, 0], [0, 1, 1] ], "sense": ["<=", ">="], "rhs": [5, 3] } }, "options": { "time_limit": 60.0, "output_flag": false } } Args: problem: The HiGHs problem definition with variables, objective, and constraints Returns: A list of TextContent containing the solution or an error message

Input Schema

NameRequiredDescriptionDefault
problemYes

Input Schema (JSON Schema)

{ "$defs": { "HiGHSConstraintSense": { "description": "Constraint directions in HiGHs.", "enum": [ "<=", ">=", "=" ], "title": "HiGHSConstraintSense", "type": "string" }, "HiGHSConstraints": { "description": "Constraint specification for HiGHs.", "properties": { "dense": { "anyOf": [ { "items": { "items": { "type": "number" }, "type": "array" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "2D array where each row is a constraint", "title": "Dense" }, "rhs": { "description": "Right-hand side values", "items": { "type": "number" }, "title": "Rhs", "type": "array" }, "sense": { "description": "Constraint directions", "items": { "$ref": "#/$defs/HiGHSConstraintSense" }, "title": "Sense", "type": "array" }, "sparse": { "anyOf": [ { "$ref": "#/$defs/HiGHSSparseMatrix" }, { "type": "null" } ], "default": null, "description": "Sparse matrix representation" } }, "required": [ "sense", "rhs" ], "title": "HiGHSConstraints", "type": "object" }, "HiGHSObjective": { "description": "Objective function specification for HiGHs.", "properties": { "linear": { "description": "Coefficients for each variable", "items": { "type": "number" }, "title": "Linear", "type": "array" } }, "required": [ "linear" ], "title": "HiGHSObjective", "type": "object" }, "HiGHSOptions": { "description": "Options for HiGHs solver.", "properties": { "dual_feasibility_tolerance": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Default: 1e-7", "title": "Dual Feasibility Tolerance" }, "highs_debug_level": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "0-4: debug verbosity", "title": "Highs Debug Level" }, "infinite_bound": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Default: 1e20", "title": "Infinite Bound" }, "infinite_cost": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Default: 1e20", "title": "Infinite Cost" }, "ipm_iteration_limit": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "IPM max iterations", "title": "Ipm Iteration Limit" }, "ipm_optimality_tolerance": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Default: 1e-8", "title": "Ipm Optimality Tolerance" }, "log_to_console": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Console logging", "title": "Log To Console" }, "mip_abs_gap": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Absolute gap tolerance", "title": "Mip Abs Gap" }, "mip_detect_symmetry": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Detect symmetry", "title": "Mip Detect Symmetry" }, "mip_feasibility_tolerance": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "MIP feasibility tolerance", "title": "Mip Feasibility Tolerance" }, "mip_max_nodes": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Max branch-and-bound nodes", "title": "Mip Max Nodes" }, "mip_rel_gap": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Relative gap tolerance", "title": "Mip Rel Gap" }, "output_flag": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Enable solver output", "title": "Output Flag" }, "parallel": { "anyOf": [ { "$ref": "#/$defs/HiGHSParallel" }, { "type": "null" } ], "default": null, "description": "Parallel option" }, "pdlp_iteration_limit": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "PDLP max iterations", "title": "Pdlp Iteration Limit" }, "pdlp_scaling": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "PDLP scaling", "title": "Pdlp Scaling" }, "presolve": { "anyOf": [ { "$ref": "#/$defs/HiGHSPresolve" }, { "type": "null" } ], "default": null, "description": "Presolve option" }, "primal_feasibility_tolerance": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Default: 1e-7", "title": "Primal Feasibility Tolerance" }, "random_seed": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Random seed for reproducibility", "title": "Random Seed" }, "simplex_dual_edge_weight_strategy": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "-1 to 2: pricing", "title": "Simplex Dual Edge Weight Strategy" }, "simplex_iteration_limit": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Max iterations", "title": "Simplex Iteration Limit" }, "simplex_scale_strategy": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "0-5: scaling strategy", "title": "Simplex Scale Strategy" }, "simplex_strategy": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "0-4: algorithm strategy", "title": "Simplex Strategy" }, "solution_file": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Solution file path", "title": "Solution File" }, "solver": { "anyOf": [ { "$ref": "#/$defs/HiGHSSolver" }, { "type": "null" } ], "default": null, "description": "Solver algorithm" }, "threads": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Number of threads (0=automatic)", "title": "Threads" }, "time_limit": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Time limit in seconds", "title": "Time Limit" }, "write_solution_style": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Solution format style", "title": "Write Solution Style" }, "write_solution_to_file": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Write solution to file", "title": "Write Solution To File" } }, "title": "HiGHSOptions", "type": "object" }, "HiGHSParallel": { "description": "Parallel options for HiGHs.", "enum": [ "off", "choose", "on" ], "title": "HiGHSParallel", "type": "string" }, "HiGHSPresolve": { "description": "Presolve options for HiGHs.", "enum": [ "off", "choose", "on" ], "title": "HiGHSPresolve", "type": "string" }, "HiGHSProblem": { "description": "Complete HiGHS optimization problem.", "properties": { "options": { "anyOf": [ { "$ref": "#/$defs/HiGHSOptions" }, { "type": "null" } ], "default": null, "description": "Solver options" }, "problem": { "$ref": "#/$defs/HiGHSProblemSpec", "description": "Problem specification" } }, "required": [ "problem" ], "title": "HiGHSProblem", "type": "object" }, "HiGHSProblemSpec": { "description": "Problem specification for HiGHs.", "properties": { "constraints": { "$ref": "#/$defs/HiGHSConstraints", "description": "Constraint specifications" }, "objective": { "$ref": "#/$defs/HiGHSObjective", "description": "Objective function" }, "sense": { "$ref": "#/$defs/HiGHSSense", "description": "Optimization sense" }, "variables": { "description": "Variable specifications", "items": { "$ref": "#/$defs/HiGHSVariable" }, "title": "Variables", "type": "array" } }, "required": [ "sense", "objective", "variables", "constraints" ], "title": "HiGHSProblemSpec", "type": "object" }, "HiGHSSense": { "description": "Optimization sense for HiGHs problems.", "enum": [ "minimize", "maximize" ], "title": "HiGHSSense", "type": "string" }, "HiGHSSolver": { "description": "Solver options for HiGHs.", "enum": [ "simplex", "choose", "ipm", "pdlp" ], "title": "HiGHSSolver", "type": "string" }, "HiGHSSparseMatrix": { "description": "Sparse matrix representation for constraints.", "properties": { "cols": { "description": "Column indices of non-zero coefficients (0-indexed)", "items": { "type": "integer" }, "title": "Cols", "type": "array" }, "rows": { "description": "Row indices of non-zero coefficients (0-indexed)", "items": { "type": "integer" }, "title": "Rows", "type": "array" }, "shape": { "description": "[num_constraints, num_variables]", "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "title": "Shape", "type": "array" }, "values": { "description": "Non-zero coefficient values", "items": { "type": "number" }, "title": "Values", "type": "array" } }, "required": [ "rows", "cols", "values", "shape" ], "title": "HiGHSSparseMatrix", "type": "object" }, "HiGHSVariable": { "description": "Variable specification for HiGHs.", "properties": { "lb": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Lower bound (optional, defaults to 0)", "title": "Lb" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Variable name (optional, defaults to x1, x2, etc.)", "title": "Name" }, "type": { "anyOf": [ { "$ref": "#/$defs/HiGHSVariableType" }, { "type": "null" } ], "default": null, "description": "Variable type (optional, defaults to 'cont')" }, "ub": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Upper bound (optional, defaults to +∞, except binary gets 1)", "title": "Ub" } }, "title": "HiGHSVariable", "type": "object" }, "HiGHSVariableType": { "description": "Variable types in HiGHs.", "enum": [ "cont", "int", "bin" ], "title": "HiGHSVariableType", "type": "string" } }, "properties": { "problem": { "$ref": "#/$defs/HiGHSProblem" } }, "required": [ "problem" ], "title": "solve_highs_problem_toolArguments", "type": "object" }

You must be authenticated.

Other Tools from USolver

Related Tools

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/sdiehl/usolver'

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