Quote:develop a algorithm to reduce the waiting time of the payment line of a supermarket

Solution: open all payment boxes.

Hint: I think you failed to mention restrictions, limitations and the optimization target.

If you want help to implement an optimization algorithm, the first thing you need to do is specify a cost function, i. e. a function that determines the value of a specific solution candidate. The purpose of this function is to determine how much better one candidate is when compared to another candidate, or at least whether that candidate is better or not.

Without such a function, there is no way to judge whether you found the solution, and therefore no way we can help you find an algorithm.

See those link to the right under "related question:" start there.