private void developMinusConstraintsMax(double[][] matrix) {
for(int i=1; i <= matrix.length; i++) {
for(int k=i+1; k <= matrix.length; k++) {
GLPK.glp_add_rows(_lp, 2);
int numRow = GLPK.glp_get_num_rows(_lp)-1;
GLPK.glp_set_row_name(_lp, numRow, "W[" + (i-1) + "-" + (k-1) + "]");
GLPK.glp_set_row_bnds(_lp, numRow, GLPKConstants.GLP_UP, 0.0, 0.0);
SWIGTYPE_p_int ind = GLPK.new_intArray(4);
GLPK.intArray_setitem(ind, 1, i);
GLPK.intArray_setitem(ind, 2, k);
GLPK.intArray_setitem(ind, 3, GLPK.glp_get_num_cols(_lp));
double ratioCoefficient = ((matrix[i-1][_j]) / (matrix[k-1][_j]));
SWIGTYPE_p_double val = GLPK.new_doubleArray(4);
GLPK.doubleArray_setitem(val, 1, 1.0);
GLPK.doubleArray_setitem(val, 2, ratioCoefficient);
GLPK.doubleArray_setitem(val, 3, -1.0);
GLPK.glp_set_mat_row(_lp, numRow, 3, ind, val);
GLPK.delete_intArray(ind);
GLPK.delete_doubleArray(val);
System.out.println("W[" + (i-1) + "-" + (k-1) + "] added.");
numRow = GLPK.glp_get_num_rows(_lp);
GLPK.glp_set_row_name(_lp, numRow, "W[" + (k-1) + "-" + (i-1) + "]");
GLPK.glp_set_row_bnds(_lp, numRow, GLPKConstants.GLP_UP, 0.0, 0.0);
ind = GLPK.new_intArray(4);
GLPK.intArray_setitem(ind, 1, k);
GLPK.intArray_setitem(ind, 2, i);
GLPK.intArray_setitem(ind, 3, GLPK.glp_get_num_cols(_lp));
val = GLPK.new_doubleArray(4);
GLPK.doubleArray_setitem(val, 1, ratioCoefficient);
GLPK.doubleArray_setitem(val, 2, 1.0);
GLPK.doubleArray_setitem(val, 3, -1.0);
GLPK.glp_set_mat_row(_lp, numRow, 3, ind, val);
GLPK.delete_intArray(ind);
GLPK.delete_doubleArray(val);
System.out.println("W[" + (k-1) + "-" + (i-1) + "] added.");
}
}
}