{ "info": { "author": "Mate Soos", "author_email": "soos.mate@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: C++", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Topic :: Utilities" ], "description": "===========================================\npycryptosat: bindings to the CryptoMiniSat SAT solver\n===========================================\n\nThis directory provides Python bindings to CryptoMiniSat on the C++ level,\ni.e. when importing pycryptosat, the CryptoMiniSat solver becomes part of the\nPython process itself.\n\nCompiling\n-----\nThe pycryptosat python package compiles while compiling CryptoMiniSat. It\ncannotbe compiled on its own, it must be compiled at the same time as\nCryptoMiniSat. You will need the python development libraries in order to\ncompile:\n\n```\napt-get install python-dev\n```\n\nAfter this, cmake then indicate that pycryptosat will be compiled:\n\n```\ncd cryptominisat\nmkdir build\ncd build\ncmake ..\n[...]\n-- Found PythonInterp: /usr/bin/python2.7 (found suitable version \"2.7.9\", minimum required is \"2.7\")\n-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found suitable version \"2.7.9\", minimum required is \"2.7\")\n-- PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python2.7\n-- PYTHON_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libpython2.7.so\n-- PYTHON_INCLUDE_DIR:FILEPATH=/usr/include/python2.7\n-- PYTHONLIBS_VERSION_STRING=2.7.9\n-- OK, found python interpreter, libs and header files\n-- Building python interface\n[...]\n```\n\nIt will then generate the pycryptosat library and install it when calling\n`make install`.\n\nUsage\n-----\n\nThe ``pycryptosat`` module has one object, ``Solver`` that has two functions\n``solve`` and ``add_clause``.\n\nThe funcion ``add_clause()`` takes an iterable list of literals such as\n``[1, 2]`` which represents the truth ``1 or 2 = True``. For example,\n``add_clause([1])`` sets variable ``1`` to ``True``.\n\nThe function ``solve()`` solves the system of equations that have been added\nwith ``add_clause()``:\n\n >>> from pycryptosat import Solver\n >>> s = Solver()\n >>> s.add_clause([1, 2])\n >>> sat, solution = s.solve()\n >>> print sat\n True\n >>> print solution\n (None, True, True)\n\nThe return value is a tuple. First part of the tuple indicates whether the\nproblem is satisfiable. In this case, it's ``True``, i.e. satisfiable. The second\npart is a tuple contains the solution, preceded by None, so you can index into\nit with the variable number. E.g. ``solution[1]`` returns the value for\nvariabe ``1``.\n\nThe ``solve()`` method optionally takes an argument ``assumptions`` that\nallows the user to set values to specific variables in the solver in a temporary\nfashion. This means that in case the problem is satisfiable but e.g it's\nunsatisfiable if variable 2 is FALSE, then ``solve([-2])`` will return\nUNSAT. However, a subsequent call to ``solve()`` will still return a solution.\nIf instead of an assumption ``add_clause()`` would have been used, subsequent\n``solve()`` calls would have returned unsatisfiable.\n\n``Solver`` takes the following keyword arguments:\n * ``confl_limit``: the propagation limit (integer)\n * ``verbose``: the verbosity level (integer)\n\nThe ``confl_limit`` argument sets a kind of time-out limit to the solver. If\nthe solver runs out of time, it returns with ``(None, None)``.\n\nExample\n-------\n\nLet us consider the following clauses, represented using\nthe DIMACS `cnf `_\nformat::\n\n p cnf 5 3\n 1 -5 4 0\n -1 5 3 4 0\n -3 -4 0\n\nHere, we have 5 variables and 3 clauses, the first clause being\n(x\\ :sub:`1` or not x\\ :sub:`5` or x\\ :sub:`4`).\nNote that the variable x\\ :sub:`2` is not used in any of the clauses,\nwhich means that for each solution with x\\ :sub:`2` = True, we must\nalso have a solution with x\\ :sub:`2` = False. In Python, each clause is\nmost conveniently represented as a list of integers. Naturally, it makes\nsense to represent each solution also as a list of integers, where the sign\ncorresponds to the Boolean value (+ for True and - for False) and the\nabsolute value corresponds to i\\ :sup:`th` variable::\n\n >>> import pycryptosat\n >>> solver = pycryptosat.Solver()\n >>> solver.add_clause([1, -5, 4])\n >>> solver.add_clause([-1, 5, 3, 4])\n >>> solver.add_clause([-3, -4])\n >>> solver.solve()\n (True, (None, True, False, False, True, True))\n\nThis solution translates to: x\\ :sub:`1` = x\\ :sub:`4` = x\\ :sub:`5` = True,\nx\\ :sub:`2` = x\\ :sub:`3` = False", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/msoos/cryptominisat", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pycryptosat", "package_url": "https://pypi.org/project/pycryptosat/", "platform": "", "project_url": "https://pypi.org/project/pycryptosat/", "project_urls": { "Homepage": "https://github.com/msoos/cryptominisat" }, "release_url": "https://pypi.org/project/pycryptosat/0.1.4/", "requires_dist": null, "requires_python": "", "summary": "Bindings to CryptoMiniSat 5.0.1 (a SAT solver)", "version": "0.1.4" }, "last_serial": 3247392, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "1c0a6c9c71ab96abecab8f3f0ff77c5e", "sha256": "7ede0badf25f1e52eb6db8dcde360b138395ad26497d44a62ce02cb19ca7574f" }, "downloads": -1, "filename": "pycryptosat-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1c0a6c9c71ab96abecab8f3f0ff77c5e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 296451, "upload_time": "2017-08-30T20:45:50", "url": "https://files.pythonhosted.org/packages/7a/b1/b9acf78cb43777e5492f7ee3c98da1169160be9ea719c5ab9f2668d3ff03/pycryptosat-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "8b2616561e7825405d51ed6a7030c62b", "sha256": "1a832b41f068407faa1b46fb4ca0c74065765abdb4b976f531870e58e51dbe00" }, "downloads": -1, "filename": "pycryptosat-0.1.3.tar.gz", "has_sig": false, "md5_digest": "8b2616561e7825405d51ed6a7030c62b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 297705, "upload_time": "2017-09-21T15:04:55", "url": "https://files.pythonhosted.org/packages/41/d8/12296be268fbe7896f5c207af622b53545c36f854ccfe91d5fe7a6d9e105/pycryptosat-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "4536cfe0d94bf698f2afd8b786d5375b", "sha256": "8d66005f7ca5021e78cbf2c23d406e6c913719d52da8308d3f8ed863ea7267e4" }, "downloads": -1, "filename": "pycryptosat-0.1.4.tar.gz", "has_sig": false, "md5_digest": "4536cfe0d94bf698f2afd8b786d5375b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 297684, "upload_time": "2017-10-13T09:20:32", "url": "https://files.pythonhosted.org/packages/28/1a/4012efa6207d1fca05e0b462b583920ce9a16088dcced52c22bfb98bb530/pycryptosat-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4536cfe0d94bf698f2afd8b786d5375b", "sha256": "8d66005f7ca5021e78cbf2c23d406e6c913719d52da8308d3f8ed863ea7267e4" }, "downloads": -1, "filename": "pycryptosat-0.1.4.tar.gz", "has_sig": false, "md5_digest": "4536cfe0d94bf698f2afd8b786d5375b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 297684, "upload_time": "2017-10-13T09:20:32", "url": "https://files.pythonhosted.org/packages/28/1a/4012efa6207d1fca05e0b462b583920ce9a16088dcced52c22bfb98bb530/pycryptosat-0.1.4.tar.gz" } ] }