... |
... |
@@ -533,11 +533,13 @@
|
533 |
533 |
GlpkLp::GlpkLp()
|
534 |
534 |
: LpBase(), LpSolver(), GlpkBase() {
|
535 |
535 |
messageLevel(MESSAGE_NO_OUTPUT);
|
|
536 |
presolver(false);
|
536 |
537 |
}
|
537 |
538 |
|
538 |
539 |
GlpkLp::GlpkLp(const GlpkLp& other)
|
539 |
540 |
: LpBase(other), LpSolver(other), GlpkBase(other) {
|
540 |
541 |
messageLevel(MESSAGE_NO_OUTPUT);
|
|
542 |
presolver(false);
|
541 |
543 |
}
|
542 |
544 |
|
543 |
545 |
GlpkLp* GlpkLp::newSolver() const { return new GlpkLp; }
|
... |
... |
@@ -574,8 +576,24 @@
|
574 |
576 |
smcp.msg_lev = GLP_MSG_ALL;
|
575 |
577 |
break;
|
576 |
578 |
}
|
|
579 |
smcp.presolve = _presolve;
|
577 |
580 |
|
|
581 |
// If the basis is not valid we get an error return value.
|
|
582 |
// In this case we can try to create a new basis.
|
|
583 |
switch (glp_simplex(lp, &smcp)) {
|
|
584 |
case 0:
|
|
585 |
break;
|
|
586 |
case GLP_EBADB:
|
|
587 |
case GLP_ESING:
|
|
588 |
case GLP_ECOND:
|
|
589 |
lpx_set_int_parm(lp, LPX_K_MSGLEV, smcp.msg_lev);
|
|
590 |
glp_adv_basis(lp, 0);
|
578 |
591 |
if (glp_simplex(lp, &smcp) != 0) return UNSOLVED;
|
|
592 |
break;
|
|
593 |
default:
|
|
594 |
return UNSOLVED;
|
|
595 |
}
|
|
596 |
|
579 |
597 |
return SOLVED;
|
580 |
598 |
}
|
581 |
599 |
|
... |
... |
@@ -600,8 +618,23 @@
|
600 |
618 |
break;
|
601 |
619 |
}
|
602 |
620 |
smcp.meth = GLP_DUAL;
|
|
621 |
smcp.presolve = _presolve;
|
603 |
622 |
|
|
623 |
// If the basis is not valid we get an error return value.
|
|
624 |
// In this case we can try to create a new basis.
|
|
625 |
switch (glp_simplex(lp, &smcp)) {
|
|
626 |
case 0:
|
|
627 |
break;
|
|
628 |
case GLP_EBADB:
|
|
629 |
case GLP_ESING:
|
|
630 |
case GLP_ECOND:
|
|
631 |
lpx_set_int_parm(lp, LPX_K_MSGLEV, smcp.msg_lev);
|
|
632 |
glp_adv_basis(lp, 0);
|
604 |
633 |
if (glp_simplex(lp, &smcp) != 0) return UNSOLVED;
|
|
634 |
break;
|
|
635 |
default:
|
|
636 |
return UNSOLVED;
|
|
637 |
}
|
605 |
638 |
return SOLVED;
|
606 |
639 |
}
|
607 |
640 |
|
... |
... |
@@ -819,8 +852,8 @@
|
819 |
852 |
}
|
820 |
853 |
}
|
821 |
854 |
|
822 |
|
void GlpkLp::presolver(bool b) {
|
823 |
|
lpx_set_int_parm(lp, LPX_K_PRESOL, b ? 1 : 0);
|
|
855 |
void GlpkLp::presolver(bool presolve) {
|
|
856 |
_presolve = presolve;
|
824 |
857 |
}
|
825 |
858 |
|
826 |
859 |
void GlpkLp::messageLevel(MessageLevel m) {
|
... |
... |
@@ -881,7 +914,22 @@
|
881 |
914 |
}
|
882 |
915 |
smcp.meth = GLP_DUAL;
|
883 |
916 |
|
|
917 |
// If the basis is not valid we get an error return value.
|
|
918 |
// In this case we can try to create a new basis.
|
|
919 |
switch (glp_simplex(lp, &smcp)) {
|
|
920 |
case 0:
|
|
921 |
break;
|
|
922 |
case GLP_EBADB:
|
|
923 |
case GLP_ESING:
|
|
924 |
case GLP_ECOND:
|
|
925 |
lpx_set_int_parm(lp, LPX_K_MSGLEV, smcp.msg_lev);
|
|
926 |
glp_adv_basis(lp, 0);
|
884 |
927 |
if (glp_simplex(lp, &smcp) != 0) return UNSOLVED;
|
|
928 |
break;
|
|
929 |
default:
|
|
930 |
return UNSOLVED;
|
|
931 |
}
|
|
932 |
|
885 |
933 |
if (glp_get_status(lp) != GLP_OPT) return SOLVED;
|
886 |
934 |
|
887 |
935 |
glp_iocp iocp;
|