# File lib/dep_selector/gecode_wrapper.rb, line 62
    def add_version_constraint(package_id, version, dependent_package_id, min_dependent_version, max_dependent_version)
      raise "Gecode internal failure" if gecode_problem.nil?
      check_package_id(package_id, "package_id")
      check_package_id(dependent_package_id, "dependent_package_id")

      # Valid package versions are between -1 and its max (-1 means
      # don't care, meaning it doesn't need to be assigned). To
      # indicate constraints that match no versions, -2 is used, since
      # it's not a valid assignment of the variable; thus, any branch
      # that assigns -2 will fail.
      #
      # This mechanism is also used when a dependent package has no
      # versions, which only happens if the dependency's package is
      # auto-vivified when creating the parent PackageVersion's
      # dependency but with no corresponding set of PackageVersions
      # (i.e. it's an invalid deendency, because it does not exist in
      # the dependency graph). Again, we won't abort immediately, but
      # we'll add a constraint to the package that makes exploring
      # that portion of the solution space unsatisfiable. Thus it is
      # impossible to find solutions dependent on non-existent
      # packages.

      min = min_dependent_version || NoMatchConstraint
      max = max_dependent_version || NoMatchConstraint
      Dep_gecode.AddVersionConstraint(gecode_problem, package_id, version, dependent_package_id, min, max)

      # if the package was constrained to no versions, hint to the
      # solver that in the event of failure, it should prefer to
      # indicate constraints on dependent_package_id as the culprit
      if min == NoMatchConstraint && max == NoMatchConstraint
        Dep_gecode.MarkPackageSuspicious(gecode_problem, dependent_package_id)
      end
    end