{ "info": { "author": "Guido Tack", "author_email": "guido.tack@monash.edu", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Scientific/Engineering :: Mathematics" ], "description": "==========================\nIPython MiniZinc extension\n==========================\n\n:author: Guido Tack \n:homepage: https://github.com/minizinc/iminizinc\n\nThis module provides a cell magic extension for IPython / Jupyter notebooks that lets you solve MiniZinc models.\n\nThe module requires an existing installation of MiniZinc.\n\nInstallation\n============\n\nYou can install or upgrade this module via pip\n\n pip install -U iminizinc\n\nConsult your Python documentation to find out if you need any extra options (e.g. you may want to use the --user flag to install only for the current user, or you may want to use virtual environments).\n\nMake sure that the ``mzn2fzn`` binary as well as solver binaries (currently only ``fzn-gecode`` and ``mzn-cbc`` are supported) are on the PATH when you start the notebook server. The easiest way to do that is to get the \"bundled installation\" that includes the MiniZinc IDE and a few solvers, available from GitHub here: https://github.com/MiniZinc/MiniZincIDE/releases/latest\nYou then need to change your PATH environment variable to include the MiniZinc installation.\n\nBasic usage\n===========\n\nAfter installing the module, you have to load the extension using ``%load_ext iminizinc``. This will enable the cell magic ``%%minizinc``, which lets you solve MiniZinc models. Here is a simple example:\n\n.. code::\n\n In[1]: %load_ext iminizinc\n\n In[2]: n=8\n\n In[3]: %%minizinc\n\n include \"globals.mzn\";\n int: n;\n array[1..n] of var 1..n: queens;\n constraint all_different(queens);\n constraint all_different([queens[i]+i | i in 1..n]);\n constraint all_different([queens[i]-i | i in 1..n]);\n solve satisfy;\n Out[3]: {u'queens': [4, 2, 7, 3, 6, 8, 5, 1]}\n\nAs you can see, the model binds variables in the environment (in this case, ``n``) to MiniZinc parameters, and returns an object with fields for all declared decision variables.\n\nAlternatively, you can bind the decision variables to Python variables:\n\n.. code::\n\n In[1]: %load_ext iminizinc\n\n In[2]: n=8\n\n In[3]: %%minizinc -m bind\n\n include \"globals.mzn\";\n int: n;\n array[1..n] of var 1..n: queens;\n constraint all_different(queens);\n constraint all_different([queens[i]+i | i in 1..n]);\n constraint all_different([queens[i]-i | i in 1..n]);\n solve satisfy;\n\n In[4]: queens\n\n Out[4]: [4, 2, 7, 3, 6, 8, 5, 1]\n\nIf you want to find all solutions of a satisfaction problem, or all intermediate solutions of an optimisation problem, you can use the ``-a`` flag:\n\n.. code::\n\n In[1]: %load_ext iminizinc\n\n In[2]: n=6\n\n In[3]: %%minizinc -a\n\n include \"globals.mzn\";\n int: n;\n array[1..n] of var 1..n: queens;\n constraint all_different(queens);\n constraint all_different([queens[i]+i | i in 1..n]);\n constraint all_different([queens[i]-i | i in 1..n]);\n solve satisfy;\n\n Out[3]: [{u'queens': [5, 3, 1, 6, 4, 2]},\n {u'queens': [4, 1, 5, 2, 6, 3]},\n {u'queens': [3, 6, 2, 5, 1, 4]},\n {u'queens': [2, 4, 6, 1, 3, 5]}]\n\nYou can also store your model to use the model iteratively:\n\n.. code::\n\n In[1]: %load_ext iminizinc\n\n In[2]: %%mzn_model queens\n\n include \"globals.mzn\";\n int: n;\n array[1..n] of var 1..n: queens;\n constraint all_different(queens);\n constraint all_different([queens[i]+i | i in 1..n]);\n constraint all_different([queens[i]-i | i in 1..n]);\n solve satisfy;\n\n In[3]: for n in range(5,9):\n x = %minizinc queens\n print(x)\n\n Out[3]: {'queens': [4, 2, 5, 3, 1]}\n {'queens': [5, 3, 1, 6, 4, 2]}\n {'queens': [6, 4, 2, 7, 5, 3, 1]}\n {'queens': [4, 2, 7, 3, 6, 8, 5, 1]}\n\nThe magic supports a number of additional options, in particular loading MiniZinc models and data from files. Some of these may only work with the development version of MiniZinc (i.e., not the one that comes with the bundled binary releases). You can take a look at the help using\n\n.. code::\n\n In[1]: %%minizinc?\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "minizinc ipython", "license": "", "maintainer": "", "maintainer_email": "", "name": "iminizinc", "package_url": "https://pypi.org/project/iminizinc/", "platform": "", "project_url": "https://pypi.org/project/iminizinc/", "project_urls": { "Source": "https://github.com/MiniZinc/iminizinc/", "Tracker": "https://github.com/MiniZinc/iminizinc/issues" }, "release_url": "https://pypi.org/project/iminizinc/0.4/", "requires_dist": [ "ipython" ], "requires_python": "", "summary": "IPython extensions for the MiniZinc constraint modelling language", "version": "0.4" }, "last_serial": 4247350, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "ba8a1269cd9b6df52d211e240708c498", "sha256": "2a79155eaf0e4dd6c64ff84132482c8b4bb1eaa23466e53c364c0f124fd6ab91" }, "downloads": -1, "filename": "iminizinc-0.1.tar.gz", "has_sig": false, "md5_digest": "ba8a1269cd9b6df52d211e240708c498", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10234, "upload_time": "2018-03-11T01:03:18", "url": "https://files.pythonhosted.org/packages/9f/47/46250ba0789719aeb76ed9e24cbf5df67fd9cd74acdd02008d7d0d9e933b/iminizinc-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "980bac5a948756f4b6ac5aad04b70d0e", "sha256": "efb6b9df4c1b25c14348b713f653d251caee012d611685e529ea7f59ba1fbccb" }, "downloads": -1, "filename": "iminizinc-0.2.tar.gz", "has_sig": false, "md5_digest": "980bac5a948756f4b6ac5aad04b70d0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11226, "upload_time": "2018-03-11T03:04:14", "url": "https://files.pythonhosted.org/packages/ec/d5/e4ce8c4d25e0e925af25d7dd38d7079ec7d3917341ca989e238fc1513787/iminizinc-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "7eb931306eaffa56ae7c5959cac67d9b", "sha256": "e6f2c6608ec67b09d643441721559dd1784cf0c9b3222dd189d46ba188a09e6e" }, "downloads": -1, "filename": "iminizinc-0.3.tar.gz", "has_sig": false, "md5_digest": "7eb931306eaffa56ae7c5959cac67d9b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11463, "upload_time": "2018-03-12T04:36:18", "url": "https://files.pythonhosted.org/packages/5c/36/4cca19de8e091873c449af6496ff971c68f53963ba0dff8309a5134f59d9/iminizinc-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "1054ff595227ea85d10b9a584b1add7a", "sha256": "38c77bda643550d4b2f4443aadd9136a50ae2755e16aeb97f0a7dd0ee6cf3527" }, "downloads": -1, "filename": "iminizinc-0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1054ff595227ea85d10b9a584b1add7a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6842, "upload_time": "2018-09-07T06:33:00", "url": "https://files.pythonhosted.org/packages/7e/09/f4e5e7de0f88a6b98964f6ed823640f036235eff3b0ef42e738ae9fd307c/iminizinc-0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3993f56dd9ec9987b3a71fc66eeab5ca", "sha256": "9ecbd6e486a24dbbcc4d505a752bb4e87f2ce712f41af68ad29affe38ec066cd" }, "downloads": -1, "filename": "iminizinc-0.4.tar.gz", "has_sig": false, "md5_digest": "3993f56dd9ec9987b3a71fc66eeab5ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12028, "upload_time": "2018-09-07T06:33:01", "url": "https://files.pythonhosted.org/packages/18/ff/d493b2252f80297f5d25158e907cc08d54de833f9e286bd462294dbd5c31/iminizinc-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1054ff595227ea85d10b9a584b1add7a", "sha256": "38c77bda643550d4b2f4443aadd9136a50ae2755e16aeb97f0a7dd0ee6cf3527" }, "downloads": -1, "filename": "iminizinc-0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1054ff595227ea85d10b9a584b1add7a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6842, "upload_time": "2018-09-07T06:33:00", "url": "https://files.pythonhosted.org/packages/7e/09/f4e5e7de0f88a6b98964f6ed823640f036235eff3b0ef42e738ae9fd307c/iminizinc-0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3993f56dd9ec9987b3a71fc66eeab5ca", "sha256": "9ecbd6e486a24dbbcc4d505a752bb4e87f2ce712f41af68ad29affe38ec066cd" }, "downloads": -1, "filename": "iminizinc-0.4.tar.gz", "has_sig": false, "md5_digest": "3993f56dd9ec9987b3a71fc66eeab5ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12028, "upload_time": "2018-09-07T06:33:01", "url": "https://files.pythonhosted.org/packages/18/ff/d493b2252f80297f5d25158e907cc08d54de833f9e286bd462294dbd5c31/iminizinc-0.4.tar.gz" } ] }