Given a N*M array of 0 and 1. A lake is a set of cells(1) which are horizontally or vertically adjacent. We are going to connect all lakes on map by updating some cell(0) to 1. The task is finding the way that number of updated cells is the smallest in a given time limit.
I found this similar question: What is the minimum cost to connect all the islands?
The solution on this topic get some problem:
1) It uses lib (pulp) to solve the task
2) It take time to get output
Is there an optimization solution for this problem
Thank you in advance