Bhartendu Awasthi
Bhartendu Awasthi

Reputation: 1029

Use more than 1 core when solving with mathopt (or tools) - HiGHS solver

I am interested in leveraging more number of physical cores when solving a MIP problem with mathopt.

Parallelization was easy with CP-SAT by setting the number of search workers

solver.parameters.num_workers = 8 # use 8 cores

I struggling to find the right parameter to enable the solver to use more than 1 core to solve with mathopt. I am using HiGHS solver with mathopt (like below snippet)

params = mathopt.SolveParameters(enable_output=True)
result = mathopt.solve(model, mathopt.SolverType.HIGHS, params=params)

-- EDIT --

params = mathopt.SolveParameters(enable_output=True, threads=8)

I get below error:

    proto_result = solver.solve(

RuntimeError: INVALID_ARGUMENT: threads not supported for HiGHS solver, this must be set using globals, see HiGHS documentation

tried below:

params = mathopt.SolveParameters(enable_output=True, highs={"threads": 8})
result = mathopt.solve(model, mathopt.SolverType.HIGHS, params=params)

    result = math_opt_parameters_pb2.SolveParametersProto(

ValueError: Protocol message HighsOptionsProto has no "threads" field.

Can anybody please help ?

Upvotes: 1

Views: 214

Answers (2)

Ross Anderson
Ross Anderson

Reputation: 81

You can export to MPS as seen here:

https://github.com/google/or-tools/blob/stable/ortools/math_opt/io/python/mps_converter_test.py

For some further context, see this recent conversation on the or-tools google group:

https://groups.google.com/g/or-tools-discuss/c/x_gvQQzpisk/m/eOB8v8Q6AQAJ

AFAIK, HiGHS is only multithreaded for LP, not for MIP, so this may not do what you want (better to check with HiGHS team).

Upvotes: 1

Laurent Perron
Laurent Perron

Reputation: 11014

We have memory issues with highs in parallel. This is currently disabled.

Upvotes: 1

Related Questions