Skip to content

Integer Linear Programming apraoch to solving applications of the graph coloring problem

License

Notifications You must be signed in to change notification settings

tpawelski/graph-coloring-lp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solving the Graph Coloring Problem and Sudoku with Linear Programming in Python

The graph coloring problem (finding the chromatic number) is a common problem in Management Science with applications including scheduling optimization, timetabling, assignment problems, etc.

Definition 1: A coloring of an undirected graph G consists of assigning a number (or a color) to each node, with the restriction that any two nodes that have an edge in between cannot be assigned the same number (or color).

Definition 2: The chromatic number of a graph is k ∈ N if there exists a coloring that uses k colors, but there is no coloring that uses less than k colors. Thus, the chromatic number is the minimum number of colors needed to have a coloring of a graph.

The python 3.0 script GraphColoringLP.py, uses the PuLP library in python to set up and solve the graph coloring problem as an integer linear program. The program finds the chromatic number of the graph represented as a list of edges in edges.dat.

Next, a linear programming formulation, based on the graph coloring approach discussed above, is used to find the optimal solution to the Sudoku puzzle shown in SudokuPuzzle.png. The script Sudoku.py sets up a given Sudoku puzzle as an integer linear programming formulation and solves it (if a feasible solution exists). As any feasible solution is an optimal solution in the context of the Sudoku problem, the objective function is rather arbitrary.

About

Integer Linear Programming apraoch to solving applications of the graph coloring problem

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages