# Which algorithm would you use to solve a multiple producer-consumer problem with constraints?

I'm solving this problem similar to consumer-producer of materials (i.e. sand).

This is the graph of the problem:

Where Req (E0 and E1) are units that require material, and Prod (C0 and C1) produce material. I'm looking for the first random solution or similar that meets the constraints i.e E0 Require 10, shared from C0 or/and C1.

What would be a valid approach? I just think in Genetic Algorithms.