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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
app.py
CHANGED
|
@@ -50,7 +50,7 @@ def solve(file):
|
|
| 50 |
random.seed(0)
|
| 51 |
np.random.seed(0)
|
| 52 |
torch.manual_seed(0)
|
| 53 |
-
num_workers =
|
| 54 |
with torch.inference_mode():
|
| 55 |
device = torch.device('cpu')
|
| 56 |
actor = torch.jit.load('actor.pt', map_location=device)
|
|
@@ -137,9 +137,8 @@ def solve(file):
|
|
| 137 |
visu.sequence(name=f'M{machine_id}',
|
| 138 |
intervals=machine_solution[machine_id])
|
| 139 |
#plt.rcParams["font.family"] = "Times New Roman"
|
| 140 |
-
plt.rcParams["font.size"] = "30"
|
| 141 |
-
plt.gca().set_aspect('equal')
|
| 142 |
-
plt.rcParams["figure.figsize"] = (45, 50)
|
| 143 |
from io import BytesIO
|
| 144 |
buffer = BytesIO()
|
| 145 |
|
|
@@ -152,8 +151,10 @@ ray.init(log_to_driver=False,
|
|
| 152 |
include_dashboard=False)
|
| 153 |
title = "Job-Shop Scheduling CP RL"
|
| 154 |
description = "A Job-Shop Scheduling Reinforcement Learning based solver, using an underlying CP model as an " \
|
| 155 |
-
"environment.
|
| 156 |
-
"However, due to ressource limitations on the HuggingFace platform, the result you obtain here might not be optimal."
|
|
|
|
|
|
|
| 157 |
article = "<p style='text-align: center'>Article Under Review</p>"
|
| 158 |
examples = ['ta01', 'dmu01.txt', 'la01.txt']
|
| 159 |
iface = gr.Interface(fn=solve, inputs=gr.File(label="Instance File"), outputs=[gr.Text(label="Solution"), gr.Image(label="Solution's Gantt Chart"), gr.Text(label="Elapsed Time")], title=title, description=description, article=article, examples=examples)
|
|
|
|
| 50 |
random.seed(0)
|
| 51 |
np.random.seed(0)
|
| 52 |
torch.manual_seed(0)
|
| 53 |
+
num_workers = 2 # only one CPU available
|
| 54 |
with torch.inference_mode():
|
| 55 |
device = torch.device('cpu')
|
| 56 |
actor = torch.jit.load('actor.pt', map_location=device)
|
|
|
|
| 137 |
visu.sequence(name=f'M{machine_id}',
|
| 138 |
intervals=machine_solution[machine_id])
|
| 139 |
#plt.rcParams["font.family"] = "Times New Roman"
|
| 140 |
+
#plt.rcParams["font.size"] = "30"
|
| 141 |
+
#plt.gca().set_aspect('equal')
|
|
|
|
| 142 |
from io import BytesIO
|
| 143 |
buffer = BytesIO()
|
| 144 |
|
|
|
|
| 151 |
include_dashboard=False)
|
| 152 |
title = "Job-Shop Scheduling CP RL"
|
| 153 |
description = "A Job-Shop Scheduling Reinforcement Learning based solver, using an underlying CP model as an " \
|
| 154 |
+
"environment. <br>" \
|
| 155 |
+
"However, due to ressource limitations on the HuggingFace platform, the result you obtain here might not be optimal. <br>" \
|
| 156 |
+
"For large instance, we recommand to run this localy outside the interface as it causes a lot of overhead." \
|
| 157 |
+
|
| 158 |
article = "<p style='text-align: center'>Article Under Review</p>"
|
| 159 |
examples = ['ta01', 'dmu01.txt', 'la01.txt']
|
| 160 |
iface = gr.Interface(fn=solve, inputs=gr.File(label="Instance File"), outputs=[gr.Text(label="Solution"), gr.Image(label="Solution's Gantt Chart"), gr.Text(label="Elapsed Time")], title=title, description=description, article=article, examples=examples)
|