... | ... |
@@ -577,26 +577,27 @@ |
577 | 577 |
break; |
578 | 578 |
} |
579 | 579 |
smcp.presolve = _presolve; |
580 | 580 |
|
581 | 581 |
// If the basis is not valid we get an error return value. |
582 | 582 |
// In this case we can try to create a new basis. |
583 | 583 |
switch (glp_simplex(lp, &smcp)) { |
584 | 584 |
case 0: |
585 | 585 |
break; |
586 | 586 |
case GLP_EBADB: |
587 | 587 |
case GLP_ESING: |
588 | 588 |
case GLP_ECOND: |
589 |
|
|
589 |
glp_term_out(false); |
|
590 | 590 |
glp_adv_basis(lp, 0); |
591 |
glp_term_out(true); |
|
591 | 592 |
if (glp_simplex(lp, &smcp) != 0) return UNSOLVED; |
592 | 593 |
break; |
593 | 594 |
default: |
594 | 595 |
return UNSOLVED; |
595 | 596 |
} |
596 | 597 |
|
597 | 598 |
return SOLVED; |
598 | 599 |
} |
599 | 600 |
|
600 | 601 |
GlpkLp::SolveExitStatus GlpkLp::solveDual() { |
601 | 602 |
_clear_temporals(); |
602 | 603 |
|
... | ... |
@@ -619,26 +620,27 @@ |
619 | 620 |
} |
620 | 621 |
smcp.meth = GLP_DUAL; |
621 | 622 |
smcp.presolve = _presolve; |
622 | 623 |
|
623 | 624 |
// If the basis is not valid we get an error return value. |
624 | 625 |
// In this case we can try to create a new basis. |
625 | 626 |
switch (glp_simplex(lp, &smcp)) { |
626 | 627 |
case 0: |
627 | 628 |
break; |
628 | 629 |
case GLP_EBADB: |
629 | 630 |
case GLP_ESING: |
630 | 631 |
case GLP_ECOND: |
631 |
|
|
632 |
glp_term_out(false); |
|
632 | 633 |
glp_adv_basis(lp, 0); |
634 |
glp_term_out(true); |
|
633 | 635 |
if (glp_simplex(lp, &smcp) != 0) return UNSOLVED; |
634 | 636 |
break; |
635 | 637 |
default: |
636 | 638 |
return UNSOLVED; |
637 | 639 |
} |
638 | 640 |
return SOLVED; |
639 | 641 |
} |
640 | 642 |
|
641 | 643 |
GlpkLp::Value GlpkLp::_getPrimal(int i) const { |
642 | 644 |
return glp_get_col_prim(lp, i); |
643 | 645 |
} |
644 | 646 |
|
... | ... |
@@ -913,26 +915,27 @@ |
913 | 915 |
break; |
914 | 916 |
} |
915 | 917 |
smcp.meth = GLP_DUAL; |
916 | 918 |
|
917 | 919 |
// If the basis is not valid we get an error return value. |
918 | 920 |
// In this case we can try to create a new basis. |
919 | 921 |
switch (glp_simplex(lp, &smcp)) { |
920 | 922 |
case 0: |
921 | 923 |
break; |
922 | 924 |
case GLP_EBADB: |
923 | 925 |
case GLP_ESING: |
924 | 926 |
case GLP_ECOND: |
925 |
|
|
927 |
glp_term_out(false); |
|
926 | 928 |
glp_adv_basis(lp, 0); |
929 |
glp_term_out(true); |
|
927 | 930 |
if (glp_simplex(lp, &smcp) != 0) return UNSOLVED; |
928 | 931 |
break; |
929 | 932 |
default: |
930 | 933 |
return UNSOLVED; |
931 | 934 |
} |
932 | 935 |
|
933 | 936 |
if (glp_get_status(lp) != GLP_OPT) return SOLVED; |
934 | 937 |
|
935 | 938 |
glp_iocp iocp; |
936 | 939 |
glp_init_iocp(&iocp); |
937 | 940 |
|
938 | 941 |
switch (_message_level) { |
0 comments (0 inline)