Skip to content

Arthod/IntegerLinearProgramming-Solver

Repository files navigation

IntegerLinearProgramming-Solver (WIP)

Solver for (Integer) Linear Programming Problems

Example

if __name__ == "__main__":
    lp = LP.LP()
    x1 = lp.add_variable(1)
    x2 = lp.add_variable(2)
    lp.set_objective(LP.MAX, x1 + 2 * x2)
    lp.add_constraint(1 * x1 + 1 * x2, LP.LESS_EQUAL, 21)
    lp.add_constraint(2 * x2, LP.LESS_EQUAL, 14)
    lp.add_constraint(x1 + 2 * x2, LP.LESS_EQUAL, 25)
    lp.add_constraint(2 * x1 + 9 * x2, LP.LESS_EQUAL, 80)


    x = lp.solve()
    print("z = " + str(x @ lp.c))
    print("x = " + str(x))
    lp.plot_solution_path()

Contributors

Ahmad Othman    (https://github.com/arthod)
Rasmus Nuko Jørgensen   (https://github.com/rasmusnuko)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages