def add_constraints(constrs)
      cbeg, cind, cval = build_constraint_matrix constrs

      cbeg_buffer = build_pointer_array cbeg, :int
      cind_buffer = build_pointer_array cind, :int
      cval_buffer = build_pointer_array cval, :double
      sense_buffer = build_pointer_array(constrs.map do |c|
        gurobi_sense(c.sense)
      end, :char)
      rhs_buffer = build_pointer_array constrs.map(&:rhs), :double

      names_buffer = build_pointer_array array_to_pointers_to_names(constrs),
                                         :pointer

      ret = Gurobi.GRBaddconstrs @ptr, constrs.length, cind.length,
                                 cbeg_buffer, cind_buffer, cval_buffer,
                                 sense_buffer, rhs_buffer, names_buffer
      fail if ret != 0

      constrs.each do |constr|
        constr.model = self
        constr.index = @constraints.length
        constr.freeze
        @constraints << constr
      end
    end
def add_constraints(constrs)
      cbeg, cind, cval = build_constraint_matrix constrs

      cbeg_buffer = build_pointer_array cbeg, :int
      cind_buffer = build_pointer_array cind, :int
      cval_buffer = build_pointer_array cval, :double
      sense_buffer = build_pointer_array(constrs.map do |c|
        gurobi_sense(c.sense)
      end, :char)
      rhs_buffer = build_pointer_array constrs.map(&:rhs), :double

      names_buffer = build_pointer_array array_to_pointers_to_names(constrs),
                                         :pointer

      ret = Gurobi.GRBaddconstrs @ptr, constrs.length, cind.length,
                                 cbeg_buffer, cind_buffer, cval_buffer,
                                 sense_buffer, rhs_buffer, names_buffer
      fail if ret != 0

      constrs.each do |constr|
        constr.model = self
        constr.index = @constraints.length
        constr.freeze
        @constraints << constr
      end
    end
Add multiple constraints at once