dwavesystems / dimod

A shared API for QUBO/Ising samplers.
https://docs.ocean.dwavesys.com/en/stable/docs_dimod/
Apache License 2.0
121 stars 80 forks source link

Add from_mps_file function for building CQMs #1228

Open vgoliber opened 2 years ago

vgoliber commented 2 years ago

Application We have a function from_lp_file. Would be good to add one as from_mps_file, as some databases provide problems in this format. Users are currently using 3rd party tools to do this conversion, and some have bugs.

arcondello commented 2 years ago

Agree, we should have one.

arcondello commented 2 years ago

Do we have an official recommendation in the mean time? AFAIK python-mip works pretty well.

import dimod
import mip

model = mip.Model()
model.read('example.mps')
model.write('example.lp')

cqm = dimod.lp.load(open('example.lp', 'r'))

Though of course doing it directly with Ocean would be preferable.

vgoliber commented 2 years ago

I don't know which existing packages work well and which have bugs to be honest!

krobbinsgit commented 1 year ago

I have also been seeing requests for mps file readers from several customers and prospects.