diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c35d2ccbd9..04207fef4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,8 +75,8 @@ jobs: run: | from os import environ - python_version_build = ["3.9", "3.10", "3.11"] - python_version_test = ["3.9", "3.11"] + python_version_build = ["3.9", "3.10", "3.11", "3.12"] + python_version_test = ["3.9", "3.12"] test = ["macos-12", "macos-latest", "ubuntu-latest", "windows-latest"] build_doc = "true" @@ -87,6 +87,7 @@ jobs: to_bool = lambda s: True if s == "true" else False python_filter = { '3.11': to_bool("${{ contains(github.event.head_commit.message, '[ci: python-3.11]') }}"), + '3.12': to_bool("${{ contains(github.event.head_commit.message, '[ci: python-3.12]') }}"), '3.9': to_bool("${{ contains(github.event.head_commit.message, '[ci: python-3.9]') }}"), '3.10': to_bool("${{ contains(github.event.head_commit.message, '[ci: python-3.10]') }}"), } @@ -509,7 +510,7 @@ jobs: env: minizinc_config_cmdline: export PATH=$PATH:~/AppData/Local/Programs/MiniZinc minizinc_cache_path: ~/AppData/Local/Programs/MiniZinc - minizinc_url: https://github.com/MiniZinc/MiniZincIDE/releases/download/2.6.3/MiniZincIDE-2.6.3-bundled-setup-win64.exe + minizinc_url: https://github.com/MiniZinc/MiniZincIDE/releases/download/2.8.5/MiniZincIDE-2.8.5-bundled-setup-win64.exe minizinc_downloaded_filepath: minizinc_setup.exe minizinc_install_cmdline: cmd //c "minizinc_setup.exe /verysilent /currentuser /norestart /suppressmsgboxes /sp" @@ -562,7 +563,11 @@ jobs: pip install ray[rllib]>=2.20 python_version=${{ matrix.python-version }} wheelfile=$(ls ./wheels/scikit_decide*-cp${python_version/\./}-*win*.whl) - pip install ${wheelfile}[all] pytest gymnasium[classic-control] optuna + if [ "$python_version" = "3.12" ]; then + pip install ${wheelfile}[all] pytest "pygame>=2.5" optuna "cffi>=1.17" + else + pip install ${wheelfile}[all] pytest gymnasium[classic-control] optuna + fi - name: Test with pytest run: | @@ -594,7 +599,7 @@ jobs: env: minizinc_config_cmdline: export PATH=$PATH:$(pwd)/bin/MiniZincIDE.app/Contents/Resources minizinc_cache_path: $(pwd)/bin/MiniZincIDE.app - minizinc_url: https://github.com/MiniZinc/MiniZincIDE/releases/download/2.6.3/MiniZincIDE-2.6.3-bundled.dmg + minizinc_url: https://github.com/MiniZinc/MiniZincIDE/releases/download/2.8.5/MiniZincIDE-2.8.5-bundled.dmg minizinc_downloaded_filepath: bin/minizinc.dmg minizinc_install_cmdline: sudo hdiutil attach bin/minizinc.dmg; sudo cp -R /Volumes/MiniZinc*/MiniZincIDE.app bin/. @@ -656,7 +661,11 @@ jobs: python_version=${{ matrix.python-version }} arch=$(uname -m) wheelfile=$(ls ./wheels/scikit_decide*-cp${python_version/\./}-*macos*${arch}.whl) - pip install ${wheelfile}[all] pytest gymnasium[classic-control] optuna + if [ "$python_version" = "3.12" ]; then + pip install ${wheelfile}[all] pytest "pygame>=2.5" optuna "cffi>=1.17" + else + pip install ${wheelfile}[all] pytest gymnasium[classic-control] optuna + fi - name: Test with pytest run: | @@ -688,10 +697,10 @@ jobs: env: minizinc_config_cmdline: export PATH=$PATH:$(pwd)/bin/squashfs-root/usr/bin; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/bin/squashfs-root/usr/lib minizinc_cache_path: $(pwd)/bin/squashfs-root - minizinc_url: https://github.com/MiniZinc/MiniZincIDE/releases/download/2.6.3/MiniZincIDE-2.6.3-x86_64.AppImage + minizinc_url: https://github.com/MiniZinc/MiniZincIDE/releases/download/2.8.5/MiniZincIDE-2.8.5-x86_64.AppImage minizinc_downloaded_filepath: bin/minizinc.AppImage minizinc_install_cmdline: cd bin; sudo chmod +x minizinc.AppImage; sudo ./minizinc.AppImage --appimage-extract; cd .. - + minizinc_prerequisites_cmdline: sudo apt update && sudo apt install libegl1 -y steps: - uses: actions/checkout@v4 @@ -716,6 +725,10 @@ jobs: - name: Create bin/ run: mkdir -p bin + - name: Minizinc prerequisites + run: | + ${{ env.minizinc_prerequisites_cmdline }} + - name: get MininZinc path to cache id: get-mzn-cache-path run: | @@ -747,7 +760,11 @@ jobs: run: | python_version=${{ matrix.python-version }} wheelfile=$(ls ./wheels/scikit_decide*-cp${python_version/\./}-*manylinux*.whl) - pip install ${wheelfile}[all] pytest gymnasium[classic-control] docopt commonmark optuna + if [ "$python_version" = "3.12" ]; then + pip install ${wheelfile}[all] pytest "pygame>=2.5" "cffi>=1.17" docopt commonmark optuna + else + pip install ${wheelfile}[all] pytest gymnasium[classic-control] docopt commonmark optuna + fi - name: Test with pytest run: | diff --git a/pyproject.toml b/pyproject.toml index 1d7a541193..5e4d63d78f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,7 @@ discrete-optimization = { version = ">=0.3.2", optional = true } 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 } -up-tamer = { version = ">=1.1.2", python = ">=3.10", markers = "platform_machine == 'x86_64'", optional = true } +up-tamer = { version = ">=1.1.2", python = ">=3.10, <3.12", markers = "platform_machine == 'x86_64'", optional = true } up-fast-downward = { version = ">=0.4.1", python = ">=3.10", optional = true } up-enhsp = { version = ">=0.0.25", python = ">=3.10", optional = true } up-pyperplan = { version = ">=1.1.0", python = ">=3.10", optional = true } diff --git a/skdecide/hub/solver/cgp/pycgp/cgp.py b/skdecide/hub/solver/cgp/pycgp/cgp.py index e3f6ed0721..4a2f39c01a 100644 --- a/skdecide/hub/solver/cgp/pycgp/cgp.py +++ b/skdecide/hub/solver/cgp/pycgp/cgp.py @@ -176,14 +176,16 @@ def mutate_per_gene(self, mutation_rate_nodes, mutation_rate_outputs): # mutate connection self.genome[index] = rnd.randint( 0, - min( - self.max_graph_length + self.num_inputs - 1, - ( - self.num_inputs - + (int(index / (self.max_arity + 1)) - 1) - * self.num_rows + int( + min( + self.max_graph_length + self.num_inputs - 1, + ( + self.num_inputs + + (int(index / (self.max_arity + 1)) - 1) + * self.num_rows + ) + * self.recurrency_distance, ) - * self.recurrency_distance, ), ) # self.genome[index] = rnd.randint(0, self.num_inputs + (int(index / (self.max_arity + 1)) - 1) * self.num_rows)