gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Small improvements in NS pivot rules (#298)
0 1 0
default
1 file changed with 26 insertions and 34 deletions:
↑ Collapse diff ↑
Show white space 2 line context
... ...
@@ -366,3 +366,3 @@
366 366
        int cnt = _block_size;
367
        int e, min_arc = _next_arc;
367
        int e;
368 368
        for (e = _next_arc; e < _search_arc_num; ++e) {
... ...
@@ -371,6 +371,6 @@
371 371
            min = c;
372
            min_arc = e;
372
            _in_arc = e;
373 373
          }
374 374
          if (--cnt == 0) {
375
            if (min < 0) break;
375
            if (min < 0) goto search_end;
376 376
            cnt = _block_size;
... ...
@@ -378,3 +378,2 @@
378 378
        }
379
        if (min == 0 || cnt > 0) {
380 379
          for (e = 0; e < _next_arc; ++e) {
... ...
@@ -383,6 +382,6 @@
383 382
              min = c;
384
              min_arc = e;
383
            _in_arc = e;
385 384
            }
386 385
            if (--cnt == 0) {
387
              if (min < 0) break;
386
            if (min < 0) goto search_end;
388 387
              cnt = _block_size;
... ...
@@ -390,5 +389,5 @@
390 389
          }
391
        }
392 390
        if (min >= 0) return false;
393
        _in_arc = min_arc;
391

	
392
      search_end:
394 393
        _next_arc = e;
... ...
@@ -430,3 +429,3 @@
430 429
        // The main parameters of the pivot rule
431
        const double LIST_LENGTH_FACTOR = 1.0;
430
        const double LIST_LENGTH_FACTOR = 0.25;
432 431
        const int MIN_LIST_LENGTH = 10;
... ...
@@ -447,3 +446,3 @@
447 446
        Cost min, c;
448
        int e, min_arc = _next_arc;
447
        int e;
449 448
        if (_curr_length > 0 && _minor_count < _minor_limit) {
... ...
@@ -458,5 +457,5 @@
458 457
              min = c;
459
              min_arc = e;
458
              _in_arc = e;
460 459
            }
461
            if (c >= 0) {
460
            else if (c >= 0) {
462 461
              _candidates[i--] = _candidates[--_curr_length];
... ...
@@ -464,6 +463,3 @@
464 463
          }
465
          if (min < 0) {
466
            _in_arc = min_arc;
467
            return true;
468
          }
464
          if (min < 0) return true;
469 465
        }
... ...
@@ -479,8 +475,7 @@
479 475
              min = c;
480
              min_arc = e;
476
              _in_arc = e;
481 477
            }
482
            if (_curr_length == _list_length) break;
478
            if (_curr_length == _list_length) goto search_end;
483 479
          }
484 480
        }
485
        if (_curr_length < _list_length) {
486 481
          for (e = 0; e < _next_arc; ++e) {
... ...
@@ -491,6 +486,5 @@
491 486
                min = c;
492
                min_arc = e;
487
              _in_arc = e;
493 488
              }
494
              if (_curr_length == _list_length) break;
495
            }
489
            if (_curr_length == _list_length) goto search_end;
496 490
          }
... ...
@@ -498,4 +492,5 @@
498 492
        if (_curr_length == 0) return false;
493
      
494
      search_end:        
499 495
        _minor_count = 1;
500
        _in_arc = min_arc;
501 496
        _next_arc = e;
... ...
@@ -551,3 +546,3 @@
551 546
        // The main parameters of the pivot rule
552
        const double BLOCK_SIZE_FACTOR = 1.5;
547
        const double BLOCK_SIZE_FACTOR = 1.0;
553 548
        const int MIN_BLOCK_SIZE = 10;
... ...
@@ -580,6 +575,5 @@
580 575
        int cnt = _block_size;
581
        int last_arc = 0;
582 576
        int limit = _head_length;
583 577

	
584
        for (int e = _next_arc; e < _search_arc_num; ++e) {
578
        for (e = _next_arc; e < _search_arc_num; ++e) {
585 579
          _cand_cost[e] = _state[e] *
... ...
@@ -588,6 +582,5 @@
588 582
            _candidates[_curr_length++] = e;
589
            last_arc = e;
590 583
          }
591 584
          if (--cnt == 0) {
592
            if (_curr_length > limit) break;
585
            if (_curr_length > limit) goto search_end;
593 586
            limit = 0;
... ...
@@ -596,4 +589,3 @@
596 589
        }
597
        if (_curr_length <= limit) {
598
          for (int e = 0; e < _next_arc; ++e) {
590
        for (e = 0; e < _next_arc; ++e) {
599 591
            _cand_cost[e] = _state[e] *
... ...
@@ -602,6 +594,5 @@
602 594
              _candidates[_curr_length++] = e;
603
              last_arc = e;
604 595
            }
605 596
            if (--cnt == 0) {
606
              if (_curr_length > limit) break;
597
            if (_curr_length > limit) goto search_end;
607 598
              limit = 0;
... ...
@@ -610,5 +601,5 @@
610 601
          }
611
        }
612 602
        if (_curr_length == 0) return false;
613
        _next_arc = last_arc + 1;
603
        
604
      search_end:
614 605

	
... ...
@@ -620,2 +611,3 @@
620 611
        _in_arc = _candidates[0];
612
        _next_arc = e;
621 613
        pop_heap( _candidates.begin(), _candidates.begin() + _curr_length,
0 comments (0 inline)