static void DoEdgeAlls(Graphs.Graph uiG, int potSize, Choosability.Graph G, Template template, int i) { var mind = new Choosability.FixerBreaker.KnowledgeEngine.Slim.Super.SuperSlimMind(G); mind.MaxPot = potSize; mind.OnlyConsiderNearlyColorableBoards = true; mind.MissingEdgeIndex = i; var root = @"C:\game trees\alls2\" + i; Directory.CreateDirectory(root); var win = mind.Analyze(template, null); if (win) { int j = 0; foreach (var board in mind.PlayableBoards) { var tree = mind.BuildGameTree(board); GraphViz.DrawTree(tree, root + @"\" + i + " depth " + tree.GetDepth() + " board " + j + ".pdf"); j++; } } }
public static void WriteProof() { // var uiG = GraphsCore.CompactSerializer.Deserialize("webgraph:7qM`$!.4bH!!!R&a9[/.`!KrS!Aa_K%n$+I!*C1-pbPd:TFX<n1&s-S7JJ\\_\"eHt>8?!.J7JQ4#6hiD:#64`)!<=YO!!!'6/-5ne/-I40\"U#Ji#\"0\"-!!!\"L\"p\"]T!<<"); //small tree aka fig1 left // var uiG = GraphsCore.CompactSerializer.Deserialize("webgraph:7oB<e!-S>B!!#8TJd$*0\\-lgI!AXY2';,k%#;Z?^)[2gP(C-Of'0ujY!!N?&!.ZPL!<E0O!=+(&I\"$HlIKBKg/-?eA!uhdS2\\:FcIXV"); // fig1 middle // var uiG = GraphsCore.CompactSerializer.Deserialize("webgraph:7qDZ#!2KSp!!#7s_?WaT\\-lgI!Aa^d)5%L-#>?-AShqSoSn&^p'0ujY!)+Du>Qb&\"e2/>6>R(6/!<E0O!=+(&I\"$HlIK0Hg/-6b%!s0Al\"<.mU.hDa^!.Y84&:T\"UIK"); // fig1 right // var uiG = GraphsCore.CompactSerializer.Deserialize("webgraph:8!X,T!$D:B!!&)lOptM4\\-lgI!Aa^@+,/T#,DG#?+.s-1#;Q9])[2f],6a[K$V?KmJ;)mR%u&ns'8>>R$O*,X'*Xu#%gAPD(XNCQ#;Z>g!!*'#!6>-?Uf-F^IXZZnI\"$MF!ZK,^!?0#^$P3Il&-`@Xa9[/)$6$tl\"rbPjHP\"$p#ljsUL^OUs(<CrPIXV"); // big tree var uiG = GraphsCore.CompactSerializer.Deserialize("webgraph:7RI.U!'1)[!!@T`X:8\\?!AXXc)8lhl!!+kU9HC2DA,lWc!!3-$!!*'N!=+(&I\"$HlIK9KN!%\\-UIXZZnI\"$M"); // val var potSize = uiG.Vertices.Max(v => int.Parse(v.Label)); var g = new Choosability.Graph(uiG.GetEdgeWeights()); var template = new Template(g.Vertices.Select(v => potSize + g.Degree(v) - uiG.Vertices[v].Label.TryParseInt().Value).ToList()); var mind = new Choosability.FixerBreaker.KnowledgeEngine.Slim.Super.SuperSlimMind(g, proofFindingMode: true); mind.MaxPot = potSize; // mind.MissingEdgeIndex = 0; // mind.OnlyConsiderNearlyColorableBoards = true; int j = 0; var win = mind.Analyze(template); if (win) { var pb = new MaximumDegreeThreeProofBuilder(mind); var proof = pb.WriteProof(); } }
public static void Go() { using (var graphEnumerator = new GraphEnumerator(WinnersFile, 2, MaxVertices)) { if (TreesOnly) { graphEnumerator.FileRoot = @"C:\Users\landon\Google Drive\research\Graph6\trees\trees"; } else { graphEnumerator.FileRoot = @"C:\Users\landon\Google Drive\research\Graph6\graph"; } graphEnumerator.DoNotUsePreviousWinners = true; foreach (var gg in graphEnumerator.EnumerateGraph6File(Filter, null)) { System.Console.Write("checking " + gg.ToGraph6() + "... "); var weightings = EnumerateWeightings(gg).ToList(); var winners = new List <Choosability.Graph>(); foreach (var g in weightings) { var mind = new Choosability.FixerBreaker.KnowledgeEngine.Slim.Super.SuperSlimMind(g, false, FixerBreakerSwapMode.SingleSwap); mind.MaxPot = int.MaxValue; mind.OnlySuperabundantBoards = true; mind.ExtraPsi = ExtraPsi; mind.OnlyConsiderNearlyColorableBoards = NearColorings; var template = new Template(g.VertexWeight); var win = mind.Analyze(template, null); if (win) { winners.Add(g); } } var globalWinners = winners.Where(w => SubsetEqualSpecial(weightings.Where(aa => w.VertexWeight.Zip(aa.VertexWeight, (x, y) => x <= y).All(b => b)).ToList(), winners)).ToList(); globalWinners = globalWinners.Where(w => IntersectionCountSpecial(weightings.Where(aa => w.VertexWeight.Zip(aa.VertexWeight, (x, y) => x >= y).All(b => b)).ToList(), globalWinners) == 1).ToList(); if (globalWinners.Count > 0) { System.Console.ForegroundColor = ConsoleColor.Green; System.Console.WriteLine(" fixer wins"); System.Console.ForegroundColor = ConsoleColor.White; foreach (var ww in globalWinners) { graphEnumerator.AddWinner(ww); } } else { System.Console.ForegroundColor = ConsoleColor.Red; System.Console.WriteLine(" breaker wins"); System.Console.ForegroundColor = ConsoleColor.White; } } } }
Reduction CheckReductionForWin(Graph h, List <Reduction> reductions) { var possibleReductions = reductions.Where(r => SuperSlimMind.IsSuperabundantForGraph(r.Board, h)).ToList(); if (possibleReductions.Count <= 0) { return(null); } var sizes = possibleReductions[0].Board.Stacks.Value.Select(s => s.PopulationCount()).ToList(); var mind = new SuperSlimMind(h, Mind.ProofFindingMode, Mind.SwapMode, FixerBreakeReductionMode.None); mind.MaxPot = Mind.MaxPot; mind.OnlySuperabundantBoards = Mind.OnlySuperabundantBoards; mind.ExtraPsi = Mind.ExtraPsi; mind.OnlyConsiderNearlyColorableBoards = Mind.OnlyConsiderNearlyColorableBoards; if (ForbiddenEdge != null) { mind.MissingEdgeIndex = h.Edges.Value.IndicesWhere(tt => tt.Item1 == ForbiddenEdge.Item1 && tt.Item2 == ForbiddenEdge.Item2 || tt.Item2 == ForbiddenEdge.Item1 && tt.Item1 == ForbiddenEdge.Item2).First(); } mind.AllIntermediateBoardsInRestrictedClass = Mind.AllIntermediateBoardsInRestrictedClass; mind.Analyze(new Template(sizes), Progress); return(possibleReductions.FirstOrDefault(r => mind.FixerWonBoards.Contains(r.Board))); }
public static void Go() { using (var graphEnumerator = new GraphEnumerator(WinnersFile, 2, MaxVertices)) { if (TreesOnly) { graphEnumerator.FileRoot = @"C:\Users\landon\Google Drive\research\Graph6\trees\trees"; } else if (TreesOrTreesPlusEdgeOnly) { graphEnumerator.FileRoot = @"C:\Users\landon\Google Drive\research\Graph6\degree5treesplusedge\geng"; } else if (Planar) { graphEnumerator.FileRoot = @"C:\Users\landon\Google Drive\research\Graph6\planar\planar_conn."; } else { graphEnumerator.FileRoot = @"C:\Users\landon\Google Drive\research\Graph6\graph"; } foreach (var g in graphEnumerator.EnumerateGraph6File(Filter, EnumerateWeightings)) { System.Console.Write("checking " + g.ToGraph6() + " with degrees [" + string.Join(",", g.VertexWeight) + "] ..."); var mind = new Choosability.FixerBreaker.KnowledgeEngine.Slim.Super.SuperSlimMind(g, false, SwapMode); mind.MaxPot = Delta; mind.OnlyConsiderNearlyColorableBoards = NearColorings; var template = new Template(g.VertexWeight.Select((ambientDegree, v) => Delta - (ambientDegree - g.Degree(v))).ToList()); var win = mind.Analyze(template, null); if (win) { System.Console.ForegroundColor = ConsoleColor.Blue; System.Console.WriteLine(" fixer wins"); System.Console.ForegroundColor = ConsoleColor.White; graphEnumerator.AddWinner(g); _wonWeightings.Add(g.VertexWeight); if (MakeWebPage) { MakePictures.MakeWebpage(WinnersFile, Path.Combine(WebpageRoot, Path.GetFileNameWithoutExtension(WinnersFile))); } } else { System.Console.ForegroundColor = ConsoleColor.Red; System.Console.WriteLine(" breaker wins"); System.Console.ForegroundColor = ConsoleColor.White; } } } }
public static int InternalIntersectionOrder(SuperSlimMind mind, SuperSlimBoard a, SuperSlimBoard b) { var asum = -InternalIntersectionCount(mind.G, a); var bsum = -InternalIntersectionCount(mind.G, b); if (asum < bsum) { return(-1); } if (asum > bsum) { return(1); } return(0); }
public static void Go() { using (var graphEnumerator = new GraphEnumerator("superabundant near coloring original fixable test.txt", 2, 20)) { graphEnumerator.FileRoot = @"C:\Users\landon\Google Drive\research\Graph6\graph"; foreach (var g in graphEnumerator.EnumerateGraph6File(g => true, EnumerateWeightings)) { System.Console.Write("checking " + g.ToGraph6() + " with degrees [" + string.Join(",", g.VertexWeight) + "] ..."); var mind = new Choosability.FixerBreaker.KnowledgeEngine.Slim.Super.SuperSlimMind(g, false, FixerBreakerSwapMode.SingleSwap); mind.MaxPot = Delta; mind.OnlySuperabundantBoards = true; mind.OnlyConsiderNearlyColorableBoards = true; var weakMind = new Choosability.FixerBreaker.KnowledgeEngine.Slim.Super.SuperSlimMind(g, false, FixerBreakerSwapMode.Original); weakMind.MaxPot = Delta; weakMind.OnlySuperabundantBoards = true; weakMind.OnlyConsiderNearlyColorableBoards = true; var template = new Template(g.VertexWeight); var win = mind.Analyze(template, null); var winWeak = weakMind.Analyze(template, null); if (win != winWeak) { System.Console.ForegroundColor = ConsoleColor.Red; System.Console.WriteLine(" weakly is weaker"); System.Console.ForegroundColor = ConsoleColor.White; graphEnumerator.AddWinner(g); } else { if (win) { System.Console.ForegroundColor = ConsoleColor.Blue; } else { System.Console.ForegroundColor = ConsoleColor.Green; } System.Console.ForegroundColor = ConsoleColor.White; } } } }
public static int BestKnownOrder(SuperSlimMind mind, SuperSlimBoard a, SuperSlimBoard b) { var ep = GlobalExtraPsiOrder(mind, a, b); if (ep != 0) { return(ep); } var ii = InternalIntersectionOrder(mind, a, b); if (ii != 0) { return(ii); } return(0); }
public static void BuildTreePictures() { var root = @"C:\game trees\smalltree\fixable"; Directory.CreateDirectory(root); // var uiG = GraphsCore.CompactSerializer.Deserialize("webgraph:7p5lm!.4bH!!#8TV?g9C\\-lgI!AXXW)k[^-#;Z?F*sJ5a,6aYM-O65sh^B_'h`q79;LfjChZj,^!!*)@!!!'$'Z^@ja9NC\"!sTF[\">gYm\"T\\VE!!!"); // var uiG = GraphsCore.CompactSerializer.Deserialize("webgraph:7s+e3!3?/#!!#:+U^KF0PS%F+!AXX?+05o;#;\\Xf`!Jd9-mM7W`P)m27JKt(6hiE-#!f!b-mM`?paS`-&1>N4<IG2S!<<-#a8c2A!>NTW'Z^Ila9)SZa98IB!.Zm;#6Y^]#ZM?A<\"KBC!<C1@!!"); var uiG = GraphsCore.CompactSerializer.Deserialize("webgraph:7qM`$!.4bH!!!R&a9[/.`!KrS!Aa_K%n$+I!*C1-pbPd:TFX<n1&s-S7JJ\\_\"eHt>8?!.J7JQ4#6hiD:#64`)!<=YO!!!'6/-5ne/-I40\"U#Ji#\"0\"-!!!\"L\"p\"]T!<<"); var potSize = uiG.Vertices.Max(v => int.Parse(v.Label)); var g = new Choosability.Graph(uiG.GetEdgeWeights()); var template = new Template(g.Vertices.Select(v => potSize + g.Degree(v) - uiG.Vertices[v].Label.TryParseInt().Value).ToList()); GraphViz.DrawGraph(g, root + @"\G.pdf", true); var mind = new Choosability.FixerBreaker.KnowledgeEngine.Slim.Super.SuperSlimMind(g, proofFindingMode: true); mind.MaxPot = potSize; // mind.OnlyConsiderNearlyColorableBoards = true; // mind.MissingEdgeIndex = 0; int j = 0; var win = mind.Analyze(template); if (win) { foreach (var board in mind.PlayableBoards) { var tree = mind.BuildGameTree(board, win); GraphViz.DrawTree(tree, root + @"\" + " depth " + tree.GetDepth() + " board " + j + ".png"); j++; } } else { foreach (var board in mind.BreakerWonBoards) { var tree = mind.BuildGameTree(board, win); GraphViz.DrawTree(tree, root + @"\" + " depth " + tree.GetDepth() + " board " + j + ".png"); j++; } } }
public static int GlobalExtraPsiOrder(SuperSlimMind mind, SuperSlimBoard a, SuperSlimBoard b) { return(mind.ComputeAbundanceSurplus(a).CompareTo(mind.ComputeAbundanceSurplus(b))); }
public static int CurrentOrder(SuperSlimMind mind, SuperSlimBoard a, SuperSlimBoard b) { return(BestKnownOrder(mind, a, b)); }
public Reduction CanReduceToSuperabundant(Graph g, SuperSlimBoard board, int extraPsi) { return(CanReduce(g, board, (h, l) => l.FirstOrDefault(r => SuperSlimMind.IsSuperabundantForGraph(r.Board, h, extraPsi)))); }