}
else {
Also wrong
if (i == 0)
label = "primal";
else
label = "dual";
either put them on the same line or use {} Note in another place in the same file you use {} around each, way to be consistent
Also never if (i == 0) use if (!i)