Optimal flow analysis, prediction and application