Lippy - solving linear programming problems.
Source Code: https://github.com/ispaneli/lippy
Lippy is a module for solving linear programming problems on Python.
Provides:
- Simplex method in primal linear programming
- Simplex method in dual linear programming
- Branch and bound in integer linear programming
- Brute force method in integer linear programming
- Cutting-plane method in integer linear programming
- Zero-sum game in game theory using Simplex method
import lippy as lp
c_vec = [6, 6, 6]
a_matrix = [
[4, 1, 1],
[1, 2, 0],
[0, 0.5, 4]
]
b_vec = [5, 3, 8]
simplex = lp.SimplexMethod(c_vec, a_matrix, b_vec)
solution, func_value = simplex.solve()
import lippy as lp
c_vec = [6, 6, 6]
a_matrix = [
[4, 1, 1],
[1, 2, 0],
[0, 0.5, 4]
]
b_vec = [5, 3, 8]
c_vec, a_matrix, b_vec = lp.primal_to_dual_lp(c_vec, a_matrix, b_vec)
simplex = lp.SimplexMethod(c_vec, a_matrix, b_vec)
solution, func_value = simplex.solve()
import lippy as lp
c_vec = [3, 3, 7]
a_matrix = [
[1, 1, 1],
[1, 4, 0],
[0, 0.5, 3]
]
b_vec = [3, 5, 7]
bab = lp.BranchAndBound(c_vec, a_matrix, b_vec)
solution, func_value = bab.solve()
import lippy as lp
c_vec = [3, 3, 7]
a_matrix = [
[1, 1, 1],
[1, 4, 0],
[0, 0.5, 3]
]
b_vec = [3, 5, 7]
force = lp.BruteForce(c_vec, a_matrix, b_vec)
solution, func_value = force.solve()
import lippy as lp
c_vec = [3, 3, 7]
a_matrix = [
[1, 1, 1],
[1, 4, 0],
[0, 0.5, 3]
]
b_vec = [3, 5, 7]
gomory = lp.CuttingPlaneMethod(c_vec, a_matrix, b_vec)
gomory.solve()
import lippy as lp
game_matrix = [
[8, 1, 17, 8, 1],
[12, 6, 11, 10, 16],
[4, 19, 11, 15, 2],
[17, 19, 6, 17, 16]
]
game = lp.ZeroSumGame(game_matrix)
strategies = game.solve()
Existing logging modes:
- FULL_LOG
- MEDIUM_LOG
- LOG_OFF (default)
Logging is set when initializing a class object.
For example:
simplex = lp.SimplexMethod(c_vec, a_matrix, b_vec, log_mode=lp.LogMode.FULL_LOG)
bab = lp.BranchAndBound(c_vec, a_matrix, b_vec, log_mode=lp.LogMode.MEDIUM_LOG)
This project is licensed under the terms of the MIT license.