int active_size = N, iter, i, s;
int [] index = UTArray.range(N);
Random rand = new Random(5);
List<IntPrediction> ps;
IntInstance instance;
IntPrediction max;
int y;
for (iter=0; iter<MAX_ITER; iter++)
{
UTArray.shuffle(rand, index, active_size);
Gmax_new = Double.NEGATIVE_INFINITY;
Gmin_new = Double.POSITIVE_INFINITY;
for (s=0; s<active_size; s++)
{
i = index[s];
instance = model.getInstance(i);
y = instance.getLabel();
ps = model.getIntPredictions(instance.getFeatureVector());
max = Collections.max(ps);
G = max.score;
if (G < 0) G = 0;
else if (max.label != y) G *= -1d;