procedure HybridStabilityTest
input: agents: the list of agents with a history of their internal models and utility function values; modelDifference: the difference
   between the best social model outcome and the second best social model outcome
output: stability (true or false) and the period of the overall behaviour if the system is stable
begin
  for each agent in agents do
    if not PeriodicModel() then // internal perspective
      return (false, 0)
    end if
    if not PeriodicUtility() then // external perspective
      return (false, 0)
    end if
    for all time steps in the interaction history of agent   do
      if  modelDifference(, ) − modelDifference(, ) < 0 then
        return (false, 0)
      end if
    end for
  end for
  periodList = empty list
  for each agent in agents do
    add modelPeriod() to periodList
    add utilityPeriod() to periodList
  end for
  lcm = least common multiple of elements in periodList
  return (true, lcm)
end procedure
Pseudocode 1: Hybrid test for stability.