本文整理汇总了C++中UpdateInfo::errorsChange方法的典型用法代码示例。如果您正苦于以下问题:C++ UpdateInfo::errorsChange方法的具体用法?C++ UpdateInfo::errorsChange怎么用?C++ UpdateInfo::errorsChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UpdateInfo
的用法示例。
在下文中一共展示了UpdateInfo::errorsChange方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: debugCheckWitness
bool FCSimplexDecisionProcedure::debugCheckWitness(const UpdateInfo& inf, WitnessImprovement w, bool useBlands){
if(inf.getWitness(useBlands) == w){
switch(w){
case ConflictFound: return inf.foundConflict();
case ErrorDropped: return inf.errorsChange() < 0;
case FocusImproved: return inf.focusDirection() > 0;
case FocusShrank: return false; // This is not a valid output
case Degenerate: return false; // This is not a valid output
case BlandsDegenerate: return useBlands;
case HeuristicDegenerate: return !useBlands;
case AntiProductive: return false;
}
}
return false;
}
示例2: updateAndSignal
void FCSimplexDecisionProcedure::updateAndSignal(const UpdateInfo& selected, WitnessImprovement w){
ArithVar nonbasic = selected.nonbasic();
static bool verbose = false;
Debug("updateAndSignal") << "updateAndSignal " << selected << endl;
stringstream ss;
if(verbose){
d_errorSet.debugPrint(ss);
if(selected.describesPivot()){
ArithVar leaving = selected.leaving();
ss << "leaving " << leaving
<< " " << d_tableau.basicRowLength(leaving)
<< " " << d_linEq.debugBasicAtBoundCount(leaving)
<< endl;
}
if(degenerate(w) && selected.describesPivot()){
ArithVar leaving = selected.leaving();
Message()
<< "degenerate " << leaving
<< ", atBounds " << d_linEq.basicsAtBounds(selected)
<< ", len " << d_tableau.basicRowLength(leaving)
<< ", bc " << d_linEq.debugBasicAtBoundCount(leaving)
<< endl;
}
}
if(selected.describesPivot()){
ConstraintP limiting = selected.limiting();
ArithVar basic = limiting->getVariable();
Assert(d_linEq.basicIsTracked(basic));
d_linEq.pivotAndUpdate(basic, nonbasic, limiting->getValue());
}else{
Assert(!selected.unbounded() || selected.errorsChange() < 0);
DeltaRational newAssignment =
d_variables.getAssignment(nonbasic) + selected.nonbasicDelta();
d_linEq.updateTracked(nonbasic, newAssignment);
}
d_pivots++;
increaseLeavingCount(nonbasic);
vector< pair<ArithVar, int> > focusChanges;
while(d_errorSet.moreSignals()){
ArithVar updated = d_errorSet.topSignal();
int prevFocusSgn = d_errorSet.popSignal();
if(d_tableau.isBasic(updated)){
Assert(!d_variables.assignmentIsConsistent(updated) == d_errorSet.inError(updated));
if(Debug.isOn("updateAndSignal")){debugPrintSignal(updated);}
if(!d_variables.assignmentIsConsistent(updated)){
if(checkBasicForConflict(updated)){
reportConflict(updated);
Assert(debugUpdatedBasic(selected, updated));
}
}
}else{
Debug("updateAndSignal") << "updated nonbasic " << updated << endl;
}
int currFocusSgn = d_errorSet.focusSgn(updated);
if(currFocusSgn != prevFocusSgn){
int change = currFocusSgn - prevFocusSgn;
focusChanges.push_back(make_pair(updated, change));
}
}
if(verbose){
Message() << "conflict variable " << selected << endl;
Message() << ss.str();
}
if(Debug.isOn("error")){ d_errorSet.debugPrint(Debug("error")); }
Assert(debugSelectedErrorDropped(selected, d_errorSize, d_errorSet.errorSize()));
adjustFocusAndError(selected, focusChanges);
}
示例3: debugSelectedErrorDropped
bool debugSelectedErrorDropped(const UpdateInfo& selected, int32_t prevErrorSize, int32_t currErrorSize){
int diff = currErrorSize - prevErrorSize;
return selected.foundConflict() || diff == selected.errorsChange();
}
示例4: selectPrimalUpdate
//.........这里部分代码省略.........
bool candidate =
(curr_movement > 0 && d_variables.cmpAssignmentUpperBound(curr) < 0) ||
(curr_movement < 0 && d_variables.cmpAssignmentLowerBound(curr) > 0);
Debug("arith::selectPrimalUpdate")
<< "storing " << basic
<< " " << curr
<< " " << candidate
<< " " << e.getCoefficient()
<< " " << curr_movement
<< " " << focusCoefficient(curr) << endl;
if(!candidate) { continue; }
if(!isFocus){
const Rational& focusC = focusCoefficient(curr);
Assert(dualLike || !focusC.isZero());
if(dualLike && curr_movement != focusC.sgn()){
Debug("arith::selectPrimalUpdate") << "sgn disagreement " << curr << endl;
d_sgnDisagreements.push_back(curr);
continue;
}else{
candidates.push_back(Cand(curr, penalty(curr), curr_movement, &focusC));
}
}else{
candidates.push_back(Cand(curr, penalty(curr), curr_movement, &e.getCoefficient()));
}
}
CompPenaltyColLength colCmp(&d_linEq);
CandVector::iterator i = candidates.begin();
CandVector::iterator end = candidates.end();
std::make_heap(i, end, colCmp);
bool checkEverything = d_pivots == 0;
int candidatesAfterFocusImprove = 0;
while(i != end && (checkEverything || candidatesAfterFocusImprove <= s_maxCandidatesAfterImprove)){
std::pop_heap(i, end, colCmp);
--end;
Cand& cand = (*end);
ArithVar curr = cand.d_nb;
const Rational& coeff = *cand.d_coeff;
LinearEqualityModule::UpdatePreferenceFunction leavingPrefFunc = selectLeavingFunction(curr);
UpdateInfo currProposal = d_linEq.speculativeUpdate(curr, coeff, leavingPrefFunc);
Debug("arith::selectPrimalUpdate")
<< "selected " << selected << endl
<< "currProp " << currProposal << endl
<< "coeff " << coeff << endl;
Assert(!currProposal.uninitialized());
if(candidatesAfterFocusImprove > 0){
candidatesAfterFocusImprove++;
}
if(selected.uninitialized() || (d_linEq.*upf)(selected, currProposal)){
selected = currProposal;
WitnessImprovement w = selected.getWitness(false);
Debug("arith::selectPrimalUpdate") << "selected " << w << endl;
setPenalty(curr, w);
if(improvement(w)){
bool exitEarly;
switch(w){
case ConflictFound: exitEarly = true; break;
case ErrorDropped:
if(checkEverything){
exitEarly = d_errorSize + selected.errorsChange() == 0;
Debug("arith::selectPrimalUpdate")
<< "ee " << d_errorSize << " "
<< selected.errorsChange() << " "
<< d_errorSize + selected.errorsChange() << endl;
}else{
exitEarly = true;
}
break;
case FocusImproved:
candidatesAfterFocusImprove = 1;
exitEarly = false;
break;
default:
exitEarly = false; break;
}
if(exitEarly){ break; }
}
}else{
Debug("arith::selectPrimalUpdate") << "dropped "<< endl;
}
}
if(!isFocus){
unloadFocusSigns();
}
return selected;
}