Quick Start Guide

When developing an optimization model, you may have solution values that you want to test to see if everything is correct. This tool helps you do this without writing code: it tests your solution for a given optimization model. A full solution is not required; it can test a solution for a subset of decision variables.

Python

import gurobipy as gp
import gurobi_modelanalyzer as gma

m = gp.read("examples/data/afiro.mps")

# Provide a solution
sol = {m.getVarByName("X01"): 78, m.getVarByName("X22"): 495}

# Instantiate
sc = gma.SolCheck(m)

# Check solution
sc.test_sol(sol)
print(f"Solution Status: {sc.Status}")

See Usage section for more details and the API Examples for some examples.

Command-Line

Provided a model file and a solution file (SOL format or JSON solution format) we can also use the gurobi_solcheck command-line tool:

gurobi_solcheck --model examples/data/afiro.mps --sol afiro.json

See Usage section for more details and the CLI Examples for some examples.