def add_constraints(constrs)
      GLPK.glp_add_rows(@ptr, constrs.length)

      # Store each constraint and initialize a matrix used to hold
      # the coefficients of each value in the constraint matrix
      #
      # * ia - row (constraint) index
      # * ja - column (variable) index
      # * ar - constraint coefficient
      constrs.each do |constr|
        store_constraint constr
        constr.expression.terms.each do |var, coeff|
          @ia << constr.index
          @ja << var.index
          @ar << coeff
        end
      end

      ia_buffer = build_pointer_array @ia, :int
      ja_buffer = build_pointer_array @ja, :int
      ar_buffer = build_pointer_array @ar, :double

      GLPK.glp_load_matrix(@ptr, @ar.length - 1, ia_buffer, ja_buffer,
                           ar_buffer)

      @constraints.concat constrs
    end
def add_constraints(constrs)
      GLPK.glp_add_rows(@ptr, constrs.length)

      # Store each constraint and initialize a matrix used to hold
      # the coefficients of each value in the constraint matrix
      #
      # * ia - row (constraint) index
      # * ja - column (variable) index
      # * ar - constraint coefficient
      constrs.each do |constr|
        store_constraint constr
        constr.expression.terms.each do |var, coeff|
          @ia << constr.index
          @ja << var.index
          @ar << coeff
        end
      end

      ia_buffer = build_pointer_array @ia, :int
      ja_buffer = build_pointer_array @ja, :int
      ar_buffer = build_pointer_array @ar, :double

      GLPK.glp_load_matrix(@ptr, @ar.length - 1, ia_buffer, ja_buffer,
                           ar_buffer)

      @constraints.concat constrs
    end
Add multiple constraints at once