Problem Types#
Quantum Launcher provides definitions and conversions to different models for a set of common combinatorial problems.
from quantum_launcher.problems import MaxCut,EC,QATM,JSSP,TSP, GraphColoring
import os
Max Cut#
mc = MaxCut.from_preset('default')
mc.visualize()

Exact Cover#
ec = EC.from_preset('toy')
ec.visualize()

Travelling Salesman#
tsp = TSP.from_preset('default')
tsp.visualize()

Graph Coloring#
gc = GraphColoring.from_preset('small')
gc.visualize()

Air Traffic Management#
filepath = os.path.abspath('./../../data/qatm/')
atm = QATM.from_file(filepath,'RCP_3.txt')
print("Collisions")
print(atm.instance['cm'])
print()
print("Aircraft manouvers")
print(atm.instance['aircrafts'])
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[6], line 2
1 filepath = os.path.abspath('./../../data/qatm/')
----> 2 atm = QATM.from_file(filepath,'RCP_3.txt')
4 print("Collisions")
5 print(atm.instance['cm'])
File ~/Desktop/work/quantum_launcher/.venv/lib/python3.11/site-packages/quantum_launcher/problems/problem_initialization/qatm.py:49, in QATM.from_file(cls, instance_path, instance_name)
45 cm_path = os.path.join(instance_path, 'CM_' + instance_name)
46 aircrafts_path = os.path.join(
47 instance_path, 'aircrafts_' + instance_name)
---> 49 instance = {'cm': np.loadtxt(cm_path), 'aircrafts': pd.read_csv(aircrafts_path, delimiter=' ', names=['manouver', 'aircraft'])}
50 return QATM('exact', instance, instance_name)
File ~/Desktop/work/quantum_launcher/.venv/lib/python3.11/site-packages/numpy/lib/npyio.py:1373, in loadtxt(fname, dtype, comments, delimiter, converters, skiprows, usecols, unpack, ndmin, encoding, max_rows, quotechar, like)
1370 if isinstance(delimiter, bytes):
1371 delimiter = delimiter.decode('latin1')
-> 1373 arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
1374 converters=converters, skiplines=skiprows, usecols=usecols,
1375 unpack=unpack, ndmin=ndmin, encoding=encoding,
1376 max_rows=max_rows, quote=quotechar)
1378 return arr
File ~/Desktop/work/quantum_launcher/.venv/lib/python3.11/site-packages/numpy/lib/npyio.py:992, in _read(fname, delimiter, comment, quote, imaginary_unit, usecols, skiplines, max_rows, converters, ndmin, unpack, dtype, encoding)
990 fname = os.fspath(fname)
991 if isinstance(fname, str):
--> 992 fh = np.lib._datasource.open(fname, 'rt', encoding=encoding)
993 if encoding is None:
994 encoding = getattr(fh, 'encoding', 'latin1')
File ~/Desktop/work/quantum_launcher/.venv/lib/python3.11/site-packages/numpy/lib/_datasource.py:193, in open(path, mode, destpath, encoding, newline)
156 """
157 Open `path` with `mode` and return the file object.
158
(...) 189
190 """
192 ds = DataSource(destpath)
--> 193 return ds.open(path, mode, encoding=encoding, newline=newline)
File ~/Desktop/work/quantum_launcher/.venv/lib/python3.11/site-packages/numpy/lib/_datasource.py:533, in DataSource.open(self, path, mode, encoding, newline)
530 return _file_openers[ext](found, mode=mode,
531 encoding=encoding, newline=newline)
532 else:
--> 533 raise FileNotFoundError(f"{path} not found.")
FileNotFoundError: /home/j-millet/Desktop/work/data/qatm/CM_RCP_3.txt not found.
Job Shop Scheduling#
jssp = JSSP.from_preset('toy',onehot="quadratic")
jssp.instance
{'cupcakes': [('mixer', 2), ('oven', 1)],
'smoothie': [('mixer', 1)],
'lasagna': [('oven', 2)]}