def sort_dependencies(dependencies, activated, conflicts)
      dependencies.sort_by do |dependency|
        name = name_for(dependency)
        [
          activated.vertex_named(name).payload ? 0 : 1,
          conflicts[name] ? 0 : 1,
          search_for(dependency).count,
        ]
      end
    end
def sort_dependencies(dependencies, activated, conflicts)
      dependencies.sort_by do |dependency|
        name = name_for(dependency)
        [
          activated.vertex_named(name).payload ? 0 : 1,
          conflicts[name] ? 0 : 1,
          search_for(dependency).count,
        ]
      end
    end
Callback required by Molinillo
 Sort dependencies so that the ones that are easiest to resolve are first.
 Easiest to resolve is (usually) defined by:
   1) Is this dependency already activated?
   2) How relaxed are the requirements?
   3) Are there any conflicts for this dependency?
   4) How many possibilities are there to satisfy this dependency?

 @param [Array<Object>] dependencies
 @param [DependencyGraph] activated the current dependency graph in the
   resolution process.
 @param [{String => Array<Conflict>}] conflicts
 @return [Array<Solve::Dependency>] the dependencies sorted by preference.