From 00ede9c2b35981c20672c0762b2f69eade7f5a15 Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 26 Feb 2013 21:09:58 +0000 Subject: [PATCH] cody: lvlgraph: check best after shuffle git-svn-id: trunk@40421 - --- components/codetools/ide/codyctrls.pas | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/components/codetools/ide/codyctrls.pas b/components/codetools/ide/codyctrls.pas index fa57ec3e01..b6ab5fcce5 100644 --- a/components/codetools/ide/codyctrls.pas +++ b/components/codetools/ide/codyctrls.pas @@ -696,7 +696,7 @@ type procedure UnbindPairs; procedure BindPairs; function ComputeCrossCount: integer; - procedure StoreAsBest; + procedure StoreAsBest(CheckIfBetter: boolean); public Graph: TLvlGraph; Levels: array of TMinXLevel; @@ -729,7 +729,7 @@ begin g.InitSearch; Run:=0; g.SwitchAndShuffle(Graph.NodeCount*Graph.NodeCount div 3, - Max(1000,Graph.NodeCount*Graph.NodeCount)); + Max(10000,Graph.NodeCount*Graph.NodeCount)); g.Apply; finally g.Free; @@ -1148,15 +1148,17 @@ end; procedure TMinXGraph.InitSearch; begin - StoreAsBest; + StoreAsBest(false); end; -procedure TMinXGraph.StoreAsBest; +procedure TMinXGraph.StoreAsBest(CheckIfBetter: boolean); var l: Integer; Level: TMinXLevel; n: Integer; begin + if CheckIfBetter and (BestCrossCount>=0) and (BestCrossCountCrossCount) then - StoreAsBest; + StoreAsBest(true); {$IFDEF CheckMinXGraph} ConsistencyCheck;