1: repeat
2: for all do
3: compute maximising
4: update and by using above, values for all
5: end for
6: until change in and