https://github.com/somjit101/min-cost-network-flow-lemon
A Simple C++ Implementation of the Lemon Optimization Library to Solve a Minimum Cost Flow problem in a given Graph Network with Supply/Demand Values of Nodes and Capacity, Unit Cost of Flow for each Edge.
https://github.com/somjit101/min-cost-network-flow-lemon
cost-optimization graph-network graphs lemon-library linear-programming logistics minimum-cost-flow network-simplex-algorithm optimization solver supply-chain-optimization
Last synced: 12 months ago
JSON representation
A Simple C++ Implementation of the Lemon Optimization Library to Solve a Minimum Cost Flow problem in a given Graph Network with Supply/Demand Values of Nodes and Capacity, Unit Cost of Flow for each Edge.
- Host: GitHub
- URL: https://github.com/somjit101/min-cost-network-flow-lemon
- Owner: somjit101
- Created: 2021-06-10T03:52:19.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-05-16T09:45:33.000Z (about 4 years ago)
- Last Synced: 2025-04-07T18:13:49.460Z (about 1 year ago)
- Topics: cost-optimization, graph-network, graphs, lemon-library, linear-programming, logistics, minimum-cost-flow, network-simplex-algorithm, optimization, solver, supply-chain-optimization
- Language: C++
- Homepage:
- Size: 550 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Min-Cost-Network-Flow-Lemon
A Simple C++ Implementation of the Lemon Optimization Library to Solve a Minimum Cost Flow problem in a given Graph Network with Supply/Demand Values of Nodes and Capacity, Unit Cost of Flow for each Edge.
## Prerequisite
### Lemon C++ Library
[Download](https://lemon.cs.elte.hu/trac/lemon/wiki/Downloads) the Lemon C++ Graph and Optimization Library. Follow the [instructions](https://lemon.cs.elte.hu/trac/lemon/wiki/InstallGuide) to build and install the library on your programming environment.
## Problem Definition
A minimum cost flow problem is where a real-world network of physical locations is represented by a Graph in the following manner :
* **Nodes** - represent each physical location associated with a certain amount of Supply (+ve value) or Demand (-ve value)
* **Edges** - Connects nodes as per per available routes for real-world resource transfer. Each edge is associated with a certain max capacity of transfer and a cost of transfer per unit of resource
**For the purpose of demonstration we have used a simple problem illustrated on the Google OR Tools webpage found [here](https://developers.google.com/optimization/flow/mincostflow) :**

In the above figure :
* The no. on each Node represents the Supply/Demand value at each location.
* The black no. on each Edge represents the cost of transfer of resources per unit.
* The red no. underneath each Edge represents the maximum flow capacity.
**The problem data has been recorded as per requirement in .csv format to be read by the program.**
## Objective
Return a list of optimal flows for each edge in the directed graph to minimize the gap between the supply and demand at the minimum attainable transfer cost.