def add_constraint(constr)
      terms = constr.expression.terms
      indexes_buffer = build_pointer_array(terms.each_key.map do |var|
        var.index
      end, :int)
      values_buffer = build_pointer_array terms.values, :double

      ret = Gurobi.GRBaddconstr @ptr, terms.length,
                                indexes_buffer, values_buffer,
                                gurobi_sense(constr.sense),
                                constr.rhs, constr.name
      fail if ret != 0

      constr.model = self
      constr.index = @constraints.length
      constr.freeze
      @constraints << constr
    end
def add_constraint(constr)
      terms = constr.expression.terms
      indexes_buffer = build_pointer_array(terms.each_key.map do |var|
        var.index
      end, :int)
      values_buffer = build_pointer_array terms.values, :double

      ret = Gurobi.GRBaddconstr @ptr, terms.length,
                                indexes_buffer, values_buffer,
                                gurobi_sense(constr.sense),
                                constr.rhs, constr.name
      fail if ret != 0

      constr.model = self
      constr.index = @constraints.length
      constr.freeze
      @constraints << constr
    end
Add a new constraint to the model