Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Highs with python-mip is slow

Open
#372 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
performance

Research direction

Start with the reproduction script in the issue and run it on Ubuntu with Python-MIP 1.16tc0, comparing Highs, CBC, and GRB variable-addition times. Trace the Highs path used by add_var and identify why adding 10,000 variables is much slower; done means the Highs timing is substantially improved without regressing the other solvers.

Written by the indexing model from the issue text.

Description

Hello, everyone

Firstly, thanks for the great package and also for adding support for Highs.

However, it seems that creating a optimization model with Highs is rather slow.

Describe the bug
Adding variables to a Highs optimization model is slow.

To Reproduce

import sys
import mip as pm
from timeit import default_timer as dt

def main(solver):
    m = pm.Model(solver_name=solver)
    ini = dt()
    x = {i: m.add_var() for i in range(10000)}
    print(f"{dt() - ini} seconds to add vars", flush=True)

if __name__ == '__main__':
    main(sys.argv[1])

Expected behavior
GRB: 0.021987227955833077 seconds to add vars
CBC: 0.026054809102788568 seconds to add vars
Highs: 6.408406416885555 seconds to add vars

Desktop (please complete the following information):

  • Operating System, version: Ubuntu 23.10
  • Python version: 3.11.6
  • Python-MIP version (we recommend you to test with the latest version): 1.16tc0

Thanks again!

Dominant language
Linear Programming
Stars
601
Forks
108
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from coin-or/python-mip

All issues in coin-or/python-mip

Similar issues

More Performance issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.