- lp_h.set_lowbo(i+1, (float)0.0);
- lp_h.bound_difference(i, cols+i, ((float)width)/((float)cols), LinearProgramming.LE, coeff);
- lp_h.bound_sum( i, cols+i, ((float)width)/((float)cols), LinearProgramming.GE, coeff);
+ for(int j=0 ; j<i; j++) {
+ for(int k=0; k<coeff.length; k++) coeff[k] = (float)(k==i?1.0:k==j?-1.0:k==(cols+1)?-1.0:0.0);
+ lp_h.add_constraint(coeff, LinearProgramming.LE, 0);
+ for(int k=0; k<coeff.length; k++) coeff[k] = (float)(k==i?1.0:k==j?-1.0:k==(cols+1)?1.0:0.0);
+ lp_h.add_constraint(coeff, LinearProgramming.GE, 0);
+ }