diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a09d235..523730f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,14 @@ this project adheres to `Semantic Versioning `_. Unreleased_ ------------ + +Added +^^^^^ + +- Add the ``Instance.diverse_solutions`` method to use the MiniZinc + experimental feature to model diversity and try and find a set of diverse + solutions for the given problem. + Removed ^^^^^^^ @@ -35,6 +43,8 @@ Fixed - Fix problem where some exceptions when creating processes where hidden and would then cause errors where the ``proc`` variable did not exist. +- Fix issue where MiniZinc would not correctly be terminated on Windows when + the Python process was interrupted. 0.9.0_ - 2023-04-04 ------------------- @@ -88,7 +98,7 @@ Removed - **BREAKING:** The project no longer contains the (uncompleted) direct library connection to libminizinc. With this change come some simplications in methods of relocated from ``CLIDriver`` and ``CLIInstance``, and the move of ``find_driver`` to - ``Driver.find``. + ``Driver.find``. Fixed ^^^^^ @@ -107,7 +117,7 @@ Added Fixed ^^^^^ -- Do not raise error about unsupported solver flags when MiniZinc driver would +- Do not raise error about unsupported solver flags when MiniZinc driver would not raise an error. - Fix warnings caused by unterminated coroutines when using the asynchronous iterators diff --git a/src/minizinc/instance.py b/src/minizinc/instance.py index 3584452..7031716 100644 --- a/src/minizinc/instance.py +++ b/src/minizinc/instance.py @@ -661,9 +661,11 @@ async def solutions( # an unexpected Python exception occurred # First, terminate the process if sys.platform == "win32": - import signal - - proc.send_signal(signal.CTRL_C_EVENT) + with open( + f"\\\\.\\pipe\\minizinc-{proc.pid}", mode="w" + ) as named_pipe: + # Trigger MiniZinc termination + named_pipe.write("") else: proc.terminate() _ = await proc.wait()