Skip to main content
. 2021 Jun 11;23(6):737. doi: 10.3390/e23060737
Algorithm 2 Selecting a Similar Set Based on Energy Cost
Input: States s
Output: Similar set Sene of s
  1: Create a empty stack
  2: while s do
  3:    a is the action that pops from the head of state s
  4:    if a=e then
  5:        Clear the stack
  6:    else
  7:        Push a to the stack
  8:    end if
  9: end while
10: Measure the length of the stack and mark it as l
11: Sene=
12: S=Spa
13: while Sθ·Spa  do
14:    Select s from S
15:    l= executing Line 1 to Line 10 with s
16:    if l=l then
17:        Sene=Sene{s}
18:        S=S{s}
19:    else
20:        S=S{s}
21:    end if
22: end while
23: Return Sene