changeset 61:f851895ea67a

Add cullwhenover option and more tuning results
author Mike Pavone <pavone@retrodev.com>
date Mon, 16 Jul 2012 02:20:38 -0700
parents 7d4e51b4769a
children ff2b38518a58
files src/lifter.tp tuningresults.txt
diffstat 2 files changed, 53 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/lifter.tp	Mon Jul 16 01:55:04 2012 -0700
+++ b/src/lifter.tp	Mon Jul 16 02:20:38 2012 -0700
@@ -103,6 +103,7 @@
 			visitedStates <- sets hash
 			bestMove:withMaxSteps <- :self :max{
 				n <- 0
+				hashelim <- 0
 				while: { if: (states length) > 0 { if: n < max { not: (curbest succeeded) } } } do: {
 					nextstates <- #[]
 					foreach: states :idx curstate {
@@ -137,11 +138,11 @@
 				}
 			}
 			cullStatesTo <- :n {
-				print: "culling " . (states length) . " to " . n . "\n"
+				os write: 2 "culling " . (states length) . " to " . n . "\n"
 				if: n < (states length) {
 					states <- topN: states n
 				}
-				print: "states length is now " . (states length) . "\n"
+				os write: 2 "states length is now " . (states length) . "\n"
 			}
 		}
 	}
@@ -151,6 +152,7 @@
 		aftermaxsteps <- 5
 		cullstates <- 8
 		curarg <- 1
+		cullwhenover <- 0
 		while: { curarg < (args length) } do: {
 			if: (args get: curarg) = "-is" {
 				curarg <- curarg + 1
@@ -169,6 +171,13 @@
 						if: curarg < (args length) {
 							cullstates <- ((args get: curarg) int32)
 						}
+					} else: {
+						if: (args get: curarg) = "-co" {
+							curarg <- curarg + 1
+							if: curarg < (args length) {
+								cullwhenover <- ((args get: curarg) int32)
+							}	
+						}
 					}
 				}
 			}
@@ -185,27 +194,29 @@
 		
 		maxsteps <- initmaxsteps
 		while: { bestMove: finder withMaxSteps: maxsteps } do: {
-			best <- -1000000
-			bestscore <- -1000000
-			foreach: (finder states) :idx el {
-				h <- (el heuristic)
-				s <- (el score)
-				if: (h > best) {
-					best <- h
-				}
-				if: (s > bestscore) {
-					bestscore <- s
-				}
+			//best <- -1000000
+			//bestscore <- -1000000
+			//foreach: (finder states) :idx el {
+			//	h <- (el heuristic)
+			//	s <- (el score)
+			//	if: (h > best) {
+			//		best <- h
+			//	}
+			//	if: (s > bestscore) {
+			//		bestscore <- s
+			//	}
+			//}
+			if: ((finder states) length) > cullwhenover {
+				finder cullStatesTo: cullstates
 			}
-			finder cullStatesTo: cullstates
 			maxsteps <- aftermaxsteps
 			os write: 2 "--------iteration results-------\n"
 			os write: 2 "Best:\n"
 			(finder curbest) printGrid
-			os write: 2 "Hash: " . ((finder curbest) hash)
-			os write: 2 "Current before cull\n"
-			os write: 2 " Best Heuristic: " . best . "\n"
-			os write: 2 " Best Score: " . bestscore . "\n"
+			//os write: 2 "Hash: " . ((finder curbest) hash)
+			//os write: 2 "Current before cull\n"
+			//os write: 2 " Best Heuristic: " . best . "\n"
+			//os write: 2 " Best Score: " . bestscore . "\n"
 			//os write: 2 "After cull:\n"
 			//foreach: (finder states) :idx el{
 			//	os write: 2 " " . idx . " Heuristic: " . (el heuristic) . "\n"
--- a/tuningresults.txt	Mon Jul 16 01:55:04 2012 -0700
+++ b/tuningresults.txt	Mon Jul 16 02:20:38 2012 -0700
@@ -41,6 +41,9 @@
 maps/contest6.map: 1133 (1:53.77)
 maps/contest7.map: 869 (0:08.74)
 maps/contest8.map: 273 (1:41.30)
+
+total: 4921
+
 -is 4 -as 3 -cs 250
 
 maps/contest1.map: 212 (0:00.32)
@@ -51,6 +54,9 @@
 maps/contest6.map: 1103 (1:21.92)
 maps/contest7.map: 869 (0:05.88)
 maps/contest8.map: 659 (2:13.52)
+
+total: 5269
+
 -is 4 -as 3 -cs 64
 
 maps/contest1.map: 212 (0:00.18)
@@ -61,6 +67,9 @@
 maps/contest6.map: 1131 (0:15.09)
 maps/contest7.map: 869 (0:01.51)
 maps/contest8.map: 237 (0:23.60)
+
+total: 4580
+
 -is 5 -as 4 -cs 64
 
 maps/contest1.map: 212 (0:00.16)
@@ -71,3 +80,18 @@
 maps/contest6.map: 1131 (0:16.51)
 maps/contest7.map: 869 (0:01.92)
 maps/contest8.map: 272 (0:55.84)
+
+total: 4763
+
+-is 1 -as 1 -cs 128 -co 3000
+
+maps/contest1.map: 212 (0:00.32)
+maps/contest2.map: 281 (0:03.24)
+maps/contest3.map: 275 (0:08.19)
+maps/contest4.map: 575 (0:16.44)
+maps/contest5.map: 1293 (1:07.18)
+maps/contest6.map: 1133 (2:53.12)
+maps/contest7.map: 869 (0:13.08)
+maps/contest8.map: 268 (2:26.28)
+
+total: 4906