{"id":13453492,"url":"https://github.com/xuy/pyipopt","last_synced_at":"2025-12-18T01:59:06.765Z","repository":{"id":1759759,"uuid":"2654672","full_name":"xuy/pyipopt","owner":"xuy","description":"A Python connector to IPOPT","archived":false,"fork":false,"pushed_at":"2023-01-31T13:47:37.000Z","size":147,"stargazers_count":202,"open_issues_count":15,"forks_count":73,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-10-28T20:38:41.454Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xuy.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-10-26T23:22:45.000Z","updated_at":"2024-10-28T04:49:55.000Z","dependencies_parsed_at":"2023-02-16T19:45:56.924Z","dependency_job_id":null,"html_url":"https://github.com/xuy/pyipopt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuy%2Fpyipopt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuy%2Fpyipopt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuy%2Fpyipopt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuy%2Fpyipopt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xuy","download_url":"https://codeload.github.com/xuy/pyipopt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245194243,"owners_count":20575727,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T08:00:41.158Z","updated_at":"2025-12-18T01:59:06.738Z","avatar_url":"https://github.com/xuy.png","language":"C","readme":"PyIpopt\n=======\n\nPyIpopt is a python module that allows you to use [Ipopt](http://www.coin-or.org/Ipopt/) in Python. It is developed by Eric Xu when he was a PhD student at [Washington University](https://wustl.edu/) and issued under the BSD license.\n\nInstallation\n------------\n\n### Dependencies\n\nPyIpopt depends on the following packages:\n\n1. A compiler and a linker, e.g. gcc, ld\n2. [Ipopt](https://projects.coin-or.org/Ipopt)\n3. [Numpy](http://numpy.scipy.org/)\n4. Python.h (part of the python source code, you can download it from [Python.org](http://python.org))\n\n### Install\n\nFirst, get the latest source code using:\n\n  $ git clone http://github.com/xuy/pyipopt.git\n\nIn your PyIpopt folder, edit setup.py to reflect the configuration of your system, then do\n\n\t$ python setup.py build\n\t$ sudo python setup.py install\n\n### Test\n\n  $ python hs071.py\n\nYou should be able to see the result of solving the toy problem.\n\nUsage\n-----\nYou can use PyIpopt like this:\n\n\timport pyipopt\n\t# define your call back functions\n\tnlp = pyipopt.create(...)\n\tnlp.solve(...)\n\tnlp.close()\n\nYou can also check out hs071.py to see how to use PyIpopt.\n\nPyIpopt as a module comes with docstring. You can poke around \nit by using Python's $help()$ command.\n\nTesting\n-------\n\nI have included an example \n\nTo see if you have PyIpopt ready, use the following command under the pyipopt's directory. \n\n\t\tpython hs071.py\n\t\nThe file \"hs071.py\" contains a toy optimization problem. If everything is OK, pyipopt will invoke Ipopt to solve it for you. This python file is self-documented and can be used as a template for writing your own optimization problems. \n\nPyipopt is a legitimate Python module, you can inspect it by using standard Python commands like \"dir\" or \"help\". All functions in pyipopt are documented in details. \n\n**Hessian Estimation**: since Hessian estimation is usually tedious, Ipopt can solve problems without Hessian estimation. Pyipopt also supports this feature. The file \"hs071.py\" demonstrates the idea. If you provide the pyipopt.create function with an \"eval_h\" callback function as well as the \"apply_new\" callback function, Ipopt will delegate the Hessian matrix calculation to your function (otherwise Ipopt will approximate Hessian for you).\n\nContributing\n------------\n\n1. Fork it.\n2. Create a branch (`git checkout -b my_pyipopt`)\n3. Commit your changes (`git commit -am \"your awesome message\"`)\n4. Push to the branch (`git push origin my_pyipopt`)\n5. Create a pull request\n6. Nag me about it if I am lazy.\n\nTroubleshooting\n---------------\n\n### Check Ipopt\n\nPyIpopt links to Ipopt's C library. If that library is not available PyIpopt will fail\nduring module initialization. To check the availability of this library, you can go to\n\t$IPOPT_DIR/Ipopt/examples/hs071_c/\nand issue $make to ensure you can compile and run the toy example supplied by Ipopt. \n\n### Miscellaneous problems\n\n* Error:\n\timport pyipopt\n\tImportError: can not find  libipopt.so.0\n\n* Solution:\n    find it and copy it to a folder that ld can access\n\n* Error:\n\timport pyipopt\n\tImportError: /usr/lib/libipopt.so.0: undefined symbol: _gfortran_XXX\n\n* Solution: \n    check if your `hs071_c` example work. It is very likely that your ipopt library is not correctly compiled. \n\n\n* Error:\n\timport pyipopt\n\tImportError: /usr/lib/libipopt.so.0: undefined symbol: SetIntermediateCallback\n\n* Solution:\n\tSetIntermediateCallback is a function added since Ipopt 3.9.1. (see https://projects.coin-or.org/Ipopt/changeset/1830 )\n\tMake sure you have an Ipopt version \u003e= 3.9.1\n\n* Error:\n\timport pyipopt\n\tImportError: /usr/lib/libipopt.so.0: undefined symbol: ma19ad_\n\n* Solution:\n\tFirst, use \n\t\tnm /usr/lib/libipopt.so.0 | grep ma19ad_ \n\tto see if it is marked with U. It should. This means that libipopt.so.0 is not aware of libcoinhsl.so.0. You can fix this\n\tby adding -lcoinhsl in the makefile of pyipopt. It seems to me that this happens in the recent versions of ipopt. Eventually\n\tpyipopt will have a better building mechanism, and I will fix this soon. \n\n* Error:\n\timport pyipopt\n\tImportError: /usr/lib/libipopt.so.0: undefined symbol: SomeKindOfSymbol\n\t\n* Solution:\n\tI can assure you that it is NOT a bug of pyipopt. It is very likely that you did not link the right package when compiling pyipopt. \n\tFirst, use \n\t\tnm /usr/lib/libipopt.so.0 | grep SomeKindOfSymbol\n\tto see if this symbol is indeed missing. Do a Google search to find the library file, and \n\tadd -lWhateverLibrary in the makefile of pyipopt. \n\t\n\tIpopt is built using various third-party libraries. Different machines may have different set of libraries. You should \n\ttry to locate these dependencies and indicate them when compiling pyipopt. This is just a limitation of dynamic linking libraries and \n\tis not related to Pyipopt. Please do not report a missing symbol error as a \"bug\" to me unless you are 100% sure it is the problem  of pyipopt. \n\t\n\nContact\n--------\n\nEric Xu \u003cxu.mathena@gmail.com\u003e\n\nSoftware Engineer @ Google\n\n\n","funding_links":[],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuy%2Fpyipopt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxuy%2Fpyipopt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuy%2Fpyipopt/lists"}