I would like to implment glpk in scala.

    def addConstraintLessEqual(coef : Array[Double], col : Array[Int], rhs :
Double) {
 nbRows += 1
        GLPK.glp_add_rows(lp, 1);
        GLPK.glp_set_row_name(lp, 1, "constraint"+nbRows);
        GLPK.glp_set_row_bnds(lp, 1, GLPKConstants.GLP_UP, rhs, 0)
        val ind = GLPK.new_intArray(col.size)
        for (i <- 1 to col.size) {
          GLPK.intArray_setitem(ind, i, col(i-1)+1);
        }
        val values = GLPK.new_doubleArray(col.size);
        for (i <- 1 to col.size) {
          GLPK.doubleArray_setitem(values, col(i-1)+1, coef(i-1));
        }
        GLPK.glp_set_mat_row(lp, nbRows, col.size, ind, values)
        println("addConstraintLessEqual: end");
    }



could you tell me where is the problem ?
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to