{"id":31766095,"url":"https://github.com/ibmdecisionoptimization/doopl-examples","last_synced_at":"2025-10-10T00:29:18.047Z","repository":{"id":37785853,"uuid":"149290759","full_name":"IBMDecisionOptimization/doopl-examples","owner":"IBMDecisionOptimization","description":"IBM OPL Connector for Python","archived":false,"fork":false,"pushed_at":"2022-06-22T13:51:59.000Z","size":26,"stargazers_count":6,"open_issues_count":5,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-25T11:36:31.849Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IBMDecisionOptimization.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-18T13:14:19.000Z","updated_at":"2023-11-02T06:01:55.000Z","dependencies_parsed_at":"2022-08-18T17:01:25.686Z","dependency_job_id":null,"html_url":"https://github.com/IBMDecisionOptimization/doopl-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/IBMDecisionOptimization/doopl-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMDecisionOptimization%2Fdoopl-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMDecisionOptimization%2Fdoopl-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMDecisionOptimization%2Fdoopl-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMDecisionOptimization%2Fdoopl-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IBMDecisionOptimization","download_url":"https://codeload.github.com/IBMDecisionOptimization/doopl-examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMDecisionOptimization%2Fdoopl-examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002359,"owners_count":26083356,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-10-10T00:28:58.912Z","updated_at":"2025-10-10T00:29:18.036Z","avatar_url":"https://github.com/IBMDecisionOptimization.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# IBM\u0026reg; OPL connector for Python (DOopl)\r\n\r\nWelcome to the IBM\u0026reg; OPL connector for Python.\r\nLicensed under the Apache License v2.0.\r\n\r\nWith this library, you can quickly and easily add the power of optimization to\r\nyour Python application. You can model your problems by using the OPL language and IDE, and integrate it in Python via Python/pandas/sql alchemy inputs/outputs.\r\n\r\nSolving with CPLEX requires that IBM\u0026reg; ILOG CPLEX Optimization Studio is installed on your machine.\r\nCurrently, `doopl` supports CPLEX Optimization Studio versions:\r\n- 12.8\r\n- 12.9\r\n- 12.10\r\n\r\nWe provide the library for python 3.6 and 3.7.\r\n\r\nThis library is an example showing how to use data sources in python in OPL.\r\nIt is provided \"as-is\".\r\n\r\nWe don't plan to provide the library as a standard Python package anymore: the connector source code is now on the IBM public github.\r\nIf you need a more recent version of optimization engine and/or if you need a more recent Python version, you can have a look at the [code](https://github.com/IBMDecisionOptimization/doopl) and refer to the README for build instructions.\r\n\r\n## Install the library\r\n\r\n```\r\n   pip install doopl\r\n```\r\n\r\n## Get the examples\r\n\r\n* [Examples](https://github.com/IBMDecisionOptimization/doopl-examples)\r\n\r\n## Get your IBM\u0026reg; ILOG CPLEX Optimization Studio edition\r\n\r\n- You can get a free [Community Edition](http://www-01.ibm.com/software/websphere/products/optimization/cplex-studio-community-edition)\r\n of CPLEX Optimization Studio, with limited solving capabilities in term of problem size.\r\n\r\n- Faculty members, research professionals at accredited institutions can get access to an unlimited version of CPLEX through the\r\n [IBM\u0026reg; Academic Initiative](https://ibm.onthehub.com/WebStore/ProductSearchOfferingList.aspx?srch=cplex).\r\n\r\n## License\r\n\r\nThis library is delivered under the  Apache License Version 2.0, January 2004 (see [LICENSE](LICENSE.txt)).\r\n\r\n## Starting point\r\n\r\nThe API is very compact and simple.\r\nYou must have the OPL binaries in your PATH/LD_LIBRARY_PATH or DYLD_LIBRARY_PATH, depending on your platform.\r\nThey are located in \u003ccode\u003e\u0026lt;cplex_studio_dir\u0026gt;/opl/bin/\u0026lt;platform\u0026gt;\u003c/code\u003e where\r\n   * cplex_studio_dir is the installation directory of CPLEX Optimization Studio\r\n   * platform is your plaform.\r\n\r\nHere is small sumup of the capabilities:\r\n   * Inputs can be tuple lists, panda's dataframe, sql alchemy fetch statements.\r\n   * Generate, solve and get output tuplesets as panda's dataframe\r\n   * Get the CPLEX problem statistics and quality metrics for the solution\r\n   * Convert all integer variables to floating point variables and vice-versa.\r\n   * Run the conflict/relaxation mechanism.\r\n   * Call the 'RunSeed' diagnosis for CPLEX/CPO based problems.\r\n\r\nEach of these features are demonstrated with simple examples.\r\n\r\nHere is a small example to start working with the API:\r\n\r\n    from doopl.factory import *\r\n\r\n    # Create an OPL model from a .mod file\r\n    with create_opl_model(model=\"file.mod\") as opl:\r\n        # tuple can be a list of tuples, a pandas dataframe...\r\n        opl.set_input(\"TupleSet1\", tuples)\r\n\r\n        # Generate the problem and solve it.\r\n        opl.run()\r\n\r\n        # Get the names of post processing tables\r\n        print(\"Table names are: \"+ str(opl.output_table_names))\r\n\r\n        # Get all the post processing tables as dataframes.\r\n        for name, table in iteritems(opl.report):\r\n            print(\"Table : \" + name)\r\n            for t in table.itertuples(index=False):\r\n                print(t)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibmdecisionoptimization%2Fdoopl-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibmdecisionoptimization%2Fdoopl-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibmdecisionoptimization%2Fdoopl-examples/lists"}