{ "info": { "author": "Cristovao D. Sousa", "author_email": "crisjss@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Manufacturing", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "PyLMI-SDP\r\n =========\r\n \r\n *Symbolic linear matrix inequalities (LMI) and semi-definite programming\r\n (SDP) tools for Python*\r\n \r\n | This package includes a set of classes to represent and manipulate\r\n LMIs symbolically using `SymPy `__.\r\n | It also includes tools to export LMIs to\r\n `CVXOPT `__\r\n SDP input and to the `SDPA `__ format.\r\n \r\n | Depends on `SymPy `__ 0.7.3 and\r\n `NumPy `__ 1.7.1, and optionally on\r\n `CVXOPT `__.\r\n | Single codebase supporting both Python 2.7 and Python 3.3.\r\n | PyLMI-SDP is tested in these versions but it may work in others.\r\n \r\n |Build Status|\r\n \r\n LMI Definition\r\n --------------\r\n \r\n Examples\r\n ~~~~~~~~\r\n \r\n .. code:: Python\r\n \r\n >>> from sympy import symbols, Matrix\r\n >>> from lmi_sdp import LMI_PD, LMI_NSD\r\n >>> variables = symbols('x y z')\r\n >>> x, y, z = variables\r\n >>> lmi = LMI_PD(Matrix([[x+1, y+2], [y+2, z+x]]))\r\n >>> lmi\r\n Matrix([\r\n [x + 1, y + 2],\r\n [y + 2, x + z]]) > 0\r\n \r\n .. code:: Python\r\n \r\n >>> from lmi_sdp import init_lmi_latex_printing\r\n >>> from sympy import latex\r\n >>> init_lmi_latex_printing()\r\n >>> print(latex(lmi))\r\n \\left[\\begin{smallmatrix}{}x + 1 & y + 2\\\\y + 2 & x + z\\end{smallmatrix}\\right] \\succ 0\r\n \r\n |equation|\r\n \r\n .. code:: Python\r\n \r\n >>> print(latex(lmi.expanded(variables)))\r\n \\left[\\begin{smallmatrix}{}1.0 & 0.0\\\\0.0 & 1.0\\end{smallmatrix}\\right] x + \\left[\\begin{smallmatrix}{}0.0 & 1.0\\\\1.0 & 0.0\\end{smallmatrix}\\right] y + \\left[\\begin{smallmatrix}{}0.0 & 0.0\\\\0.0 & 1.0\\end{smallmatrix}\\right] z + \\left[\\begin{smallmatrix}{}1.0 & 2.0\\\\2.0 & 0.0\\end{smallmatrix}\\right] \\succ 0\r\n \r\n |equation|\r\n \r\n .. code:: Python\r\n \r\n >>> lmi_2 = LMI_NSD( Matrix([[-x, -y], [-y, -z-x]]), Matrix([[1, 2], [2, 0]]))\r\n >>> lmi_2\r\n Matrix([\r\n [-x, -y],\r\n [-y, -x - z]]) <= Matrix([\r\n [1, 2],\r\n [2, 0]])\r\n >>> lmi_2.canonical()\r\n Matrix([\r\n [x + 1, y + 2],\r\n [y + 2, x + z]]) >= 0\r\n \r\n .. code:: Python\r\n \r\n >>> print(latex(lmi_2))\r\n \\left[\\begin{smallmatrix}{}- x & - y\\\\- y & - x - z\\end{smallmatrix}\\right] \\preceq \\left[\\begin{smallmatrix}{}1 & 2\\\\2 & 0\\end{smallmatrix}\\right]\r\n \r\n |equation|\r\n \r\n Convertion to CVXOPT SDP\r\n ------------------------\r\n \r\n Example\r\n ~~~~~~~\r\n \r\n (from CVXOPT `SDP\r\n example `__)\r\n \r\n .. code:: Python\r\n \r\n >>> from sympy import symbols, Matrix\r\n >>> from lmi_sdp import LMI_NSD, init_lmi_latex_printing\r\n >>>\r\n >>> init_lmi_latex_printing()\r\n >>>\r\n >>> variables = symbols('x1 x2 x3')\r\n >>> x1, x2, x3 = variables\r\n >>>\r\n >>> min_obj = x1 - x2 + x3\r\n >>>\r\n >>> LMI_1 = LMI_NSD(\r\n ... x1*Matrix([[-7, -11], [-11, 3]]) +\r\n ... x2*Matrix([[7, -18], [-18, 8]]) +\r\n ... x3*Matrix([[-2, -8], [-8, 1]]),\r\n ... Matrix([[33, -9], [-9, 26]]))\r\n >>>\r\n >>> LMI_2 = LMI_NSD(\r\n ... x1*Matrix([[-21, -11, 0], [-11, 10, 8], [0, 8, 5]]) +\r\n ... x2*Matrix([[0, 10, 16], [10, -10, -10], [16, -10, 3]]) +\r\n ... x3*Matrix([[-5, 2, -17], [2, -6, 8], [-17, 8, 6]]),\r\n ... Matrix([[14, 9, 40], [9, 91, 10], [40, 10, 15]]))\r\n >>>\r\n >>> min_obj\r\n x1 - x2 + x3\r\n \r\n |equation|\r\n \r\n .. code:: Python\r\n \r\n >>> LMI_1.expanded(variables)\r\n Matrix([\r\n [ -7.0, -11.0],\r\n [-11.0, 3.0]])*x1 + Matrix([\r\n [ 7.0, -18.0],\r\n [-18.0, 8.0]])*x2 + Matrix([\r\n [-2.0, -8.0],\r\n [-8.0, 1.0]])*x3 <= Matrix([\r\n [33, -9],\r\n [-9, 26]])\r\n \r\n |equation|\r\n \r\n .. code:: Python\r\n \r\n >>> LMI_2.expanded(variables)\r\n Matrix([\r\n [-21.0, -11.0, 0.0],\r\n [-11.0, 10.0, 8.0],\r\n [ 0.0, 8.0, 5.0]])*x1 + Matrix([\r\n [ 0.0, 10.0, 16.0],\r\n [10.0, -10.0, -10.0],\r\n [16.0, -10.0, 3.0]])*x2 + Matrix([\r\n [ -5.0, 2.0, -17.0],\r\n [ 2.0, -6.0, 8.0],\r\n [-17.0, 8.0, 6.0]])*x3 <= Matrix([\r\n [14, 9, 40],\r\n [ 9, 91, 10],\r\n [40, 10, 15]])\r\n \r\n |equation|\r\n \r\n .. code:: Python\r\n \r\n >>> from cvxopt import solvers\r\n >>> from lmi_sdp import to_cvxopt\r\n >>>\r\n >>> solvers.options['show_progress'] = False\r\n >>>\r\n >>> c, Gs, hs = to_cvxopt(min_obj, [LMI_1, LMI_2], variables)\r\n >>>\r\n >>> sol = solvers.sdp(c, Gs=Gs, hs=hs)\r\n >>> print(sol['x'])\r\n [-3.68e-01]\r\n [ 1.90e+00]\r\n [-8.88e-01]\r\n \r\n \r\n Export to SDPA Format\r\n ---------------------\r\n \r\n Example\r\n ~~~~~~~\r\n \r\n .. code:: Python\r\n \r\n >>> from sympy import symbols, Matrix\r\n >>> from lmi_sdp import LMI_PSD, to_sdpa_sparse\r\n >>>\r\n >>> variables = x1, x2 = symbols('x1 x2')\r\n >>>\r\n >>> min_obj = 10*x1 + 20*x2\r\n >>> lmi_1 = LMI_PSD(\r\n ... -Matrix([[1, 0, 0, 0], [0, 2, 0, 0], [0, 0, 3, 0], [0, 0, 0, 4]]) +\r\n ... Matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]])*x1 +\r\n ... Matrix([[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 5, 2], [0, 0, 2, 6]])*x2)\r\n >>> lmi_1\r\n Matrix([\r\n [x1 - 1, 0, 0, 0],\r\n [ 0, x1 + x2 - 2, 0, 0],\r\n [ 0, 0, 5*x2 - 3, 2*x2],\r\n [ 0, 0, 2*x2, 6*x2 - 4]]) >= 0\r\n >>>\r\n >>> dat = to_sdpa_sparse(min_obj, lmi_1, variables, comment='test sparse')\r\n >>> print(dat)\r\n \"test sparse\"\r\n 2 = ndim\r\n 3 = nblocks\r\n 1 1 2 = blockstruct\r\n 10.0, 20.0 = objcoeffs\r\n 0 1 1 1 1.0\r\n 0 2 1 1 2.0\r\n 0 3 1 1 3.0\r\n 0 3 2 2 4.0\r\n 1 1 1 1 1.0\r\n 1 2 1 1 1.0\r\n 2 2 1 1 1.0\r\n 2 3 1 1 5.0\r\n 2 3 1 2 2.0\r\n 2 3 2 2 6.0\r\n \r\n \r\n Author\r\n ------\r\n \r\n `Crist\u00f3v\u00e3o Duarte Sousa `__\r\n \r\n Install\r\n -------\r\n \r\n From git source:\r\n \r\n ::\r\n \r\n git clone git@github.com:cdsousa/PyLMI-SDP.git\r\n cd PyLMI-SDP\r\n python setup.py install\r\n \r\n License\r\n -------\r\n \r\n Simplified BSD License. See `License File `__\r\n \r\n .. |Build Status| image:: https://travis-ci.org/cdsousa/PyLMI-SDP.png?branch=master\r\n :target: https://travis-ci.org/cdsousa/PyLMI-SDP\r\n .. |equation| image:: http://latex.codecogs.com/gif.latex?%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7Dx%2B1%26y%2B2%5C%5Cy%2B2%26x%2Bz%5Cend%7Bsmallmatrix%7D%5Cright%5D%5Csucc0\r\n .. |equation| image:: http://latex.codecogs.com/gif.latex?%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D1.0%260.0%5C%5C0.0%261.0%5Cend%7Bsmallmatrix%7D%5Cright%5Dx%2B%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D0.0%261.0%5C%5C1.0%260.0%5Cend%7Bsmallmatrix%7D%5Cright%5Dy%2B%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D0.0%260.0%5C%5C0.0%261.0%5Cend%7Bsmallmatrix%7D%5Cright%5Dz%2B%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D1.0%262.0%5C%5C2.0%260.0%5Cend%7Bsmallmatrix%7D%5Cright%5D%5Csucc0\r\n .. |equation| image:: http://latex.codecogs.com/gif.latex?%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D-x%26-y%5C%5C-y%26-x-z%5Cend%7Bsmallmatrix%7D%5Cright%5D%5Cpreceq%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D1%262%5C%5C2%260%5Cend%7Bsmallmatrix%7D%5Cright%5D\r\n .. |equation| image:: http://latex.codecogs.com/gif.latex?x_%7B1%7D-x_%7B2%7D%2Bx_%7B3%7D\r\n .. |equation| image:: http://latex.codecogs.com/gif.latex?%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D-7.0%26-11.0%5C%5C-11.0%263.0%5Cend%7Bsmallmatrix%7D%5Cright%5Dx_%7B1%7D%2B%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D7.0%26-18.0%5C%5C-18.0%268.0%5Cend%7Bsmallmatrix%7D%5Cright%5Dx_%7B2%7D%2B%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D-2.0%26-8.0%5C%5C-8.0%261.0%5Cend%7Bsmallmatrix%7D%5Cright%5Dx_%7B3%7D%5Cpreceq%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D33%26-9%5C%5C-9%2626%5Cend%7Bsmallmatrix%7D%5Cright%5D\r\n .. |equation| image:: http://latex.codecogs.com/gif.latex?%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D-21.0%26-11.0%260.0%5C%5C-11.0%2610.0%268.0%5C%5C0.0%268.0%265.0%5Cend%7Bsmallmatrix%7D%5Cright%5Dx_%7B1%7D%2B%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D0.0%2610.0%2616.0%5C%5C10.0%26-10.0%26-10.0%5C%5C16.0%26-10.0%263.0%5Cend%7Bsmallmatrix%7D%5Cright%5Dx_%7B2%7D%2B%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D-5.0%262.0%26-17.0%5C%5C2.0%26-6.0%268.0%5C%5C-17.0%268.0%266.0%5Cend%7Bsmallmatrix%7D%5Cright%5Dx_%7B3%7D%5Cpreceq%5Cleft%5B%5Cbegin%7Bsmallmatrix%7D%7B%7D14%269%2640%5C%5C9%2691%2610%5C%5C40%2610%2615%5Cend%7Bsmallmatrix%7D%5Cright%5D", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/cdsousa/PyLMI-SDP", "keywords": "LMI SDP", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "PyLMI-SDP", "package_url": "https://pypi.org/project/PyLMI-SDP/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/PyLMI-SDP/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/cdsousa/PyLMI-SDP" }, "release_url": "https://pypi.org/project/PyLMI-SDP/0.2/", "requires_dist": null, "requires_python": null, "summary": "Symbolic linear matrix inequalities (LMI) and semi-definiteprogramming (SDP) tools for Python", "version": "0.2" }, "last_serial": 867993, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "becedbb94e3c41cd66610be02aaf49f9", "sha256": "3fc7ca3a446d7eea37ed339bf1af8d2443a6b13b5e28087c0f979276e4a08791" }, "downloads": -1, "filename": "PyLMI-SDP-0.2.tar.gz", "has_sig": false, "md5_digest": "becedbb94e3c41cd66610be02aaf49f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10570, "upload_time": "2013-09-17T09:16:09", "url": "https://files.pythonhosted.org/packages/94/24/f73c1d0fb7fd9bb1a44cff001c043cfe50541cd1a6a5a71def2e39b445a0/PyLMI-SDP-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "becedbb94e3c41cd66610be02aaf49f9", "sha256": "3fc7ca3a446d7eea37ed339bf1af8d2443a6b13b5e28087c0f979276e4a08791" }, "downloads": -1, "filename": "PyLMI-SDP-0.2.tar.gz", "has_sig": false, "md5_digest": "becedbb94e3c41cd66610be02aaf49f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10570, "upload_time": "2013-09-17T09:16:09", "url": "https://files.pythonhosted.org/packages/94/24/f73c1d0fb7fd9bb1a44cff001c043cfe50541cd1a6a5a71def2e39b445a0/PyLMI-SDP-0.2.tar.gz" } ] }