capacity seems to work, fix the non-integer optimality stuff