Gather data

This commit is contained in:
mike
2026-01-10 01:05:11 +01:00
parent a444f943b9
commit cc0191f494
3 changed files with 5 additions and 6 deletions

View File

@@ -12,7 +12,6 @@ import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
import static puzzle.Export.*;
import static puzzle.SwedishGenerator.*;
@@ -342,7 +341,7 @@ public class Main {
TOTAL_ATTEMPTS.incrementAndGet();
var swe = new SwedishGenerator(rng);
var mask = swe.generateMask(opts.pop, opts.gens);
var filled = new CSP(rng).fillMask(mask, dict.index(), 200, opts.fillTimeout);
var filled = new CSP(rng).fillMask(mask, dict.index(), opts.fillTimeout);
TOTAL_NODES.addAndGet(filled.stats().nodes);
TOTAL_BACKTRACKS.addAndGet(filled.stats().backtracks);

View File

@@ -35,6 +35,7 @@ public record SwedishGenerator(Rng rng) {
//@formatter:off
@FunctionalInterface interface SlotVisitor { void visit(int key, long packedPos, int len); }
//@formatter:on
static final int LOG_EVERY_MS = 200;
static final int BAR_LEN = 22;
static final int C = Config.PUZZLE_COLS;
static final double CROSS_R = (C - 1) / 2.0;
@@ -751,7 +752,7 @@ public record SwedishGenerator(Rng rng) {
record CSP(Rng rng) {
public FillResult fillMask(Grid mask, DictEntry[] dictIndex,
int logEveryMs, int timeLimitMs) {
int timeLimitMs) {
boolean multiThreaded = Thread.currentThread().getName().contains("pool");
var grid = mask.deepCopyGrid();
var slots = extractSlots(grid);
@@ -773,7 +774,7 @@ public record SwedishGenerator(Rng rng) {
Runnable renderProgress = () -> {
if (!Main.VERBOSE || multiThreaded) return;
var now = System.currentTimeMillis();
if ((now - lastLog.get()) < logEveryMs) return;
if ((now - lastLog.get()) < LOG_EVERY_MS) return;
lastLog.set(now);
var done = assigned.size();

View File

@@ -148,8 +148,7 @@ public class MainTest {
int foundSeed = -1;
for (int i = 0; i < 50; i++) {
int seed = opts.seed + i;
var rng = new Rng(seed);
res = Main.attempt(rng, dict, opts);
res = Main.attempt(new Rng(seed), dict, opts);
if (res != null && res.filled().ok()) {
foundSeed = seed;
System.out.println("[DEBUG_LOG] Seed found: " + seed);