Skip to main content
. Author manuscript; available in PMC: 2023 Oct 1.
Published in final edited form as: Auton Agent Multi Agent Syst. 2022 May 11;36(2):32. doi: 10.1007/s10458-022-09559-5

Algorithm 1.

Binary search to find a boundary point

Input: pt1,pt2 : Endpoints for binary search with different labels.

Output: Boundary point m alongwith its mean and standard deviation

Note: Function RunDiffusionModel(pt1) executes the diffusion model simulation and returns the mean (pt1Mean) and standard deviation (pt1Stdev) for given input point.

  1: procedure BinarySearch(pt1,pt2)
  2:   [pt1 Mean, pt1Stdev] = RunDiffusionModel(pt1)
  3:   if pt1Stdevθsd then
  4:     Add pt1 to boundaryPoints
  5:     return [pt1, pt1Mean, pt1Stdev]
  6:   else
  7:     Add [pt1, pt1Mean, pt1 Label] to evaluated Points
  8:   end if
  9:   [pt2 Mean, pt2Stdev] = RunDiffusionModel(pt2)
10:   if pt2Stdev >= θsd then
11:     Add pt2 to boundaryPoints
12:     return [pt2, pt2Mean,pt2Stdev]
13:   else
14:     Add [pt2,pt2Mean,pt2 Label] to evaluated Points
15:   end if
16:   m = (pt1 + pt2)/2.0
17:   while mboundary Points and pt1 Labelpt2Label do
18:     [mMean, mStdev] = RunDiffusionModel(m)
19:     if mStdev >= θsd then
20:     Add m to boundaryPoints
21:     return [m, mMean, mStdev]
22:     else
23:     Add [m, mMean, mLabel] to evaluatedPoints
24:     end if
25:     Assign m to pt1 or pt2, s.t. pt1 and pt2 have different labels
26:     m = (pt1 + pt2)/2.0
27:   end while
28: end procedure