Giter VIP home page Giter VIP logo

alps's Introduction

⛰ alps

alps makes it easy to solve linear programming problems.

cargo run -- --input problems/bakery.json
#    Compiling alps v0.1.0 (/Users/drbh/Projects/alps)
#     Finished dev [unoptimized + debuginfo] target(s) in 0.23s
#      Running `target/debug/alps --input problems/bakery.json`
# Solution {
#     direction: Maximize,
#     num_vars: 2,
#     num_constraints: 5,
#     objective: 94.75,
# }
cargo test --package alps --bin alps -- tests --nocapture
#    Compiling alps v0.1.0 (/Users/drbh/Projects/alps)
#     Finished test [unoptimized + debuginfo] target(s) in 0.30s
#      Running unittests src/main.rs (target/debug/deps/alps-e86163ff8d944cc0)

# running 3 tests
# test tests::test_create_expression_simple ... ok
# test tests::test_create_constraint_simple ... ok
# test tests::test_create_expression ... ok

# test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

it can also be used a library

use alps::{solve, UnoptimizedProblem};

fn main() {
    // Load the problem from a file
    let file_str = std::fs::read_to_string("problems/bakery.json").expect("Failed to read the file");

    // Deserialize the problem
    let problem: UnoptimizedProblem = serde_json::from_str(&file_str).expect("Failed to deserialize the problem");

    // Solve the problem
    let solution = solve(&problem);

    // Print the solution
    println!("{:?}", solution);
}

alps's People

Contributors

drbh avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.