| ... | @@ -166,7 +166,10 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -166,7 +166,10 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 166 | var start_index: usize = 0; | 166 | var start_index: usize = 0; |
| 167 | | 167 | |
| 168 | while (start_index < transformations.items.len) { | 168 | while (start_index < transformations.items.len) { |
| 169 | subset_size = @max(1, subset_size / 2); | 169 | const prev_subset_size = subset_size; |
| | 170 | subset_size = @max(1, subset_size * 3 / 4); |
| | 171 | if (prev_subset_size > 1 and subset_size == 1) |
| | 172 | start_index = 0; |
| 170 | | 173 | |
| 171 | const this_set = transformations.items[start_index..][0..subset_size]; | 174 | const this_set = transformations.items[start_index..][0..subset_size]; |
| 172 | std.debug.print("trying {d} random transformations: ", .{subset_size}); | 175 | std.debug.print("trying {d} random transformations: ", .{subset_size}); |
| ... | @@ -237,9 +240,6 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -237,9 +240,6 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 237 | tree = new_tree; | 240 | tree = new_tree; |
| 238 | | 241 | |
| 239 | try Walk.findTransformations(arena, &tree, &transformations); | 242 | try Walk.findTransformations(arena, &tree, &transformations); |
| 240 | // Resetting based on the seed again means we will get the same | | |
| 241 | // results if restarting the reduction process from this new point. | | |
| 242 | rng = std.rand.DefaultPrng.init(seed); | | |
| 243 | sortTransformations(transformations.items, rng.random()); | 243 | sortTransformations(transformations.items, rng.random()); |
| 244 | | 244 | |
| 245 | continue :fresh; | 245 | continue :fresh; |
| ... | @@ -249,6 +249,11 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -249,6 +249,11 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 249 | // If we tested only one transformation, move on to the next one. | 249 | // If we tested only one transformation, move on to the next one. |
| 250 | if (subset_size == 1) { | 250 | if (subset_size == 1) { |
| 251 | start_index += 1; | 251 | start_index += 1; |
| | 252 | } else { |
| | 253 | start_index += subset_size; |
| | 254 | if (start_index + subset_size > transformations.items.len) { |
| | 255 | start_index = 0; |
| | 256 | } |
| 252 | } | 257 | } |
| 253 | }, | 258 | }, |
| 254 | } | 259 | } |