@@ -301,23 +301,6 @@ async function run() {
301
301
console . log ( 'Last better bdd found ' + roundToTwoDecimals ( lastBetterHours ) + 'hours ago' ) ;
302
302
bdd . removeIrrelevantLeafNodes ( unknownValueActionId ) ;
303
303
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
-
321
304
if ( currentBest ) {
322
305
console . log (
323
306
'current best bdd has ' + currentBest . countNodes ( ) + ' nodes ' +
@@ -349,9 +332,29 @@ async function run() {
349
332
console . log ( 'currentOptimizeState.quality' + currentOptimizeState . quality ) ;
350
333
351
334
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
+
352
356
if ( quality > currentOptimizeState . quality ) {
353
357
console . log ( '########## BETTER THEN BEFORE ! -> Save it' ) ;
354
- const bddMinimalString = bddToMinimalString ( res . bdd ) ;
355
358
console . log ( 'new string: ' + bddMinimalString ) ;
356
359
writeBddTemplate (
357
360
bddMinimalString ,
0 commit comments