Spaces:
Build error
Build error
Commit
·
7e7de43
0
Parent(s):
Duplicate from pierretassel/JobShopCPRL
Browse filesCo-authored-by: Pierre Tassel <pierretassel@users.noreply.huggingface.co>
- .gitattributes +34 -0
- .gitignore +213 -0
- MyDummyVecEnv.py +124 -0
- README.md +14 -0
- actor.pt +0 -0
- app.py +177 -0
- instances/dmu01.txt +21 -0
- instances/dmu02.txt +21 -0
- instances/dmu03.txt +21 -0
- instances/dmu04.txt +21 -0
- instances/dmu05.txt +21 -0
- instances/la01.txt +11 -0
- instances/la02.txt +11 -0
- instances/la03.txt +11 -0
- instances/la04.txt +11 -0
- instances/la05.txt +11 -0
- instances/ta01 +16 -0
- instances/ta02 +16 -0
- instances/ta03 +16 -0
- instances/ta04 +16 -0
- instances/ta05 +16 -0
- requirements.txt +5 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### JetBrains template
|
2 |
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
3 |
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
4 |
+
|
5 |
+
# User-specific stuff
|
6 |
+
.idea/**/workspace.xml
|
7 |
+
.idea/**/tasks.xml
|
8 |
+
.idea/**/usage.statistics.xml
|
9 |
+
.idea/**/dictionaries
|
10 |
+
.idea/**/shelf
|
11 |
+
|
12 |
+
# Generated files
|
13 |
+
.idea/**/contentModel.xml
|
14 |
+
|
15 |
+
# Sensitive or high-churn files
|
16 |
+
.idea/**/dataSources/
|
17 |
+
.idea/**/dataSources.ids
|
18 |
+
.idea/**/dataSources.local.xml
|
19 |
+
.idea/**/sqlDataSources.xml
|
20 |
+
.idea/**/dynamic.xml
|
21 |
+
.idea/**/uiDesigner.xml
|
22 |
+
.idea/**/dbnavigator.xml
|
23 |
+
|
24 |
+
# Gradle
|
25 |
+
.idea/**/gradle.xml
|
26 |
+
.idea/**/libraries
|
27 |
+
|
28 |
+
# Gradle and Maven with auto-import
|
29 |
+
# When using Gradle or Maven with auto-import, you should exclude module files,
|
30 |
+
# since they will be recreated, and may cause churn. Uncomment if using
|
31 |
+
# auto-import.
|
32 |
+
# .idea/artifacts
|
33 |
+
# .idea/compiler.xml
|
34 |
+
# .idea/jarRepositories.xml
|
35 |
+
# .idea/modules.xml
|
36 |
+
# .idea/*.iml
|
37 |
+
# .idea/modules
|
38 |
+
# *.iml
|
39 |
+
# *.ipr
|
40 |
+
|
41 |
+
# CMake
|
42 |
+
cmake-build-*/
|
43 |
+
|
44 |
+
# Mongo Explorer plugin
|
45 |
+
.idea/**/mongoSettings.xml
|
46 |
+
|
47 |
+
# File-based project format
|
48 |
+
*.iws
|
49 |
+
|
50 |
+
# IntelliJ
|
51 |
+
out/
|
52 |
+
|
53 |
+
# mpeltonen/sbt-idea plugin
|
54 |
+
.idea_modules/
|
55 |
+
|
56 |
+
# JIRA plugin
|
57 |
+
atlassian-ide-plugin.xml
|
58 |
+
|
59 |
+
# Cursive Clojure plugin
|
60 |
+
.idea/replstate.xml
|
61 |
+
|
62 |
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
63 |
+
com_crashlytics_export_strings.xml
|
64 |
+
crashlytics.properties
|
65 |
+
crashlytics-build.properties
|
66 |
+
fabric.properties
|
67 |
+
|
68 |
+
# Editor-based Rest Client
|
69 |
+
.idea/httpRequests
|
70 |
+
|
71 |
+
# Android studio 3.1+ serialized cache file
|
72 |
+
.idea/caches/build_file_checksums.ser
|
73 |
+
|
74 |
+
### Python template
|
75 |
+
# Byte-compiled / optimized / DLL files
|
76 |
+
__pycache__/
|
77 |
+
*.py[cod]
|
78 |
+
*$py.class
|
79 |
+
|
80 |
+
# C extensions
|
81 |
+
*.so
|
82 |
+
|
83 |
+
# Distribution / packaging
|
84 |
+
.Python
|
85 |
+
build/
|
86 |
+
develop-eggs/
|
87 |
+
dist/
|
88 |
+
downloads/
|
89 |
+
eggs/
|
90 |
+
.eggs/
|
91 |
+
lib/
|
92 |
+
lib64/
|
93 |
+
parts/
|
94 |
+
sdist/
|
95 |
+
var/
|
96 |
+
wheels/
|
97 |
+
share/python-wheels/
|
98 |
+
*.egg-info/
|
99 |
+
.installed.cfg
|
100 |
+
*.egg
|
101 |
+
MANIFEST
|
102 |
+
|
103 |
+
# PyInstaller
|
104 |
+
# Usually these files are written by a python script from a template
|
105 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
106 |
+
*.manifest
|
107 |
+
*.spec
|
108 |
+
|
109 |
+
# Installer logs
|
110 |
+
pip-log.txt
|
111 |
+
pip-delete-this-directory.txt
|
112 |
+
|
113 |
+
# Unit test / coverage reports
|
114 |
+
htmlcov/
|
115 |
+
.tox/
|
116 |
+
.nox/
|
117 |
+
.coverage
|
118 |
+
.coverage.*
|
119 |
+
.cache
|
120 |
+
nosetests.xml
|
121 |
+
coverage.xml
|
122 |
+
*.cover
|
123 |
+
*.py,cover
|
124 |
+
.hypothesis/
|
125 |
+
.pytest_cache/
|
126 |
+
cover/
|
127 |
+
|
128 |
+
# Translations
|
129 |
+
*.mo
|
130 |
+
*.pot
|
131 |
+
|
132 |
+
# Django stuff:
|
133 |
+
*.log
|
134 |
+
local_settings.py
|
135 |
+
db.sqlite3
|
136 |
+
db.sqlite3-journal
|
137 |
+
|
138 |
+
# Flask stuff:
|
139 |
+
instance/
|
140 |
+
.webassets-cache
|
141 |
+
|
142 |
+
# Scrapy stuff:
|
143 |
+
.scrapy
|
144 |
+
|
145 |
+
# Sphinx documentation
|
146 |
+
docs/_build/
|
147 |
+
|
148 |
+
# PyBuilder
|
149 |
+
.pybuilder/
|
150 |
+
target/
|
151 |
+
|
152 |
+
# Jupyter Notebook
|
153 |
+
.ipynb_checkpoints
|
154 |
+
|
155 |
+
# IPython
|
156 |
+
profile_default/
|
157 |
+
ipython_config.py
|
158 |
+
|
159 |
+
# pyenv
|
160 |
+
# For a library or package, you might want to ignore these files since the code is
|
161 |
+
# intended to run in multiple environments; otherwise, check them in:
|
162 |
+
# .python-version
|
163 |
+
|
164 |
+
# pipenv
|
165 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
166 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
167 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
168 |
+
# install all needed dependencies.
|
169 |
+
#Pipfile.lock
|
170 |
+
|
171 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
172 |
+
__pypackages__/
|
173 |
+
|
174 |
+
# Celery stuff
|
175 |
+
celerybeat-schedule
|
176 |
+
celerybeat.pid
|
177 |
+
|
178 |
+
# SageMath parsed files
|
179 |
+
*.sage.py
|
180 |
+
|
181 |
+
# Environments
|
182 |
+
.env
|
183 |
+
.venv
|
184 |
+
env/
|
185 |
+
venv/
|
186 |
+
ENV/
|
187 |
+
env.bak/
|
188 |
+
venv.bak/
|
189 |
+
|
190 |
+
# Spyder project settings
|
191 |
+
.spyderproject
|
192 |
+
.spyproject
|
193 |
+
|
194 |
+
# Rope project settings
|
195 |
+
.ropeproject
|
196 |
+
|
197 |
+
# mkdocs documentation
|
198 |
+
/site
|
199 |
+
|
200 |
+
# mypy
|
201 |
+
.mypy_cache/
|
202 |
+
.dmypy.json
|
203 |
+
dmypy.json
|
204 |
+
|
205 |
+
# Pyre type checker
|
206 |
+
.pyre/
|
207 |
+
|
208 |
+
# pytype static type analyzer
|
209 |
+
.pytype/
|
210 |
+
|
211 |
+
# Cython debug symbols
|
212 |
+
cython_debug/
|
213 |
+
|
MyDummyVecEnv.py
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from collections import OrderedDict
|
2 |
+
from typing import Any, Callable, List, Optional, Sequence, Type, Union
|
3 |
+
|
4 |
+
import gym
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
from stable_baselines3.common.vec_env.base_vec_env import VecEnv, VecEnvIndices, VecEnvObs, VecEnvStepReturn
|
8 |
+
from stable_baselines3.common.vec_env.util import dict_to_obs, obs_space_info
|
9 |
+
|
10 |
+
import torch
|
11 |
+
|
12 |
+
|
13 |
+
class MyDummyVecEnv(VecEnv):
|
14 |
+
"""
|
15 |
+
Creates a simple vectorized wrapper for multiple environments, calling each environment in sequence on the current
|
16 |
+
Python process. This is useful for computationally simple environment such as ``cartpole-v1``,
|
17 |
+
as the overhead of multiprocess or multithread outweighs the environment computation time.
|
18 |
+
This can also be used for RL methods that
|
19 |
+
require a vectorized environment, but that you want a single environments to train with.
|
20 |
+
|
21 |
+
:param env_fns: a list of functions
|
22 |
+
that return environments to vectorize
|
23 |
+
"""
|
24 |
+
|
25 |
+
def __init__(self, env_fns: List[Callable[[], gym.Env]], device):
|
26 |
+
self.envs = [fn() for fn in env_fns]
|
27 |
+
env = self.envs[0]
|
28 |
+
VecEnv.__init__(self, len(env_fns), env.observation_space, env.action_space)
|
29 |
+
obs_space = env.observation_space
|
30 |
+
self.keys, shapes, dtypes = obs_space_info(obs_space)
|
31 |
+
self.device = device
|
32 |
+
|
33 |
+
self.buf_obs = OrderedDict(
|
34 |
+
[(k, torch.zeros((self.num_envs,) + tuple(shapes[k]), dtype=torch.float, device=self.device)) for k in self.keys])
|
35 |
+
self.buf_dones = np.zeros((self.num_envs,), dtype=bool)
|
36 |
+
self.buf_rews = np.zeros((self.num_envs,), dtype=np.float32)
|
37 |
+
self.buf_infos = [{} for _ in range(self.num_envs)]
|
38 |
+
self.actions = None
|
39 |
+
|
40 |
+
def step_async(self, actions: np.ndarray) -> None:
|
41 |
+
self.actions = actions
|
42 |
+
|
43 |
+
def step_wait(self) -> VecEnvStepReturn:
|
44 |
+
for env_idx in range(self.num_envs):
|
45 |
+
obs, self.buf_rews[env_idx], self.buf_dones[env_idx], self.buf_infos[env_idx] = self.envs[env_idx].step(
|
46 |
+
self.actions[env_idx]
|
47 |
+
)
|
48 |
+
if self.buf_dones[env_idx]:
|
49 |
+
# save final observation where user can get it, then reset
|
50 |
+
self.buf_infos[env_idx]["terminal_observation"] = obs
|
51 |
+
obs = self.envs[env_idx].reset()
|
52 |
+
self._save_obs(env_idx, obs)
|
53 |
+
return (self._obs_from_buf(), self.buf_rews, self.buf_dones, self.buf_infos)
|
54 |
+
|
55 |
+
def seed(self, seed: Optional[int] = None) -> List[Union[None, int]]:
|
56 |
+
seeds = list()
|
57 |
+
for idx, env in enumerate(self.envs):
|
58 |
+
seeds.append(env.seed(seed + idx))
|
59 |
+
return seeds
|
60 |
+
|
61 |
+
def reset(self) -> VecEnvObs:
|
62 |
+
for env_idx in range(self.num_envs):
|
63 |
+
obs = self.envs[env_idx].reset()
|
64 |
+
self._save_obs(env_idx, obs)
|
65 |
+
return self._obs_from_buf()
|
66 |
+
|
67 |
+
def close(self) -> None:
|
68 |
+
for env in self.envs:
|
69 |
+
env.close()
|
70 |
+
|
71 |
+
def get_images(self) -> Sequence[np.ndarray]:
|
72 |
+
return [env.render(mode="rgb_array") for env in self.envs]
|
73 |
+
|
74 |
+
def render(self, mode: str = "human") -> Optional[np.ndarray]:
|
75 |
+
"""
|
76 |
+
Gym environment rendering. If there are multiple environments then
|
77 |
+
they are tiled together in one image via ``BaseVecEnv.render()``.
|
78 |
+
Otherwise (if ``self.num_envs == 1``), we pass the render call directly to the
|
79 |
+
underlying environment.
|
80 |
+
|
81 |
+
Therefore, some arguments such as ``mode`` will have values that are valid
|
82 |
+
only when ``num_envs == 1``.
|
83 |
+
|
84 |
+
:param mode: The rendering type.
|
85 |
+
"""
|
86 |
+
if self.num_envs == 1:
|
87 |
+
return self.envs[0].render(mode=mode)
|
88 |
+
else:
|
89 |
+
return super().render(mode=mode)
|
90 |
+
|
91 |
+
def _save_obs(self, env_idx: int, obs: VecEnvObs) -> None:
|
92 |
+
for key in self.keys:
|
93 |
+
self.buf_obs[key][env_idx] = torch.from_numpy(obs[key]).to(self.device, non_blocking=True)
|
94 |
+
|
95 |
+
def _obs_from_buf(self) -> VecEnvObs:
|
96 |
+
return dict_to_obs(self.observation_space, self.buf_obs)
|
97 |
+
|
98 |
+
def get_attr(self, attr_name: str, indices: VecEnvIndices = None) -> List[Any]:
|
99 |
+
"""Return attribute from vectorized environment (see base class)."""
|
100 |
+
target_envs = self._get_target_envs(indices)
|
101 |
+
return [getattr(env_i, attr_name) for env_i in target_envs]
|
102 |
+
|
103 |
+
def set_attr(self, attr_name: str, value: Any, indices: VecEnvIndices = None) -> None:
|
104 |
+
"""Set attribute inside vectorized environments (see base class)."""
|
105 |
+
target_envs = self._get_target_envs(indices)
|
106 |
+
for env_i in target_envs:
|
107 |
+
setattr(env_i, attr_name, value)
|
108 |
+
|
109 |
+
def env_method(self, method_name: str, *method_args, indices: VecEnvIndices = None, **method_kwargs) -> List[Any]:
|
110 |
+
"""Call instance methods of vectorized environments."""
|
111 |
+
target_envs = self._get_target_envs(indices)
|
112 |
+
return [getattr(env_i, method_name)(*method_args, **method_kwargs) for env_i in target_envs]
|
113 |
+
|
114 |
+
def env_is_wrapped(self, wrapper_class: Type[gym.Wrapper], indices: VecEnvIndices = None) -> List[bool]:
|
115 |
+
"""Check if worker environments are wrapped with a given wrapper"""
|
116 |
+
target_envs = self._get_target_envs(indices)
|
117 |
+
# Import here to avoid a circular import
|
118 |
+
from stable_baselines3.common import env_util
|
119 |
+
|
120 |
+
return [env_util.is_wrapped(env_i, wrapper_class) for env_i in target_envs]
|
121 |
+
|
122 |
+
def _get_target_envs(self, indices: VecEnvIndices) -> List[gym.Env]:
|
123 |
+
indices = self._get_indices(indices)
|
124 |
+
return [self.envs[i] for i in indices]
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: JobShopCPRL
|
3 |
+
emoji: 🐨
|
4 |
+
colorFrom: gray
|
5 |
+
colorTo: red
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.11.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: mit
|
11 |
+
duplicated_from: pierretassel/JobShopCPRL
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
actor.pt
ADDED
Binary file (80.3 kB). View file
|
|
app.py
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import datetime
|
2 |
+
import os
|
3 |
+
import random
|
4 |
+
import time
|
5 |
+
|
6 |
+
import plotly.figure_factory as ff
|
7 |
+
import json
|
8 |
+
|
9 |
+
import pandas as pd
|
10 |
+
|
11 |
+
from compiled_jss.CPEnv import CompiledJssEnvCP
|
12 |
+
|
13 |
+
from stable_baselines3.common.vec_env import VecEnvWrapper
|
14 |
+
from torch.distributions import Categorical
|
15 |
+
|
16 |
+
import torch
|
17 |
+
import numpy as np
|
18 |
+
|
19 |
+
from MyDummyVecEnv import MyDummyVecEnv
|
20 |
+
|
21 |
+
import gradio as gr
|
22 |
+
|
23 |
+
|
24 |
+
class VecPyTorch(VecEnvWrapper):
|
25 |
+
|
26 |
+
def __init__(self, venv, device):
|
27 |
+
super(VecPyTorch, self).__init__(venv)
|
28 |
+
self.device = device
|
29 |
+
|
30 |
+
def reset(self):
|
31 |
+
return self.venv.reset()
|
32 |
+
|
33 |
+
def step_async(self, actions):
|
34 |
+
self.venv.step_async(actions)
|
35 |
+
|
36 |
+
def step_wait(self):
|
37 |
+
return self.venv.step_wait()
|
38 |
+
|
39 |
+
|
40 |
+
def make_env(seed, instance):
|
41 |
+
def thunk():
|
42 |
+
_env = CompiledJssEnvCP(instance)
|
43 |
+
return _env
|
44 |
+
|
45 |
+
return thunk
|
46 |
+
|
47 |
+
|
48 |
+
def solve(file, num_workers, seed):
|
49 |
+
seed = int(abs(seed))
|
50 |
+
random.seed(seed)
|
51 |
+
np.random.seed(seed)
|
52 |
+
torch.manual_seed(seed)
|
53 |
+
with torch.inference_mode():
|
54 |
+
device = torch.device('cpu')
|
55 |
+
actor = torch.jit.load('actor.pt', map_location=device)
|
56 |
+
actor.eval()
|
57 |
+
start_time = time.time()
|
58 |
+
fn_env = [make_env(0, file.name)
|
59 |
+
for _ in range(num_workers)]
|
60 |
+
async_envs = MyDummyVecEnv(fn_env, device)
|
61 |
+
envs = VecPyTorch(async_envs, device)
|
62 |
+
current_solution_cost = float('inf')
|
63 |
+
current_solution = ''
|
64 |
+
obs = envs.reset()
|
65 |
+
total_episode = 0
|
66 |
+
while total_episode < envs.num_envs:
|
67 |
+
logits = actor(obs['interval_rep'], obs['attention_interval_mask'], obs['job_resource_mask'],
|
68 |
+
obs['action_mask'], obs['index_interval'], obs['start_end_tokens'])
|
69 |
+
# temperature vector
|
70 |
+
if num_workers >= 4:
|
71 |
+
temperature = torch.arange(0.5, 2.0, step=(1.5 / num_workers), device=device)
|
72 |
+
else:
|
73 |
+
temperature = torch.ones(num_workers, device=device)
|
74 |
+
logits = logits / temperature[:, None]
|
75 |
+
probs = Categorical(logits=logits).probs
|
76 |
+
# random sample based on logits
|
77 |
+
actions = torch.multinomial(probs, probs.shape[1]).cpu().numpy()
|
78 |
+
obs, reward, done, infos = envs.step(actions)
|
79 |
+
total_episode += done.sum()
|
80 |
+
# total_actions += 1
|
81 |
+
# print(f'Episode {total_episode} / {envs.num_envs} - Actions {total_actions}', end='\r')
|
82 |
+
for env_idx, info in enumerate(infos):
|
83 |
+
if 'makespan' in info and int(info['makespan']) < current_solution_cost:
|
84 |
+
current_solution_cost = int(info['makespan'])
|
85 |
+
current_solution = json.loads(info['solution'])
|
86 |
+
total_time = time.time() - start_time
|
87 |
+
pretty_output = ""
|
88 |
+
for job_id in range(len(current_solution)):
|
89 |
+
pretty_output += f"Job {job_id}: {current_solution[job_id]}\n"
|
90 |
+
|
91 |
+
jobs_data = []
|
92 |
+
file.seek(0)
|
93 |
+
line_str: str = file.readline()
|
94 |
+
line_cnt: int = 1
|
95 |
+
jobs_count: int = 0
|
96 |
+
machines_count: int = 0
|
97 |
+
while line_str:
|
98 |
+
data = []
|
99 |
+
split_data = line_str.split()
|
100 |
+
if line_cnt == 1:
|
101 |
+
jobs_count, machines_count = int(split_data[0]), int(
|
102 |
+
split_data[1]
|
103 |
+
)
|
104 |
+
else:
|
105 |
+
i = 0
|
106 |
+
this_job_op_count = 0
|
107 |
+
while i < len(split_data):
|
108 |
+
machine, op_time = int(split_data[i]), int(split_data[i + 1])
|
109 |
+
data.append((machine, op_time))
|
110 |
+
i += 2
|
111 |
+
this_job_op_count += 1
|
112 |
+
jobs_data.append(data)
|
113 |
+
line_str = file.readline()
|
114 |
+
line_cnt += 1
|
115 |
+
# convert to integer the current_solution
|
116 |
+
current_solution = [[int(x) for x in y] for y in current_solution]
|
117 |
+
df = []
|
118 |
+
for job_id in range(jobs_count):
|
119 |
+
for task_id in range(len(current_solution[job_id])):
|
120 |
+
dict_op = dict()
|
121 |
+
dict_op["Task"] = "Job {}".format(job_id)
|
122 |
+
start_sec = current_solution[job_id][task_id]
|
123 |
+
finish_sec = start_sec + jobs_data[job_id][task_id][1]
|
124 |
+
dict_op["Start"] = datetime.datetime.fromtimestamp(start_sec)
|
125 |
+
dict_op["Finish"] = datetime.datetime.fromtimestamp(finish_sec)
|
126 |
+
dict_op["Resource"] = "Machine {}".format(
|
127 |
+
jobs_data[job_id][task_id][0]
|
128 |
+
)
|
129 |
+
df.append(dict_op)
|
130 |
+
i += 1
|
131 |
+
fig = None
|
132 |
+
colors = [
|
133 |
+
tuple([random.random() for _ in range(3)]) for _ in range(machines_count)
|
134 |
+
]
|
135 |
+
if len(df) > 0:
|
136 |
+
df = pd.DataFrame(df)
|
137 |
+
fig = ff.create_gantt(
|
138 |
+
df,
|
139 |
+
index_col="Resource",
|
140 |
+
colors=colors,
|
141 |
+
show_colorbar=True,
|
142 |
+
group_tasks=True,
|
143 |
+
)
|
144 |
+
fig.update_yaxes(
|
145 |
+
autorange=True
|
146 |
+
)
|
147 |
+
return current_solution_cost, str(total_time) + " seconds", pretty_output, fig
|
148 |
+
|
149 |
+
|
150 |
+
title = "Job-Shop Scheduling CP environment with RL dispatching"
|
151 |
+
description = """A Job-Shop Scheduling Reinforcement Learning based solver using an underlying CP model as an
|
152 |
+
environment. <br>
|
153 |
+
For fast inference,
|
154 |
+
check out the cached examples below.<br> Any Job-Shop Scheduling instance following the standard specification is
|
155 |
+
compatible. <a href='http://jobshop.jjvh.nl/index.php'>Check out this website for more instances</a>.<br>
|
156 |
+
Increasing the number of workers will provide better solutions, but will slow down the solving time.
|
157 |
+
This behavior is different than the one from the paper repository as here agents are run sequentially,
|
158 |
+
whereas we run agents in parallel (technical limitation due to the platform here). <br>
|
159 |
+
<br>
|
160 |
+
For large instance, we recommend running the approach locally outside the interface, as it causes a lot
|
161 |
+
of overhead and the resource available on this platform are low (1 vCPU and no GPU).<br> """
|
162 |
+
|
163 |
+
article = "<p style='text-align: center'>Article Under Review</p>"
|
164 |
+
# list all non-hidden files in the 'instances' directory
|
165 |
+
examples = [['instances/' + f, 16, 0] for f in os.listdir('instances') if not f.startswith('.')]
|
166 |
+
iface = gr.Interface(fn=solve,
|
167 |
+
inputs=[gr.File(label="Instance File"),
|
168 |
+
gr.Slider(8, 32, value=16, label="Number of Workers", step=1),
|
169 |
+
gr.Number(0, label="Random Seed", precision=0)],
|
170 |
+
outputs=[gr.Text(label="Makespan"), gr.Text(label="Elapsed Time"), gr.Text(label="Solution"),
|
171 |
+
gr.Plot(label="Solution's Gantt Chart")],
|
172 |
+
title=title,
|
173 |
+
description=description,
|
174 |
+
article=article,
|
175 |
+
examples=examples,
|
176 |
+
allow_flagging="never")
|
177 |
+
iface.launch(enable_queue=True)
|
instances/dmu01.txt
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
20 15
|
2 |
+
0 160 13 5 6 139 11 99 12 9 5 98 2 28 1 107 3 196 10 165 7 114 4 7 14 34 8 133 9 76
|
3 |
+
14 105 7 160 3 19 2 189 11 25 1 95 12 15 0 122 4 165 9 2 10 66 13 111 8 51 6 83 5 183
|
4 |
+
11 61 5 11 9 130 4 147 13 106 12 1 6 141 7 136 10 33 0 13 2 15 8 10 14 62 3 4 1 142
|
5 |
+
13 117 1 11 4 162 0 192 5 35 8 172 3 4 14 193 2 141 11 139 6 62 9 12 12 1 7 135 10 25
|
6 |
+
5 53 9 89 10 168 12 41 11 121 1 181 3 43 0 118 4 61 14 193 2 124 6 176 13 28 8 125 7 136
|
7 |
+
5 152 0 115 2 122 14 5 12 46 13 144 11 29 7 176 1 115 6 18 4 23 9 26 3 175 8 110 10 75
|
8 |
+
6 50 1 62 3 186 12 57 11 156 10 32 2 134 9 141 4 189 13 118 0 102 7 3 8 177 14 43 5 41
|
9 |
+
13 35 0 171 14 160 9 32 7 5 11 154 8 195 3 113 12 162 5 152 6 140 2 72 4 16 10 104 1 171
|
10 |
+
13 68 8 54 6 116 4 9 14 99 12 155 10 22 5 135 0 67 1 165 9 100 11 47 3 46 7 55 2 12
|
11 |
+
1 135 5 105 9 49 8 4 12 176 3 52 11 128 7 188 6 170 10 170 2 169 4 62 0 120 13 28 14 70
|
12 |
+
2 93 1 172 13 124 6 72 7 189 14 122 5 38 0 120 12 114 11 51 9 77 8 65 4 176 3 171 10 169
|
13 |
+
3 122 6 21 4 6 13 189 14 75 5 5 9 180 0 160 1 14 11 73 12 45 2 61 7 148 10 96 8 194
|
14 |
+
9 94 12 198 8 100 5 194 2 127 10 95 4 43 3 52 6 166 1 31 14 100 13 104 7 166 11 139 0 143
|
15 |
+
5 4 3 78 11 199 8 119 12 167 0 54 9 38 14 114 13 10 4 115 7 101 1 104 2 61 6 75 10 175
|
16 |
+
10 18 11 115 6 166 8 41 14 124 12 101 7 38 13 29 0 91 2 118 9 40 5 55 1 82 4 89 3 100
|
17 |
+
11 2 9 107 14 99 3 152 7 51 4 13 10 112 0 96 1 150 6 97 13 67 5 57 2 45 8 17 12 184
|
18 |
+
1 176 11 15 3 92 9 9 14 77 12 4 7 83 10 195 4 156 6 102 2 91 13 65 8 19 5 163 0 93
|
19 |
+
8 38 0 32 14 80 11 109 9 71 1 100 12 139 7 52 3 163 13 40 4 5 6 28 2 105 5 186 10 186
|
20 |
+
11 1 3 73 0 106 4 80 12 150 13 5 5 71 9 145 1 138 6 148 10 168 7 60 2 107 14 164 8 178
|
21 |
+
1 14 10 5 4 115 2 70 11 112 5 76 9 20 0 104 7 167 13 58 8 193 12 30 6 132 3 6 14 19
|
instances/dmu02.txt
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
20 15
|
2 |
+
3 64 9 24 10 51 4 114 1 80 12 110 2 63 11 136 0 53 8 182 5 134 14 125 7 62 6 58 13 177
|
3 |
+
13 52 11 188 2 78 1 93 6 110 0 48 10 171 4 11 3 113 14 144 7 96 8 182 12 63 5 152 9 107
|
4 |
+
4 86 6 29 8 187 14 77 5 39 11 144 7 98 10 108 3 48 1 40 9 162 12 89 2 36 0 107 13 53
|
5 |
+
10 48 11 28 14 71 9 112 2 140 4 11 6 105 13 24 3 79 7 191 12 84 8 32 5 99 1 46 0 140
|
6 |
+
8 158 14 13 5 126 4 47 11 13 9 172 7 33 13 167 1 114 3 23 0 174 2 78 10 161 12 185 6 144
|
7 |
+
1 29 2 162 6 196 10 29 14 42 3 8 9 175 7 141 5 37 8 24 4 149 13 11 0 39 11 31 12 24
|
8 |
+
11 94 1 22 4 71 5 92 7 78 9 54 3 17 13 156 10 57 0 8 14 10 2 134 12 134 8 43 6 62
|
9 |
+
9 146 11 95 3 168 0 179 12 181 8 108 7 119 4 126 13 130 5 120 1 182 10 126 2 175 6 131 14 181
|
10 |
+
3 158 9 11 7 106 2 77 5 28 14 143 13 197 6 144 11 82 10 120 0 129 4 54 1 91 12 78 8 75
|
11 |
+
14 185 13 99 12 159 8 71 6 110 10 84 9 147 5 152 4 111 2 49 0 158 1 127 3 51 7 84 11 70
|
12 |
+
1 132 4 180 11 49 7 65 12 198 13 133 14 153 8 49 0 169 9 14 3 68 2 65 5 7 10 138 6 67
|
13 |
+
4 27 14 184 3 92 8 88 13 131 6 106 5 63 1 10 0 72 11 22 9 12 10 160 12 154 7 96 2 81
|
14 |
+
0 120 14 168 7 179 8 11 11 156 5 163 2 5 9 134 13 84 1 101 10 53 4 21 3 16 6 143 12 25
|
15 |
+
8 164 4 109 7 160 9 185 14 12 2 193 12 84 10 190 13 151 0 173 5 183 1 4 11 198 3 179 6 61
|
16 |
+
14 77 2 164 10 119 12 13 6 188 11 181 1 67 0 55 8 88 13 124 5 73 7 191 3 194 9 99 4 169
|
17 |
+
13 176 14 87 9 133 1 6 8 142 4 167 2 85 6 57 5 60 0 143 10 117 11 164 12 151 7 45 3 178
|
18 |
+
1 183 9 4 2 21 10 188 0 180 8 82 5 138 7 22 13 124 11 109 3 57 4 8 6 105 14 150 12 29
|
19 |
+
2 44 7 104 8 77 11 8 0 5 9 22 1 64 6 167 3 96 4 27 12 141 10 6 5 113 14 54 13 26
|
20 |
+
0 145 12 36 11 156 1 71 13 37 9 147 3 85 6 59 7 146 4 31 14 126 8 138 10 154 2 142 5 96
|
21 |
+
14 192 2 146 11 167 13 50 0 180 10 171 4 94 1 165 5 27 6 37 12 80 3 194 8 134 7 53 9 14
|
instances/dmu03.txt
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
20 15
|
2 |
+
11 84 12 119 2 128 3 144 8 177 0 151 9 138 6 16 14 195 5 93 13 107 1 22 10 137 4 96 7 21
|
3 |
+
14 95 0 91 8 153 6 109 2 182 10 47 7 98 11 54 4 159 9 123 13 5 12 5 5 141 1 79 3 160
|
4 |
+
13 91 3 62 4 173 11 67 0 136 10 140 12 115 2 183 14 186 5 6 1 190 6 173 9 139 8 28 7 183
|
5 |
+
13 119 5 188 3 43 8 18 12 23 14 58 2 136 0 54 6 194 1 35 4 40 7 32 9 184 11 112 10 186
|
6 |
+
1 199 11 13 10 63 8 58 4 55 9 82 5 22 12 183 3 43 0 157 14 25 13 60 6 150 7 12 2 115
|
7 |
+
6 113 3 109 5 185 8 59 1 3 9 24 0 71 14 98 13 32 10 102 12 19 11 20 4 112 7 14 2 39
|
8 |
+
13 194 11 133 12 117 14 13 7 111 2 126 8 101 6 38 0 184 9 135 1 99 10 92 5 146 3 44 4 158
|
9 |
+
6 103 4 93 12 21 10 148 5 66 3 29 1 11 9 4 13 28 2 93 11 192 0 67 8 96 7 16 14 64
|
10 |
+
7 124 11 185 6 153 5 143 0 30 8 27 2 69 9 130 12 53 4 189 14 86 10 78 1 155 13 87 3 114
|
11 |
+
14 168 7 5 4 17 9 186 6 133 0 35 13 101 8 172 3 56 10 126 2 75 1 93 12 67 11 109 5 127
|
12 |
+
4 90 3 199 12 185 8 94 6 40 0 92 2 146 7 90 9 131 5 57 13 135 11 190 1 192 10 56 14 103
|
13 |
+
4 45 0 45 7 157 14 13 1 126 11 44 5 152 10 148 2 122 6 158 8 148 13 103 3 69 12 93 9 192
|
14 |
+
7 107 6 137 2 14 9 113 1 138 8 182 4 179 11 107 13 118 5 172 14 157 12 178 3 127 0 34 10 82
|
15 |
+
14 9 2 163 10 104 13 20 0 21 3 48 1 131 11 9 6 125 9 101 4 106 8 195 7 161 5 74 12 115
|
16 |
+
7 187 4 55 5 76 2 56 1 59 12 11 13 74 8 2 3 194 9 13 10 104 6 147 11 166 0 34 14 118
|
17 |
+
7 45 5 170 3 135 6 72 11 56 0 146 8 190 2 57 13 148 14 39 12 163 1 14 4 168 9 101 10 99
|
18 |
+
8 104 7 75 0 183 14 152 2 166 10 10 11 122 13 32 6 94 9 161 12 150 3 1 1 98 4 113 5 26
|
19 |
+
4 42 14 62 13 86 0 118 12 128 2 153 8 134 6 156 11 80 5 105 7 16 3 186 1 84 10 42 9 129
|
20 |
+
7 160 1 119 14 93 3 22 8 168 12 138 13 162 5 65 6 56 9 171 11 20 2 8 4 137 0 193 10 92
|
21 |
+
12 185 8 19 3 11 7 87 11 171 4 14 13 65 1 61 0 34 9 93 10 154 6 67 2 14 5 136 14 27
|
instances/dmu04.txt
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
20 15
|
2 |
+
8 185 10 34 3 100 2 46 4 106 0 67 12 75 7 93 11 47 13 70 5 192 1 134 9 85 6 149 14 44
|
3 |
+
14 126 2 60 8 112 7 131 9 185 11 87 4 1 0 198 12 28 13 157 10 194 1 59 5 54 3 2 6 156
|
4 |
+
2 20 12 139 7 171 8 198 1 18 10 169 6 140 5 198 0 122 9 60 13 111 11 190 4 100 3 89 14 17
|
5 |
+
5 63 6 36 2 41 11 190 7 103 1 130 3 95 4 174 14 127 13 179 8 157 9 120 0 132 12 195 10 77
|
6 |
+
6 55 10 59 11 18 4 28 9 118 5 89 14 108 8 81 2 98 3 182 7 9 12 196 0 134 1 111 13 46
|
7 |
+
0 190 10 2 13 90 12 19 11 29 1 16 3 71 2 142 5 90 7 23 6 189 4 108 8 41 9 37 14 98
|
8 |
+
3 137 0 174 2 129 8 14 14 53 5 11 13 141 10 36 7 72 11 161 4 199 9 155 1 100 6 138 12 165
|
9 |
+
11 188 9 106 1 79 0 54 5 77 10 144 12 152 8 112 13 149 4 197 7 40 3 74 6 139 2 82 14 5
|
10 |
+
11 66 8 93 7 103 2 67 6 125 3 24 14 152 0 186 5 7 13 106 12 144 4 49 10 131 9 35 1 180
|
11 |
+
5 13 3 52 12 173 6 131 14 19 7 63 1 133 0 19 8 17 13 116 4 148 10 96 2 80 9 173 11 59
|
12 |
+
3 188 12 13 7 60 9 85 6 188 11 41 1 47 5 18 14 38 13 134 8 3 10 115 4 97 0 76 2 78
|
13 |
+
12 93 10 199 0 53 14 164 9 187 11 101 5 61 3 52 13 119 7 166 1 48 8 29 6 59 2 98 4 13
|
14 |
+
8 14 7 186 5 157 2 52 1 34 9 99 4 92 13 49 12 95 10 101 3 175 14 192 0 104 6 52 11 70
|
15 |
+
3 162 10 43 13 129 9 86 2 116 6 91 4 37 14 75 12 106 8 86 0 36 5 122 11 169 7 187 1 171
|
16 |
+
7 126 6 120 2 77 13 133 10 191 11 173 8 168 5 166 3 175 0 156 12 26 1 147 4 136 14 66 9 48
|
17 |
+
10 65 1 42 13 66 2 151 14 117 5 73 3 160 9 161 11 23 0 70 12 168 6 75 4 150 7 90 8 168
|
18 |
+
11 52 2 191 14 131 7 63 9 145 8 184 0 197 4 24 3 189 5 27 1 57 6 87 10 47 13 168 12 149
|
19 |
+
0 72 1 47 2 109 13 9 8 36 6 85 10 76 5 101 9 184 14 120 4 127 7 129 12 101 11 5 3 180
|
20 |
+
6 83 9 172 4 25 1 104 12 120 5 145 10 182 14 55 3 48 2 197 7 176 8 175 0 42 13 18 11 54
|
21 |
+
9 9 1 86 10 81 5 144 3 29 14 183 13 37 4 199 0 79 6 165 7 45 8 25 11 14 12 175 2 191
|
instances/dmu05.txt
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
20 15
|
2 |
+
8 98 13 149 6 36 10 169 4 136 7 41 14 19 11 199 3 181 9 95 0 44 2 143 1 182 12 158 5 53
|
3 |
+
5 194 3 172 1 74 4 85 0 94 11 86 7 191 6 185 9 62 12 94 10 162 13 40 8 142 2 75 14 129
|
4 |
+
2 70 3 33 5 114 6 179 9 131 10 54 4 128 12 28 11 106 8 180 14 48 0 106 1 134 13 106 7 85
|
5 |
+
11 34 10 101 13 108 5 182 4 129 2 89 12 84 6 68 8 34 3 171 7 183 14 169 0 16 1 127 9 31
|
6 |
+
10 197 1 176 11 39 6 192 12 90 5 30 4 4 0 51 2 152 3 173 13 194 7 39 14 60 9 118 8 14
|
7 |
+
5 84 8 22 13 20 11 51 4 145 14 86 3 159 7 49 6 193 9 43 2 178 10 160 0 18 1 111 12 193
|
8 |
+
7 42 5 168 10 70 8 86 2 41 4 56 12 194 14 107 11 160 3 182 6 143 13 160 9 145 0 62 1 1
|
9 |
+
10 80 13 76 11 16 8 192 4 100 6 83 1 186 7 55 0 122 12 87 9 59 14 154 3 200 5 95 2 18
|
10 |
+
0 74 9 99 14 45 11 91 1 153 12 199 3 35 13 121 4 128 2 193 5 125 8 141 10 77 6 149 7 197
|
11 |
+
4 1 0 11 3 158 12 135 7 196 8 107 13 76 9 6 1 57 10 93 2 96 6 180 14 7 11 140 5 61
|
12 |
+
6 90 3 189 0 3 14 128 5 123 2 178 12 116 1 146 11 94 13 196 7 107 10 136 8 41 9 25 4 164
|
13 |
+
13 82 4 61 1 52 9 141 11 65 10 94 2 48 8 128 12 146 0 90 7 47 3 154 14 49 6 177 5 42
|
14 |
+
0 146 7 29 11 5 10 169 3 192 12 56 13 102 14 121 2 116 8 45 6 33 1 170 4 192 5 159 9 145
|
15 |
+
13 130 2 33 10 200 7 129 12 103 1 173 5 73 14 119 6 46 9 22 8 158 4 23 3 24 11 122 0 189
|
16 |
+
3 10 4 199 2 149 13 70 8 76 0 155 5 2 12 79 11 102 6 163 10 161 7 126 9 69 14 33 1 196
|
17 |
+
11 36 0 52 1 120 12 88 5 81 4 1 7 3 6 11 13 88 9 7 3 136 14 165 2 39 10 21 8 132
|
18 |
+
11 180 13 77 5 94 10 21 12 134 0 147 3 167 7 187 14 53 9 39 8 28 2 139 6 50 4 50 1 57
|
19 |
+
7 185 9 102 2 127 10 110 12 198 5 66 4 183 13 101 1 25 11 15 14 108 6 57 0 32 8 43 3 43
|
20 |
+
5 33 14 80 10 103 8 138 13 141 11 4 12 127 4 191 0 180 9 107 3 19 6 34 2 61 1 193 7 145
|
21 |
+
1 41 13 168 4 174 14 1 7 130 6 124 8 28 0 82 10 127 9 139 5 152 12 146 11 30 3 12 2 70
|
instances/la01.txt
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
10 5
|
2 |
+
1 21 0 53 4 95 3 55 2 34
|
3 |
+
0 21 3 52 4 16 2 26 1 71
|
4 |
+
3 39 4 98 1 42 2 31 0 12
|
5 |
+
1 77 0 55 4 79 2 66 3 77
|
6 |
+
0 83 3 34 2 64 1 19 4 37
|
7 |
+
1 54 2 43 4 79 0 92 3 62
|
8 |
+
3 69 4 77 1 87 2 87 0 93
|
9 |
+
2 38 0 60 1 41 3 24 4 83
|
10 |
+
3 17 1 49 4 25 0 44 2 98
|
11 |
+
4 77 3 79 2 43 1 75 0 96
|
instances/la02.txt
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
10 5
|
2 |
+
0 20 3 87 1 31 4 76 2 17
|
3 |
+
4 25 2 32 0 24 1 18 3 81
|
4 |
+
1 72 2 23 4 28 0 58 3 99
|
5 |
+
2 86 1 76 4 97 0 45 3 90
|
6 |
+
4 27 0 42 3 48 2 17 1 46
|
7 |
+
1 67 0 98 4 48 3 27 2 62
|
8 |
+
4 28 1 12 3 19 0 80 2 50
|
9 |
+
1 63 0 94 2 98 3 50 4 80
|
10 |
+
4 14 0 75 2 50 1 41 3 55
|
11 |
+
4 72 2 18 1 37 3 79 0 61
|
instances/la03.txt
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
10 5
|
2 |
+
1 23 2 45 0 82 4 84 3 38
|
3 |
+
2 21 1 29 0 18 4 41 3 50
|
4 |
+
2 38 3 54 4 16 0 52 1 52
|
5 |
+
4 37 0 54 2 74 1 62 3 57
|
6 |
+
4 57 0 81 1 61 3 68 2 30
|
7 |
+
4 81 0 79 1 89 2 89 3 11
|
8 |
+
3 33 2 20 0 91 4 20 1 66
|
9 |
+
4 24 1 84 0 32 2 55 3 8
|
10 |
+
4 56 0 7 3 54 2 64 1 39
|
11 |
+
4 40 1 83 0 19 2 8 3 7
|
instances/la04.txt
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
10 5
|
2 |
+
0 12 2 94 3 92 4 91 1 7
|
3 |
+
1 19 3 11 4 66 2 21 0 87
|
4 |
+
1 14 0 75 3 13 4 16 2 20
|
5 |
+
2 95 4 66 0 7 3 7 1 77
|
6 |
+
1 45 3 6 4 89 0 15 2 34
|
7 |
+
3 77 2 20 0 76 4 88 1 53
|
8 |
+
2 74 1 88 0 52 3 27 4 9
|
9 |
+
1 88 3 69 0 62 4 98 2 52
|
10 |
+
2 61 4 9 0 62 1 52 3 90
|
11 |
+
2 54 4 5 3 59 1 15 0 88
|
instances/la05.txt
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
10 5
|
2 |
+
1 72 0 87 4 95 2 66 3 60
|
3 |
+
4 5 3 35 0 48 2 39 1 54
|
4 |
+
1 46 3 20 2 21 0 97 4 55
|
5 |
+
0 59 3 19 4 46 1 34 2 37
|
6 |
+
4 23 2 73 3 25 1 24 0 28
|
7 |
+
3 28 0 45 4 5 1 78 2 83
|
8 |
+
0 53 3 71 1 37 4 29 2 12
|
9 |
+
4 12 2 87 3 33 1 55 0 38
|
10 |
+
2 49 3 83 1 40 0 48 4 7
|
11 |
+
2 65 3 17 0 90 4 27 1 23
|
instances/ta01
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
15 15
|
2 |
+
6 94 12 66 4 10 7 53 3 26 2 15 10 65 11 82 8 10 14 27 9 93 13 92 5 96 0 70 1 83
|
3 |
+
4 74 5 31 7 88 14 51 13 57 8 78 11 8 9 7 6 91 10 79 0 18 3 51 12 18 1 99 2 33
|
4 |
+
1 4 8 82 9 40 12 86 6 50 11 54 13 21 5 6 0 54 2 68 7 82 10 20 4 39 3 35 14 68
|
5 |
+
5 73 2 23 9 30 6 30 10 53 0 94 13 58 4 93 7 32 14 91 11 30 8 56 12 27 1 92 3 9
|
6 |
+
7 78 8 23 6 21 10 60 4 36 9 29 2 95 14 99 12 79 5 76 1 93 13 42 11 52 0 42 3 96
|
7 |
+
5 29 3 61 12 88 13 70 11 16 4 31 14 65 7 83 2 78 1 26 10 50 0 87 9 62 6 14 8 30
|
8 |
+
12 18 3 75 7 20 8 4 14 91 6 68 1 19 11 54 4 85 5 73 2 43 10 24 0 37 13 87 9 66
|
9 |
+
11 32 5 52 0 9 7 49 12 61 13 35 14 99 1 62 2 6 8 62 4 7 3 80 9 3 6 57 10 7
|
10 |
+
10 85 11 30 6 96 14 91 0 13 1 87 2 82 5 83 12 78 4 56 8 85 7 8 9 66 13 88 3 15
|
11 |
+
6 5 11 59 9 30 2 60 8 41 0 17 13 66 3 89 10 78 7 88 1 69 12 45 14 82 4 6 5 13
|
12 |
+
4 90 7 27 13 1 0 8 5 91 12 80 6 89 8 49 14 32 10 28 3 90 1 93 11 6 9 35 2 73
|
13 |
+
2 47 14 43 0 75 12 8 6 51 10 3 7 84 5 34 8 28 9 60 13 69 1 45 3 67 11 58 4 87
|
14 |
+
5 65 8 62 10 97 2 20 3 31 6 33 9 33 0 77 13 50 4 80 1 48 11 90 12 75 7 96 14 44
|
15 |
+
8 28 14 21 4 51 13 75 5 17 6 89 9 59 1 56 12 63 7 18 11 17 10 30 3 16 2 7 0 35
|
16 |
+
10 57 8 16 12 42 6 34 4 37 1 26 13 68 14 73 11 5 0 8 7 12 3 87 2 83 9 20 5 97
|
instances/ta02
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
15 15
|
2 |
+
9 86 14 60 4 10 13 59 10 65 3 94 7 71 8 25 0 98 5 49 1 43 2 8 12 90 6 21 11 73
|
3 |
+
10 68 8 28 11 38 14 36 3 93 13 35 9 37 7 28 4 62 2 86 6 65 1 11 5 20 12 82 0 23
|
4 |
+
7 33 0 67 6 96 5 91 14 83 13 81 2 60 11 88 4 20 12 62 1 22 9 79 3 38 10 40 8 82
|
5 |
+
9 13 11 14 14 73 0 88 1 24 8 16 5 78 10 70 12 53 4 68 13 73 3 90 6 58 7 7 2 4
|
6 |
+
11 93 4 52 13 63 3 13 8 19 1 41 10 71 12 59 2 19 14 60 6 85 7 99 0 73 9 95 5 19
|
7 |
+
5 62 2 60 1 93 10 16 0 10 4 72 8 88 14 69 6 58 3 41 9 46 7 63 11 76 12 83 13 62
|
8 |
+
5 50 10 68 13 90 0 34 9 44 8 5 1 8 11 25 14 70 7 53 12 78 2 92 6 62 4 85 3 70
|
9 |
+
12 60 0 64 9 92 3 44 13 63 6 91 5 21 7 1 2 96 14 19 11 59 8 12 10 41 1 11 4 94
|
10 |
+
11 93 10 46 5 51 13 37 1 91 9 90 8 63 7 40 3 68 6 13 0 16 2 83 14 49 12 24 4 23
|
11 |
+
2 5 14 35 3 21 10 14 6 66 1 3 0 6 13 98 11 63 4 64 5 76 8 94 7 17 12 62 9 37
|
12 |
+
11 35 14 42 13 62 5 68 4 73 9 27 1 52 6 39 12 41 0 25 2 9 8 34 10 50 3 41 7 98
|
13 |
+
12 23 3 32 10 35 8 10 4 29 7 68 13 20 11 8 14 58 1 62 2 39 0 32 5 8 6 33 9 91
|
14 |
+
8 28 13 31 5 3 0 28 11 66 9 59 4 24 12 45 1 81 10 8 6 44 2 42 7 2 14 23 3 53
|
15 |
+
2 11 5 93 4 27 3 59 9 62 1 23 11 23 13 7 7 77 6 64 10 60 14 97 0 36 8 53 12 72
|
16 |
+
1 36 10 98 4 38 2 24 0 84 7 47 6 72 9 1 11 91 12 85 5 68 14 42 3 20 13 30 8 30
|
instances/ta03
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
15 15
|
2 |
+
7 69 11 81 8 81 3 62 12 80 1 3 13 38 0 62 14 54 6 66 9 88 4 82 2 3 10 12 5 88
|
3 |
+
12 83 1 51 11 47 9 15 6 89 3 76 2 52 4 18 5 22 8 85 13 26 14 30 10 5 0 89 7 22
|
4 |
+
1 62 2 47 9 93 0 54 3 38 5 78 8 71 4 96 14 19 10 33 12 44 13 71 7 90 6 9 11 21
|
5 |
+
13 33 10 82 6 80 2 30 14 96 7 31 4 11 11 26 0 41 5 55 9 12 3 10 8 92 1 3 12 75
|
6 |
+
1 36 8 49 4 10 14 43 6 69 5 72 3 19 2 65 9 37 10 57 13 32 7 11 11 73 0 89 12 12
|
7 |
+
5 83 14 32 2 6 12 13 10 87 1 94 11 36 4 76 6 46 9 30 0 56 13 62 8 32 3 52 7 72
|
8 |
+
5 29 2 78 0 21 1 27 8 17 14 43 11 14 10 15 7 16 9 49 6 72 12 19 4 99 13 38 3 64
|
9 |
+
4 12 7 74 10 4 1 3 9 15 8 62 2 50 14 38 11 49 3 25 5 18 6 55 13 5 12 71 0 27
|
10 |
+
14 69 11 13 0 33 9 47 10 86 5 31 3 97 12 48 8 25 13 40 6 94 1 22 7 61 2 59 4 16
|
11 |
+
9 27 0 4 3 35 10 80 12 49 13 46 5 84 1 46 6 96 14 72 8 18 11 23 2 96 7 74 4 23
|
12 |
+
7 36 2 17 1 81 12 67 3 47 14 5 4 51 6 23 5 82 9 35 8 96 13 7 10 54 0 92 11 38
|
13 |
+
0 78 8 58 14 62 12 43 9 1 5 56 6 76 10 49 7 80 11 26 3 79 4 9 1 24 13 24 2 42
|
14 |
+
8 38 12 86 10 38 11 38 14 83 3 36 6 11 1 17 4 99 5 14 0 57 9 64 13 58 2 96 7 17
|
15 |
+
13 10 2 86 11 93 0 63 14 61 10 62 3 75 1 90 12 40 4 77 5 8 6 27 7 96 9 69 8 64
|
16 |
+
1 73 13 12 0 14 11 71 2 3 10 47 4 84 8 84 3 53 5 58 7 95 6 87 9 90 12 68 14 75
|
instances/ta04
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
15 15
|
2 |
+
3 72 7 51 6 42 14 31 9 61 8 46 5 88 4 33 10 27 1 85 0 70 12 56 11 70 2 50 13 25
|
3 |
+
1 19 11 79 0 79 5 47 8 40 13 67 3 43 10 65 9 84 2 61 12 30 6 56 4 19 7 91 14 68
|
4 |
+
7 94 3 7 8 2 11 95 0 60 4 82 9 76 13 36 1 8 10 85 6 7 5 44 14 2 12 72 2 91
|
5 |
+
6 58 11 67 5 84 13 34 3 19 2 19 1 94 4 41 9 98 12 96 8 25 0 40 14 74 7 88 10 74
|
6 |
+
1 45 11 60 6 8 5 29 8 32 7 42 12 25 9 4 2 71 14 79 13 93 3 28 0 30 4 17 10 43
|
7 |
+
11 84 2 56 12 46 1 93 14 66 0 84 6 40 9 4 3 15 13 15 7 54 10 39 4 77 5 55 8 31
|
8 |
+
14 65 7 91 11 17 0 47 12 77 8 68 9 62 10 22 3 72 13 47 4 38 1 7 2 11 6 22 5 63
|
9 |
+
7 12 4 21 13 60 5 42 14 22 11 84 2 60 12 52 6 25 1 53 0 53 10 56 9 29 3 83 8 32
|
10 |
+
7 48 4 28 14 70 10 26 3 68 0 4 13 19 8 92 1 24 2 54 6 57 12 47 11 84 9 85 5 95
|
11 |
+
2 36 12 34 10 65 3 64 6 30 5 41 14 53 9 74 13 44 4 13 0 41 11 6 7 32 8 94 1 37
|
12 |
+
11 62 9 9 3 89 7 37 6 28 4 23 0 13 2 60 5 46 1 94 10 85 8 72 13 18 12 79 14 11
|
13 |
+
0 74 4 61 1 43 9 26 2 97 11 62 13 40 10 60 7 62 6 78 8 42 12 8 14 21 3 11 5 70
|
14 |
+
6 9 0 22 4 9 10 8 2 54 14 32 9 92 13 76 11 2 12 63 1 63 8 98 5 42 3 12 7 41
|
15 |
+
5 67 10 7 13 91 2 52 7 87 4 4 8 1 6 56 9 82 0 47 12 35 11 8 1 92 14 39 3 11
|
16 |
+
11 44 2 24 0 24 4 14 14 34 5 57 9 30 10 64 6 4 12 14 8 69 1 95 7 22 3 60 13 61
|
instances/ta05
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
15 15
|
2 |
+
12 40 1 96 4 59 9 95 13 76 0 75 11 23 8 65 3 65 5 16 6 71 14 52 10 84 2 99 7 24
|
3 |
+
5 2 1 88 14 99 10 52 13 68 9 13 6 38 12 35 8 57 2 37 7 93 0 38 3 68 4 94 11 71
|
4 |
+
6 87 3 46 10 14 7 87 13 30 4 79 5 62 9 37 8 54 2 1 0 97 1 16 11 2 14 51 12 96
|
5 |
+
10 19 7 15 5 42 0 8 9 72 13 15 2 76 8 25 1 78 14 84 11 62 3 70 12 81 6 16 4 97
|
6 |
+
6 68 12 71 14 3 1 68 7 91 5 37 11 73 0 21 2 85 3 79 8 51 13 50 4 21 9 30 10 64
|
7 |
+
4 14 7 1 6 29 0 72 8 6 13 31 12 98 14 50 3 83 2 2 5 86 9 33 10 33 1 98 11 59
|
8 |
+
10 21 11 80 6 99 9 70 0 80 2 71 1 47 8 96 12 56 7 78 5 53 3 10 13 92 14 1 4 33
|
9 |
+
3 29 10 85 5 89 6 10 8 30 4 38 0 38 14 48 2 16 7 65 9 90 11 73 12 88 1 46 13 47
|
10 |
+
1 37 2 9 6 49 7 23 10 1 12 78 14 39 8 15 0 9 3 41 13 35 5 83 4 8 9 61 11 60
|
11 |
+
12 1 7 73 6 47 14 46 3 10 4 37 0 60 13 84 10 26 8 11 11 37 9 79 5 75 2 49 1 51
|
12 |
+
4 22 3 49 8 33 14 2 2 24 13 3 5 73 6 68 10 21 12 61 7 69 11 94 1 43 9 39 0 48
|
13 |
+
6 81 12 46 7 21 5 23 2 86 4 19 13 64 11 52 8 22 0 50 10 11 3 73 1 77 9 16 14 75
|
14 |
+
12 21 13 80 8 30 7 32 1 22 6 23 0 85 5 92 9 14 10 13 4 68 2 60 14 45 3 32 11 90
|
15 |
+
12 29 1 95 4 52 8 59 6 33 10 12 7 73 3 96 0 75 5 12 13 83 2 3 9 90 14 57 11 6
|
16 |
+
7 94 5 18 0 54 10 42 2 70 3 29 9 43 6 50 11 75 8 70 1 40 4 48 14 1 12 27 13 12
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
job-shop-cp-env==1.0.0
|
2 |
+
ray[default]~=1.5.0
|
3 |
+
ray[rllib]~=1.5.0
|
4 |
+
stable-baselines3==1.6.2
|
5 |
+
plotly==5.11.0
|