def store_constraint_matrix(constr, type)
      # Initialize arrays used to hold the coefficients for each variable
      row = []
      colno = []
      constr.expression.terms.each do |var, coeff|
        row << coeff * 1.0
        colno << var.index
      end

      row_buffer = build_pointer_array row, :double
      colno_buffer = build_pointer_array colno, :int

      ret = LPSolve.add_constraintex(@ptr, constr.expression.terms.length,
                                     row_buffer, colno_buffer,
                                     type, constr.rhs)
      fail if ret != 1
    end
def store_constraint_matrix(constr, type)
      # Initialize arrays used to hold the coefficients for each variable
      row = []
      colno = []
      constr.expression.terms.each do |var, coeff|
        row << coeff * 1.0
        colno << var.index
      end

      row_buffer = build_pointer_array row, :double
      colno_buffer = build_pointer_array colno, :int

      ret = LPSolve.add_constraintex(@ptr, constr.expression.terms.length,
                                     row_buffer, colno_buffer,
                                     type, constr.rhs)
      fail if ret != 1
    end
Build the constraint matrix and add it to the model