The flow solver uses the following pseudo-code to pass the ask from the operation to the buffer.
Note that the algorithm currently treats all alternates as if their type is “PRIORITY”.
An extension of the algorithm is required to support “MINCOST”, “MINPENALTY”, and “MINCOSTPENALTY” with the right logic. Feel free to submit a contribution, or contact us if you require such functionality.
// Without alternates
If the requested date is outside of the effective date range of the flow
Reply that the request can’t be met.
else
Ask the buffer solver for the quantity and date.
If the buffer reply is of quantity 0 and the next ask date is later than the effectivity end date
Limit the next ask date to the effectivity end date
Return the promised quantity and next ask date.
else
// Alternate flows
Sort all alternate flows in order of priority
Switch the planning mode to constrained
For each alternate
Switch the operation to the alternate
Ask the buffer solver for the quantity and date
If the buffer reply is above 0
Return the planned quantity and next date
If no alternate found any supply
If the plan type is unconstrained then
Replan in unconstrained mode on the primary alternate
Return full quantity on requested date
else
Return 0 and next date