[Aptitude-svn-commit] r3942 - in branches/aptitude-0.3/aptitude: . src/generic/problemresolver

Daniel Burrows dburrows at costa.debian.org
Tue Aug 23 17:16:18 UTC 2005


Author: dburrows
Date: Tue Aug 23 17:16:15 2005
New Revision: 3942

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
Log:
Fix some obvious errors and inconsistencies in calculating solution scores.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Tue Aug 23 17:16:15 2005
@@ -2,11 +2,16 @@
 
 	* src/generic/problemresolver/problemresolver.h:
 
+	  Fix several obvious errors and inconsistencies in calculating
+	  solution scores.
+
+	* src/generic/problemresolver/problemresolver.h:
+
 	  Efficiency tweak: when comparing solutions by their contents,
 	  don't do a full lexicographical compare unless the two solutions
 	  have different sizes and different scores.  This moves
 	  lexicographical_compare from second place with 18% of the
-	  running time to third place with 7% of the running time.
+	  running time to ninth place with 2.47% of the running time.
 
 2005-08-20  Daniel Burrows  <dburrows at debian.org>
 

Modified: branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h	Tue Aug 23 17:16:15 2005
@@ -1132,7 +1132,7 @@
 	output_actions[solver.get_package()] = act;
 	action_score += step_score;
 	action_score += version_scores[solver.get_id()];
-	action_score += version_scores[solver.get_package().current_version().get_id()];
+	action_score -= version_scores[solver.get_package().current_version().get_id()];
       }
 
     // By definition we have a solution now.
@@ -1523,7 +1523,7 @@
       + unfixed_soft_score * new_unresolved_soft.size();
 
     if(new_broken.size() == 0)
-      new_score+=full_solution_score;
+      new_score += full_solution_score;
 
     return solution(abegin, aend, s,
 		    ubegin, uend,
@@ -1715,10 +1715,15 @@
 
 	found = true;
 
+	int new_score = s.get_score() - broken_score + unfixed_soft_score;
+	// Handle the corner case where this is a full solution.
+	if(s.get_broken().size() == 1)
+	  new_score += full_solution_score;
+
 	// Only score change is that something goes from being broken
 	// to being permanently unfixed and "soft".
 	if(try_enqueue(solution(s, d,
-				s.get_score() - broken_score + unfixed_soft_score,
+				new_score,
 				s.get_action_score())))
 	  ++count;
       }



More information about the Aptitude-svn-commit mailing list