How to optimally paint your door

How to optimally paint your door

If you visit Ireland you can see colorful doors almost every where (usually no two neighbors?have the same door color)

Graph coloring is an old operation research problem. The question is how to assign colors to each graph node to make sure no two connected nodes share the same color.

It has several applications such as

  1. Making Schedule/Time Table
  2. Mobile Radio Frequency Assignment?
  3. Sudoku
  4. Map Coloring
  5. Group assignment

I decided to paint the IEEE test power systems (IEEE 300bus and IEEE 118bus systems).

The MILP problem formulation is quite simple as follows:

No alt text provided for this image

  • Xi,c is a binary variable which indicates if node i is painetd with color c
  • y is a real variable which shows the number of colors used for paining.

The problem is solved in Pyomo package, here is the Python code

No alt text provided for this image

The colored graph (IEEE 300 Bus system) can be observed as follows (3 colors will be needed):

No alt text provided for this image

As it can be seen, the number of nodes painetd by each color are not the same. (Red is used more), We can add some constraints to resolve this issue:

Pyomo Power system

Keeping the same number of colors and resolving the problem will give us a better answer as follows:

No alt text provided for this image

We can do the same for IEEE 118 bus network (4 colors will be needed)

No alt text provided for this image

We can do the same for edge coloring (no two edges having a common node should have the same color)

Pyomo optimization

Subscribe to the Optimization?news letter

Marc Sevaux

Professor in Operations Research

3 年

Alireza, again thanks for sharing this piece of online optimization. As a simple comment, the optimal solution of the door painting problem is 2 :-) If in your street you have 20 doors to paint and 8 colors, you may maximize the number of doors between two doors of the same color. The model in Julia is given below as well as the solution. As you can see, patterns are repeated. Once again, thanks for all of this newsletter I like it very much.

  • 该图片无替代文字
Dr.Mostafa Samy, BDS

Dentist | Healthcare Data Science / A.i | Generative A.i for healthcare "clinical LLM's" | Digital Healthcare Transformation & Integration | MSc Operations Research | Applied Statistics(FGSSR) | DTQM( AICPD).

3 年

Great as usual Thank you

要查看或添加评论,请登录

Alireza Soroudi, PhD的更多文章

社区洞察

其他会员也浏览了