Skip to content

Commit

Permalink
Update d-o dependency
Browse files Browse the repository at this point in the history
- make it mandatory as we use it for hyperparameters management in core
- update to 0.4.0
- update doc as minizinc install in now optional for d-o (only needed if
  running minizinc-based solvers)
- update workflow as DO_SKIP_MZN_CHECK is not needed anymore
- make binder env use minzinc 2.8.5 (>=2.8 as needed by d-o)
  • Loading branch information
nhuet committed Oct 3, 2024
1 parent 1ba6adf commit 9fa8b25
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 45 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ jobs:
run: |
yarn global add vuepress && yarn install
export NODE_OPTIONS=--openssl-legacy-provider # avoid issue with node 18 and current dependencies (ok because no interaction with external network during the build)
export DO_SKIP_MZN_CHECK=1 # avoid having to install minizinc for discrete-optimization
yarn docs:build
touch docs/.vuepress/dist/.nojekyll
- name: upload as artifact
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,6 @@ jobs:
uses: ./.github/workflows/build-doc.yml
with:
notebooks-branch: ${{ needs.update-notebooks-for-colab-and-binder.outputs.notebooks-branch }}
doc-prerequisites-cmdline: export DO_SKIP_MZN_CHECK=1

deploy:
needs: [ trigger, test-ubuntu, test-macos, test-windows ]
Expand Down
2 changes: 1 addition & 1 deletion binder/postBuild
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ls
# install minizinc
mkdir minizinc_install
cd minizinc_install
curl -o minizinc.AppImage -L https://github.com/MiniZinc/MiniZincIDE/releases/download/2.6.3/MiniZincIDE-2.6.3-x86_64.AppImage
curl -o minizinc.AppImage -L https://github.com/MiniZinc/MiniZincIDE/releases/download/2.8.5/MiniZincIDE-2.8.5-x86_64.AppImage
chmod +x minizinc.AppImage
./minizinc.AppImage --appimage-extract
cd ..
Expand Down
5 changes: 3 additions & 2 deletions docs/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ This guide is organized as follows:

## Setting up your development environment

### Prerequisite: minizinc
### Prerequisite: minizinc (optional)

You need first to install [minizinc](https://www.minizinc.org/) (version greater than 2.6) and update the `PATH` environment variable
If you plan to use wrapped [discrete-optimization](https://github.com/airbus/discrete-optimization) solvers based on [minizinc](https://www.minizinc.org/),
you need first to install minizinc binary (version greater than 2.8) and update the `PATH` environment variable
so that it can be found by Python. See [minizinc documentation](https://www.minizinc.org/doc-latest/en/installation.html) for more details.

### Installing from source in developer mode
Expand Down
29 changes: 9 additions & 20 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

## Prerequisites

### Minizinc 2.6+
### Minizinc 2.8+ (Optional)

You need to install [minizinc](https://www.minizinc.org/) (version greater than 2.6) and update the `PATH` environment variable
If you plan to use the solver for scheduling domains `DOSolver`
that wraps [discrete-optimization](https://github.com/airbus/discrete-optimization) solvers,
keep in mind that some of them are based on [minizinc](https://www.minizinc.org/).
In that case, you may need to install minizinc binary (version greater than 2.8) and update the `PATH` environment variable
so that it can be found by Python. See [minizinc documentation](https://www.minizinc.org/doc-latest/en/installation.html) for more details.

::: tip
Expand All @@ -20,7 +23,7 @@ On a Linux distribution, you can use the bundled [minizinc AppImage](https://www
If [FUSE](https://en.wikipedia.org/wiki/Filesystem_in_Userspace) is available:
```
mkdir minizinc_install
curl -o minizinc_install/minizinc -L https://github.com/MiniZinc/MiniZincIDE/releases/download/2.6.3/MiniZincIDE-2.6.3-x86_64.AppImage
curl -o minizinc_install/minizinc -L https://github.com/MiniZinc/MiniZincIDE/releases/download/2.8.5/MiniZincIDE-2.8.5-x86_64.AppImage
chmod +x minizinc_install/minizinc
export PATH="$(pwd)/minizinc_install/":$PATH
minizinc --version
Expand All @@ -29,7 +32,7 @@ Else, this is still possible by extracting the files:
```
mkdir minizinc_install
cd minizinc_install
curl -o minizinc.AppImage -L https://github.com/MiniZinc/MiniZincIDE/releases/download/2.6.3/MiniZincIDE-2.6.3-x86_64.AppImage
curl -o minizinc.AppImage -L https://github.com/MiniZinc/MiniZincIDE/releases/download/2.8.5/MiniZincIDE-2.8.5-x86_64.AppImage
chmod +x minizinc.AppImage
./minizinc.AppImage --appimage-extract
cd ..
Expand All @@ -41,7 +44,7 @@ minizinc --version
#### MacOs command line
```
mkdir minizinc_install
curl -o minizinc.dmg -L https://github.com/MiniZinc/MiniZincIDE/releases/download/2.6.3/MiniZincIDE-2.6.3-bundled.dmg
curl -o minizinc.dmg -L https://github.com/MiniZinc/MiniZincIDE/releases/download/2.8.5/MiniZincIDE-2.8.5-bundled.dmg
hdiutil attach minizinc.dmg
cp -R /Volumes/MiniZinc*/MiniZincIDE.app minizinc_install/.
export PATH="$(pwd)/minizinc_install/MiniZincIDE.app/Contents/Resources":$PATH
Expand All @@ -52,26 +55,12 @@ minizinc --version
Works on Windows Server 2022 with bash shell:
```
mkdir minizinc_install
curl -o minizinc_setup.exe -L https://github.com/MiniZinc/MiniZincIDE/releases/download/2.6.3/MiniZincIDE-2.6.3-bundled-setup-win64.exe
curl -o minizinc_setup.exe -L https://github.com/MiniZinc/MiniZincIDE/releases/download/2.8.5/MiniZincIDE-2.8.5-bundled-setup-win64.exe
cmd //c "minizinc_setup.exe /verysilent /currentuser /norestart /suppressmsgboxes /sp"
export PATH="~/AppData/Local/Programs/MiniZinc":$PATH
minizinc --version
```

#### Skipping minizinc version check

It may happen that you do not want to install minzinc.
For instance if you need to use only a part of the library which is not relying on minizinc at all,
especially when not relying on discrete-optimization which is the actual library depending on minizinc.

This can be troublesome as the minizinc binary version is checked by [discrete-optimization](https://airbus.github.io/discrete-optimization) at library import.
However discrete-optimization provides a way to bypass this check
by setting the environment variable DO_SKIP_MZN_CHECK:
```shell
export DO_SKIP_MZN_CHECK=1
```
Please note however that the library is never tested without minizinc (or minizinc versions < 2.6).


### Python 3.8+ environment

Expand Down
20 changes: 4 additions & 16 deletions notebooks/13_scheduling_tuto.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,6 @@
"metadata": {},
"outputs": [],
"source": [
"from discrete_optimization.generic_tools.cp_tools import ParametersCP\n",
"\n",
"from skdecide.hub.solver.do_solver.do_solver_scheduling import DOSolver, SolvingMethod\n",
"from skdecide.hub.solver.do_solver.sgs_policies import (\n",
" BasePolicyMethod,\n",
Expand All @@ -716,10 +714,6 @@
"outputs": [],
"source": [
"logging.info(\"Solving with CP\")\n",
"dict_params = {}\n",
"params_cp = ParametersCP.default()\n",
"params_cp.TimeLimit = 300\n",
"dict_params[\"parameters_cp\"] = params_cp\n",
"policy_method_params = PolicyMethodParams(\n",
" base_policy_method=BasePolicyMethod.FOLLOW_GANTT,\n",
" delta_index_freedom=0,\n",
Expand Down Expand Up @@ -934,10 +928,8 @@
"method = SolvingMethod.CP\n",
"# Let's define the parameters for our CP solver\n",
"dict_params = {}\n",
"params_cp = ParametersCP.default()\n",
"# Let's change the 30 seconds default to something bigger\n",
"params_cp.time_limit = 300\n",
"dict_params[\"parameters_cp\"] = params_cp\n",
"# Let's change the default 30 seconds time limit to something bigger\n",
"dict_params[\"time_limit\"] = 300\n",
"# Let's create our solver with the given feature\n",
"solver = DOSolver(\n",
" domain_factory=lambda: big_domain,\n",
Expand Down Expand Up @@ -984,12 +976,8 @@
"\n",
"dict_params = {}\n",
"\n",
"# We will use the default TimeLimit value for the internal CP solver\n",
"# This value is 30 seconds\n",
"params_cp = ParametersCP.default()\n",
"params_cp.time_limit = 30\n",
"\n",
"dict_params[\"parameters_cp\"] = params_cp\n",
"# We will use 30 seconds as time limit for the internal CP solver\n",
"dict_params[\"time_limit_subsolver\"] = 30\n",
"dict_params[\"nb_iteration_lns\"] = 30\n",
"dict_params[\"verbose\"] = False\n",
"dict_params[\"callbacks\"] = [TimerStopper(total_seconds=300)]\n",
Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ matplotlib = { version = ">=3.3.4", optional = true }
joblib = { version = ">=1.0.1", optional = true }
stable-baselines3 = { version = ">=2.0.0", optional = true }
ray = { extras = ["rllib"], version = ">=2.9.0", optional = true }
discrete-optimization = { version = ">=0.3.2", optional = true }
discrete-optimization = { version = ">=0.4.0" }
openap = { version = ">=1.5", python = ">=3.9", optional = true }
pygeodesy = { version = ">=23.6.12", optional = true }
unified-planning = { version = ">=1.1.0", python = ">=3.10", optional = true }
Expand All @@ -79,7 +79,6 @@ domains = [
"gymnasium",
"numpy",
"matplotlib",
"discrete-optimization",
"openap",
"pygeodesy",
"unified-planning",
Expand All @@ -93,7 +92,6 @@ solvers = [
"joblib",
"ray",
"stable-baselines3",
"discrete-optimization",
"unified-planning",
"up-tamer",
"up-fast-downward",
Expand All @@ -108,7 +106,6 @@ all = [
"joblib",
"ray",
"stable-baselines3",
"discrete-optimization",
"openap",
"pygeodesy",
"unified-planning",
Expand Down

0 comments on commit 9fa8b25

Please sign in to comment.