{"id":13749051,"url":"https://github.com/rust-or/highs-sys","last_synced_at":"2025-08-10T17:10:32.796Z","repository":{"id":48296225,"uuid":"341012432","full_name":"rust-or/highs-sys","owner":"rust-or","description":"Rust binding for the HiGHS linear programming solver","archived":false,"fork":false,"pushed_at":"2025-06-07T20:09:44.000Z","size":80,"stargazers_count":14,"open_issues_count":6,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-12T05:19:54.185Z","etag":null,"topics":["linear-programming","mathematics","optimization","parallel-computing","simplex"],"latest_commit_sha":null,"homepage":"https://docs.rs/highs-sys","language":"Rust","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/rust-or.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-02-21T21:54:50.000Z","updated_at":"2025-06-07T20:09:48.000Z","dependencies_parsed_at":"2023-02-10T17:45:53.972Z","dependency_job_id":"d5762eae-227c-4b75-9d3c-e6b78111349b","html_url":"https://github.com/rust-or/highs-sys","commit_stats":{"total_commits":77,"total_committers":7,"mean_commits":11.0,"dds":"0.22077922077922074","last_synced_commit":"a0be3b0477d686d035d8f28e50977706a34d9742"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/rust-or/highs-sys","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-or%2Fhighs-sys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-or%2Fhighs-sys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-or%2Fhighs-sys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-or%2Fhighs-sys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-or","download_url":"https://codeload.github.com/rust-or/highs-sys/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-or%2Fhighs-sys/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269756394,"owners_count":24470566,"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-08-10T02:00:08.965Z","response_time":71,"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":["linear-programming","mathematics","optimization","parallel-computing","simplex"],"created_at":"2024-08-03T07:00:54.547Z","updated_at":"2025-08-10T17:10:32.776Z","avatar_url":"https://github.com/rust-or.png","language":"Rust","readme":"# highs-sys\n\n[![docs.rs badge](https://docs.rs/highs-sys/badge.svg)](https://docs.rs/highs-sys)\n[![rust crate](https://img.shields.io/crates/v/highs-sys.svg)](https://lib.rs/highs-sys)\n\nRust binding for the HiGHS linear programming solver.\nSee http://highs.dev.\n\nThis repository contains the source for HiGHS itself as a submodule.\nYou should clone it with \n\n```\ngit clone --recursive git@github.com:rust-or/highs-sys.git\n```\n\nThis crate can either use and link a version of HiGHS that is already installed and available on your system or build and statically link HiGHS itself.\n\n## Usage\n\nAt runtime, HiGHS depends at the minimum on the C++ standard library.\nIt needs to be installed both on your system and any system you want to deploy your application to.\n\nHow you install these depends on your operating system.\n\n#### Debian\n\n```\nsudo apt-get install libstdc++6\n```\n\n(but it is probably already installed on your system)\n\n#### macOS\n\nlibc++ comes by default when installing XCode.\n\n### Building HiGHS\n\nThis crate can either build HiGHS itself and link it statically or [link against an already installed version](#using-a-pre-installed-version-of-highs).\nTo build HiGHS, you need at least a C++ compiler and cmake.\nEnabling additional features may incur additional runtime dependencies.\n\n#### Linux\n\nThese can be easily installed using your distribution's package manager.\nFor example, on Debian: `sudo apt install g++ cmake`.\n\n#### macOS\n\nTo install a C++ compiler, run `xcode-select --install`.\nThe easiest way to obtain cmake is via brew: `brew install cmake`.\n\nIf you enable the `libz` or `ninja` features, you should also install these via brew.\n\n#### Windows\n\nYou need to install [CMake](https://cmake.org/download/) and [Clang (available in LLVM)](https://releases.llvm.org/download.html).\n\nThey are available in [winget](https://winget.run/).\n\n```powershell\nwinget install -e --id Kitware.CMake\nwinget install -e --id LLVM.LLVM\n```\n\nIf you enable the Ninja feature, you can also obtain Ninja from winget:\n\n```powershell\nwinget install -e --id Ninja-build.Ninja\n```\n\nIf desired, libz needs to be installed and made discoverable by adding the `libz-sys` crate as a dependency in your project or manually setting up libz and setting the `ZLIB_ROOT` environment variable.\n\n### Using a pre-installed version of HiGHS\n\nRather than building HiGHS, you can link against a version you have already installed on your system.\nTo do that, install pkg-config on your system and enable the `discover` feature on this crate.\n\nThis will generally cause HiGHS to be linked dynamically, which means it also needs to be installed on the system you deploy to.\n\nNote that at the time of writing, HiGHS is packaged in few package managers, so you may need to build and install HiGHS from source.\n\n#### Feature Flags\n\n`build` (enabled by default): build HiGHS and link it statically\n`highs_release`: set CMake profile to \"Release\" regardless of build profile; only takes effect when `build` is enabled.\n`libz`: enable HiGHS libz linking to enable support for reading 'mps.gz'; only takes effect when `build` is enabled.\n`ninja`: set CMake generator to Ninja; only takes effect when `build` is enabled.\n`discover`: use pkg-config to discover and link against an already installed version of HiGHS; takes precedence over `build` if both are enabled\n\n## Example\n\n```rust\n    // This illustrates the use of Highs_call, the simple C interface to\n// HiGHS. It's designed to solve the general LP problem\n//\n// Min c^Tx subject to L \u003c= Ax \u003c= U; l \u003c= x \u003c= u\n//\n// where A is a matrix with m rows and n columns\n//\n// The scalar n is numcol\n// The scalar m is numrow\n//\n// The vector c is colcost\n// The vector l is collower\n// The vector u is colupper\n// The vector L is rowlower\n// The vector U is rowupper\n//\n// The matrix A is represented in packed column-wise form: only its\n// nonzeros are stored\n//\n// * The number of nonzeros in A is nnz\n//\n// * The row indices of the nonnzeros in A are stored column-by-column\n// in aindex\n//\n// * The values of the nonnzeros in A are stored column-by-column in\n// avalue\n//\n// * The position in aindex/avalue of the index/value of the first\n// nonzero in each column is stored in astart\n//\n// Note that astart[0] must be zero\n//\n// After a successful call to Highs_call, the primal and dual\n// solution, and the simplex basis are returned as follows\n//\n// The vector x is colvalue\n// The vector Ax is rowvalue\n// The vector of dual values for the variables x is coldual\n// The vector of dual values for the variables Ax is rowdual\n// The basic/nonbasic status of the variables x is colbasisstatus\n// The basic/nonbasic status of the variables Ax is rowbasisstatus\n//\n// The status of the solution obtained is modelstatus\n//\n// To solve maximization problems, the values in c must be negated\n//\n// The use of Highs_call is illustrated for the LP\n//\n// Min    f  = 2x_0 + 3x_1\n// s.t.                x_1 \u003c= 6\n//       10 \u003c=  x_0 + 2x_1 \u003c= 14\n//        8 \u003c= 2x_0 +  x_1\n// 0 \u003c= x_0 \u003c= 3; 1 \u003c= x_1\n\nfn main() {\n    let numcol: usize = 2;\n    let numrow: usize = 3;\n    let nnz: usize = 5;\n\n    // Define the column costs, lower bounds and upper bounds\n    let colcost: \u0026mut [f64] = \u0026mut [2.0, 3.0];\n    let collower: \u0026mut [f64] = \u0026mut [0.0, 1.0];\n    let colupper: \u0026mut [f64] = \u0026mut [3.0, 1.0e30];\n    // Define the row lower bounds and upper bounds\n    let rowlower: \u0026mut [f64] = \u0026mut [-1.0e30, 10.0, 8.0];\n    let rowupper: \u0026mut [f64] = \u0026mut [6.0, 14.0, 1.0e30];\n    // Define the constraint matrix column-wise\n    let astart: \u0026mut [c_int] = \u0026mut [0, 2];\n    let aindex: \u0026mut [c_int] = \u0026mut [1, 2, 0, 1, 2];\n    let avalue: \u0026mut [f64] = \u0026mut [1.0, 2.0, 1.0, 2.0, 1.0];\n\n    let colvalue: \u0026mut [f64] = \u0026mut vec![0.; numcol];\n    let coldual: \u0026mut [f64] = \u0026mut vec![0.; numcol];\n    let rowvalue: \u0026mut [f64] = \u0026mut vec![0.; numrow];\n    let rowdual: \u0026mut [f64] = \u0026mut vec![0.; numrow];\n\n    let colbasisstatus: \u0026mut [c_int] = \u0026mut vec![0; numcol];\n    let rowbasisstatus: \u0026mut [c_int] = \u0026mut vec![0; numrow];\n\n    let modelstatus: \u0026mut c_int = \u0026mut 0;\n\n    let status: c_int = unsafe {\n        Highs_call(\n            numcol.try_into().unwrap(),\n            numrow.try_into().unwrap(),\n            nnz.try_into().unwrap(),\n            colcost.as_mut_ptr(),\n            collower.as_mut_ptr(),\n            colupper.as_mut_ptr(),\n            rowlower.as_mut_ptr(),\n            rowupper.as_mut_ptr(),\n            astart.as_mut_ptr(),\n            aindex.as_mut_ptr(),\n            avalue.as_mut_ptr(),\n            colvalue.as_mut_ptr(),\n            coldual.as_mut_ptr(),\n            rowvalue.as_mut_ptr(),\n            rowdual.as_mut_ptr(),\n            colbasisstatus.as_mut_ptr(),\n            rowbasisstatus.as_mut_ptr(),\n            modelstatus\n        )\n    };\n\n    assert_eq!(status, 0);\n    // The solution is x_0 = 2 and x_1 = 4\n    assert_eq!(colvalue, \u0026[2., 4.]);\n}\n```\n\nFor more examples, have a look at [`tests`](https://github.com/lovasoa/highs-sys/blob/master/tests).\n","funding_links":[],"categories":["Projects"],"sub_categories":["Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-or%2Fhighs-sys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-or%2Fhighs-sys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-or%2Fhighs-sys/lists"}