{"id":19386232,"url":"https://github.com/davidstutz/php-simplex","last_synced_at":"2026-03-13T14:32:20.816Z","repository":{"id":22647095,"uuid":"25990094","full_name":"davidstutz/php-simplex","owner":"davidstutz","description":"PHP library implementing the simplex algorithm.","archived":false,"fork":false,"pushed_at":"2015-02-18T03:01:07.000Z","size":176,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T22:35:36.097Z","etag":null,"topics":["convex-optimization","php","simplex"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidstutz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-30T21:18:24.000Z","updated_at":"2018-09-19T19:06:09.000Z","dependencies_parsed_at":"2022-08-20T22:20:27.992Z","dependency_job_id":null,"html_url":"https://github.com/davidstutz/php-simplex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davidstutz/php-simplex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidstutz%2Fphp-simplex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidstutz%2Fphp-simplex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidstutz%2Fphp-simplex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidstutz%2Fphp-simplex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidstutz","download_url":"https://codeload.github.com/davidstutz/php-simplex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidstutz%2Fphp-simplex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30468302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T11:00:43.441Z","status":"ssl_error","status_checked_at":"2026-03-13T11:00:23.173Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["convex-optimization","php","simplex"],"created_at":"2024-11-10T10:04:44.313Z","updated_at":"2026-03-13T14:32:20.797Z","avatar_url":"https://github.com/davidstutz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Simplex\n\nThe simplex algorithm implemented in PHP. This library was developed as part of the programming assignments of the course [\"Linear and Integer Programming\"](https://www.coursera.org/course/linearprogramming) on [Coursera](https://www.coursera.org/).\n\n## Data Format\n\nThe data used for testing is provided as course material of [\"Linear and Integer Programming\"](https://www.coursera.org/course/linearprogramming) on [Coursera](https://www.coursera.org/). The dictionary format for a linear program in standard form\n\n    max c^T x\n    s.t. A x \u003c= b\n         x \u003e= 0\n\nis as follows:\n\n    [1] m n\n    [2] B_1 B_2 ... B_m\n    [3] N_1 N_2 ... N_n\n    [4] b_1 ... b_m\n    [5] a_11 ... a_1n\n    [6] a_21 ... a_2n\n    ...\n    [m + 4] a_m1 ... a_mn\n    [m + 5] c_0 c_1 ... c_n\n    \nThe numbers in brackets denote the line numbers such that there is a total of `m + 5` lines where `m` is the number of basic variables and `n` the number of non-basic variables of the dictionary. Further, `B_1` to `B_m` are the indices of the `m` basic variables and `N_1` to `N_n` are the indices of the non-basic variables. The following lines contain the vector `b`, the matrix `A` the current objective value of the dictionary `c_0` (mostly zero) and the vector `c`.\n\n## Usage\n\nFirst, make sure to include all required files:\n\n    require_once('vendor/php-matrix-decompositions/lib/Assertion.php');\n    require_once('vendor/php-matrix-decompositions/lib/Vector.php');\n    require_once('vendor/php-matrix-decompositions/lib/Matrix.php');\n    require_once('lib/DictionaryIO.php');\n    require_once('lib/Dictionary.php');\n\nThe Simplex implementation is based on the Matrix and Vector classes provided by [https://github.com/davidstutz/php-matrix-decompositions](https://github.com/davidstutz/php-matrix-decompositions). A dictionary can be directly loaded using the `DirectoryIO` class if the directory is saved in the format given above. The complete example can be found in `example.cpp`.\n\n    // Load dictionary from file.\n    $dictionary = DictionaryIO::read('data/part' . $i . '.dict');\n    \n    $output = 'data/part' . $i . '.dict: ';\n    \n    // If the dictionary is not feasible initially, it is either\n    // infeasible, unbounded or needs to be initialized.\n    if (!$dictionary-\u003eisFeasible()) {\n        if ($dictionary-\u003einitialize() === FALSE) {\n            $output .= 'INFEASIBLE';\n        }\n        else {\n            $dictionary-\u003eoptimize();\n\n            if ($dictionary-\u003eisUnbounded()) {\n                $output .= 'UNBOUNDED';\n            }\n            else {\n                $output .= $dictionary-\u003egetc0();\n            }\n        }\n    }\n    // After initialization, the dictionary could still turn out \n    // to be unbounded.\n    elseif ($dictionary-\u003eisUnbounded()) {\n        $output .= 'UNBOUNDED';\n    }\n    // Try to optimize the dictionary:\n    else {\n        $optValue = $dictionary-\u003eoptimize();\n\n        if ($optValue === FALSE) {\n            if ($dictionary-\u003eisUnbounded()) {\n                $output .= 'UNBOUNDED';\n            }\n            elseif (!$dictionary-\u003eisFeasible()) {\n                $output .= 'INFEASIBLE';\n            }\n        }\n        else {\n            $output .= $optValue;\n        }\n    }\n    \n    echo $output . '\u003cbr\u003e';\n\n## License\n\nCopyright 2014 David Stutz\n\nThe library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThe library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidstutz%2Fphp-simplex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidstutz%2Fphp-simplex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidstutz%2Fphp-simplex/lists"}