67 METHOD(
"SPxSolver::test()" );
78 x = (*thePvec)[i] -
lhs(i);
85 return rhs(i) - (*thePvec)[i];
92 return maxObj(i) - (*thePvec)[i];
97 x =
maxObj(i) - (*thePvec)[i];
98 return (x < 0) ? x : -x;
107 METHOD(
"SPxSolver::computeTest()" );
112 int ninfeasibilities = 0;
114 for(
int i = 0; i <
coDim(); ++i)
137 MSG_INFO2(
spxout <<
"IENTER04 too many infeasibilities for sparse pricing"
141 ninfeasibilities = 0;
153 << std::setw(6) << std::fixed << std::setprecision(4)
155 << std::scientific << std::setprecision(
int(prec))
163 METHOD(
"SPxSolver::computePvec()" );
170 METHOD(
"SPxSolver::computeTest()" );
184 METHOD(
"SPxSolver::coTest()" );
212 return 0 - (*theCoPvec)[i];
221 METHOD(
"SPxSolver::computeCoTest()" );
225 int ninfeasibilities = 0;
228 for (i =
dim() - 1; i >= 0; --i)
249 MSG_INFO2(
spxout <<
"IENTER06 too many infeasibilities for sparse pricing"
253 ninfeasibilities = 0;
264 << std::setw(6) << std::fixed << std::setprecision(4)
265 << (
Real) ninfeasibilities/
dim()
278 METHOD(
"SPxSolver::updateTest()" );
286 for (i = idx.
size() - 1; i >= 0; --i)
288 int j = idx.
index(i);
311 METHOD(
"SPxSolver::updateCoTest()" );
319 for (i = idx.
size() - 1; i >= 0; --i)
321 int j = idx.
index(i);
361 METHOD(
"SPxSolver::getEnterVals()" );
367 enterIdx = number(
SPxColId(enterId));
369 assert(!isBasic(enterStat));
375 computePvec(enterIdx);
376 enterTest = computeTest(enterIdx);
377 theTest[enterIdx] = 0;
381 enterTest = coTest()[enterIdx];
382 theCoTest[enterIdx] = 0;
389 assert( rep() == COLUMN );
390 enterUB = theUCbound[enterIdx];
391 enterLB = theLCbound[enterIdx];
393 enterMax = enterLB - enterUB;
394 enterPric = (*thePvec)[enterIdx];
395 enterRO = maxObj(enterIdx);
398 else if(
EQ( enterLB, enterUB ) )
404 assert( rep() == COLUMN );
405 enterUB = theUCbound[enterIdx];
406 enterLB = theLCbound[enterIdx];
408 enterMax = enterUB - enterLB;
409 enterPric = (*thePvec)[enterIdx];
410 enterRO = maxObj(enterIdx);
413 else if(
EQ( enterLB, enterUB ) )
419 assert( rep() == COLUMN );
420 enterUB = theUCbound[enterIdx];
421 enterLB = theLCbound[enterIdx];
423 enterPric = (*thePvec)[enterIdx];
424 enterRO = maxObj(enterIdx);
431 assert( rep() == ROW );
432 assert(theUCbound[enterIdx] <
infinity);
433 enterUB = theUCbound[enterIdx];
437 enterPric = (*theCoPvec)[enterIdx];
442 assert( rep() == ROW );
443 assert(theLCbound[enterIdx] > -
infinity);
444 enterLB = theLCbound[enterIdx];
448 enterPric = (*theCoPvec)[enterIdx];
453 assert( rep() == ROW );
459 enterPric = (*theCoPvec)[enterIdx];
460 if (enterPric > enterRO)
467 assert( rep() == ROW );
468 enterPric = (*theCoPvec)[enterIdx];
471 enterLB = theLCbound[enterIdx];
480 enterUB = theUCbound[enterIdx];
491 MSG_DEBUG(
spxout <<
"DENTER03 SPxSolver::getEnterVals() : col " << enterIdx
500 enterIdx = number(
SPxRowId(enterId));
502 assert(!isBasic(enterStat));
508 computePvec(enterIdx);
509 enterTest = computeTest(enterIdx);
510 theTest[enterIdx] = 0;
514 enterTest = coTest()[enterIdx];
515 theCoTest[enterIdx] = 0;
522 assert( rep() == COLUMN );
523 enterUB = theURbound[enterIdx];
524 enterLB = theLRbound[enterIdx];
526 enterMax = enterUB - enterLB;
527 enterPric = (*theCoPvec)[enterIdx];
531 else if(
EQ( enterLB, enterUB ) )
537 assert( rep() == COLUMN );
538 enterUB = theURbound[enterIdx];
539 enterLB = theLRbound[enterIdx];
541 enterMax = enterLB - enterUB;
542 enterPric = (*theCoPvec)[enterIdx];
546 else if(
EQ( enterLB, enterUB ) )
552 assert( rep() == COLUMN );
556 MSG_ERROR(
spxout <<
"EENTER99 ERROR: not yet debugged!" << std::endl; )
557 enterPric = (*theCoPvec)[enterIdx];
565 assert( rep() == ROW );
566 assert(theURbound[enterIdx] <
infinity);
567 enterUB = theURbound[enterIdx];
571 enterPric = (*thePvec)[enterIdx];
572 enterRO = lhs(enterIdx);
576 assert( rep() == ROW );
577 assert(theLRbound[enterIdx] > -
infinity);
578 enterLB = theLRbound[enterIdx];
582 enterPric = (*thePvec)[enterIdx];
583 enterRO = rhs(enterIdx);
587 assert( rep() == ROW );
588 assert(rhs(enterIdx) == lhs(enterIdx));
592 enterPric = (*thePvec)[enterIdx];
593 enterRO = rhs(enterIdx);
598 assert( rep() == ROW );
599 enterPric = (*thePvec)[enterIdx];
600 if (enterPric > rhs(enterIdx))
602 enterLB = theLRbound[enterIdx];
606 enterRO = rhs(enterIdx);
611 enterUB = theURbound[enterIdx];
615 enterRO = lhs(enterIdx);
624 << enterIdx <<
": " << enterStat
639 METHOD(
"SPxSolver::getEnterVals2()" );
642 SPxId leftId = baseId(leaveIdx);
652 assert(rep() == ROW);
656 assert(rep() == ROW);
657 leavebound = theLBbound[leaveIdx];
658 theLRbound[idx] = leavebound;
662 assert(rep() == ROW);
663 leavebound = theUBbound[leaveIdx];
664 theURbound[idx] = leavebound;
668 assert(rep() == ROW);
672 MSG_ERROR(
spxout <<
"EENTER98 ERROR: not yet debugged!" << std::endl; )
673 if ((*theCoPvec)[leaveIdx] - theLBbound[leaveIdx] <
674 theUBbound[leaveIdx] - (*theCoPvec)[leaveIdx])
676 leavebound = theLBbound[leaveIdx];
677 theLRbound[idx] = leavebound;
681 leavebound = theUBbound[leaveIdx];
682 theURbound[idx] = leavebound;
689 assert(rep() == COLUMN);
693 assert(rep() == COLUMN);
694 if (theFvec->delta()[leaveIdx] * enterMax < 0)
695 leavebound = theUBbound[leaveIdx];
697 leavebound = theLBbound[leaveIdx];
698 theLRbound[idx] = leavebound;
699 theURbound[idx] = leavebound;
703 assert(rep() == COLUMN);
704 leavebound = theUBbound[leaveIdx];
705 theURbound[idx] = leavebound;
709 assert(rep() == COLUMN);
710 leavebound = theLBbound[leaveIdx];
711 theLRbound[idx] = leavebound;
715 assert(rep() == COLUMN);
716 if (enterMax * theFvec->delta()[leaveIdx] < 0)
718 leavebound = theUBbound[leaveIdx];
719 theURbound[idx] = leavebound;
724 leavebound = theLBbound[leaveIdx];
725 theLRbound[idx] = leavebound;
734 << idx <<
": " << leaveStat
748 assert(rep() == ROW);
749 leavebound = theLBbound[leaveIdx];
750 theLCbound[idx] = leavebound;
754 assert(rep() == ROW);
755 leavebound = theUBbound[leaveIdx];
756 theUCbound[idx] = leavebound;
760 assert(rep() == ROW);
761 if (theFvec->delta()[leaveIdx] * enterMax > 0)
763 leavebound = theLBbound[leaveIdx];
764 theLCbound[idx] = leavebound;
768 leavebound = theUBbound[leaveIdx];
769 theUCbound[idx] = leavebound;
774 assert(rep() == ROW);
779 assert(rep() == COLUMN);
780 if (theFvec->delta()[leaveIdx] * enterMax > 0)
781 leavebound = theLBbound[leaveIdx];
783 leavebound = theUBbound[leaveIdx];
785 theLCbound[idx] = leavebound;
789 assert(rep() == COLUMN);
790 leavebound = theLBbound[leaveIdx];
791 theLCbound[idx] = leavebound;
795 assert(rep() == COLUMN);
796 leavebound = theUBbound[leaveIdx];
797 theUCbound[idx] = leavebound;
802 assert(rep() == COLUMN);
803 if (enterMax * theFvec->delta()[leaveIdx] < 0)
805 leavebound = theUBbound[leaveIdx];
806 theUCbound[idx] = leavebound;
811 leavebound = theLBbound[leaveIdx];
812 theLCbound[idx] = leavebound;
821 << idx <<
": " << leaveStat
836 METHOD(
"SPxSolver::ungetEnterVal()" );
842 enterIdx = number(
SPxColId(enterId));
847 theFrhs->multAdd(leaveVal, vec);
851 enterIdx = number(
SPxRowId(enterId));
857 (*theFrhs)[enterIdx] += leaveVal;
860 theTest[enterIdx] = 0;
862 theCoTest[enterIdx] = 0;
871 METHOD(
"SPxSolver::rejectEnter()" );
872 int enterIdx =
number(enterId);
887 METHOD(
"SPxSolver::enter()" );
904 enterVal, enterMax, enterPric, enterStat, enterRO);
911 MSG_DEBUG(
spxout <<
"DENTER08 rejecting false enter pivot" << std::endl; )
926 #ifdef ENABLE_ADDITIONAL_CHECKS
940 << tmp.
length() << std::endl; )
953 Real leaveVal = -enterMax;
982 (*theCoPrhs)[leaveIdx] = enterRO;
1025 (*theFvec)[leaveIdx] = enterVal - leaveVal;
1039 else if (leaveVal != -enterMax)
1051 else if (leaveVal < infinity && leaveVal > -
infinity)
1054 assert(leaveVal == -enterMax);
1056 change(-1, enterId, enterVec);
1078 <<
"enter() for feasibility test" << std::endl; )
1088 <<
"enter()" << std::endl; )
1096 sign = (leaveVal > 0 ? -1.0 : 1.0);
1102 if(
id.isSPxRowId() )
1118 sign = leaveVal > 0 ? 1.0 : -1.0;