Ngā hua rapu - binary while optimization (algorithm OR algorithms)