@@ -301,23 +301,6 @@ async function run() {
301301 console . log ( 'Last better bdd found ' + roundToTwoDecimals ( lastBetterHours ) + 'hours ago' ) ;
302302 bdd . removeIrrelevantLeafNodes ( unknownValueActionId ) ;
303303
304- // ensure correctness to have a double-check that the bdd works correctly
305- const bddMinimalString = bddToMinimalString ( bdd ) ;
306- const simpleBdd = minimalStringToSimpleBdd ( bddMinimalString ) ;
307- for ( const [ key , value ] of loadTruthTable ( ) . entries ( ) ) {
308- const bddValue = resolveWithSimpleBdd (
309- simpleBdd ,
310- resolvers ,
311- key
312- ) ;
313-
314- if ( value !== bddValue ) {
315- console . error ( '# Error: minimalBdd has different value compared to truth table ' + key ) ;
316- console . dir ( { value, bddValue } ) ;
317- process . exit ( - 1 ) ;
318- }
319- }
320-
321304 if ( currentBest ) {
322305 console . log (
323306 'current best bdd has ' + currentBest . countNodes ( ) + ' nodes ' +
@@ -349,9 +332,29 @@ async function run() {
349332 console . log ( 'currentOptimizeState.quality' + currentOptimizeState . quality ) ;
350333
351334 currentBest = res . bdd ;
335+
336+ // ensure correctness to have a double-check that the bdd works correctly
337+ const bddMinimalString = bddToMinimalString ( currentBest ) ;
338+ const simpleBdd = minimalStringToSimpleBdd ( bddMinimalString ) ;
339+ for ( const [ key , value ] of loadTruthTable ( ) . entries ( ) ) {
340+ const bddValue = resolveWithSimpleBdd (
341+ simpleBdd ,
342+ resolvers ,
343+ key
344+ ) ;
345+
346+ if ( value !== bddValue ) {
347+ console . error ( '# Error: minimalBdd has different value compared to truth table ' + key ) ;
348+ console . dir ( { value, bddValue } ) ;
349+ process . exit ( - 1 ) ;
350+ }
351+ }
352+
353+
354+
355+
352356 if ( quality > currentOptimizeState . quality ) {
353357 console . log ( '########## BETTER THEN BEFORE ! -> Save it' ) ;
354- const bddMinimalString = bddToMinimalString ( res . bdd ) ;
355358 console . log ( 'new string: ' + bddMinimalString ) ;
356359 writeBddTemplate (
357360 bddMinimalString ,
0 commit comments