void RKPluginSaveObject::update () {
	RK_TRACE (PLUGIN);

	if (isSatisfied ()) selector->setBackgroundColor (QColor (255, 255, 255));
	else selector->setBackgroundColor (QColor (255, 0, 0));
	changed ();
}
void RKVarSlot::updateLook () {
	RK_TRACE (PLUGIN);

	if (isEnabled ()) {
		if (!isSatisfied ()) {
			list->setPaletteBackgroundColor (QColor (255, 0, 0));
		} else {
			list->setPaletteBackgroundColor (QColor (255, 255, 255));
		}
	} else {
		if (!isSatisfied ()) {
			list->setPaletteBackgroundColor (QColor (200, 0, 0));
		} else {
			list->setPaletteBackgroundColor (QColor (200, 200, 200));
		}
	}
}
Example #3
0
//==============================================================================
double GoalRegion::distanceGoal(const ::ompl::base::State* _state) const
{
  if (isSatisfied(_state))
  {
    return 0;
  }
  return std::numeric_limits<double>::infinity();
}
void RKPluginBrowser::updateColor () {
	RK_TRACE (PLUGIN);

	if (isEnabled ()) {
		if (isSatisfied ()) {
			selector->setBackgroundColor (QColor (255, 255, 255));
		} else {
			selector->setBackgroundColor (QColor (255, 0, 0));
		}
	} else {
		selector->setBackgroundColor (QColor (200, 200, 200));
	}
}
Example #5
0
 bool ReplicaSetTagMatch::update(const ReplicaSetTag& tag) {
     const std::vector<BoundTagValue>::iterator iter = std::find_if(
             _boundTagValues.begin(),
             _boundTagValues.end(),
             stdx::bind(std::equal_to<int32_t>(), tag.getKeyIndex(), stdx::bind(
                                &BoundTagValue::getKeyIndex, stdx::placeholders::_1)));
     if (iter != _boundTagValues.end()) {
         if (!sequenceContains(iter->boundValues, tag.getValueIndex())) {
             iter->boundValues.push_back(tag.getValueIndex());
         }
     }
     return isSatisfied();
 }
void AltComponentAnalyzer::recordComponentOf(const VariableIndex var) {

    search_stack_.clear();
    setSeenAndStoreInSearchStack(var);

    for (auto vt = search_stack_.begin(); vt != search_stack_.end(); vt++) {
        //BEGIN traverse binary clauses
        assert(isActive(*vt));
        unsigned *p = beginOfLinkList(*vt);
        for (; *p; p++) {
            if(manageSearchOccurrenceOf(LiteralID(*p,true))) {
                var_frequency_scores_[*p]++;
                var_frequency_scores_[*vt]++;
            }
        }
        //END traverse binary clauses

        for ( p++; *p ; p+=3) {
            if(archetype_.clause_unseen_in_sup_comp(*p)) {
                LiteralID litA = *reinterpret_cast<const LiteralID *>(p + 1);
                LiteralID litB = *(reinterpret_cast<const LiteralID *>(p + 1) + 1);
                if(isSatisfied(litA)|| isSatisfied(litB))
                    archetype_.setClause_nil(*p);
                else {
                    var_frequency_scores_[*vt]++;
                    manageSearchOccurrenceAndScoreOf(litA);
                    manageSearchOccurrenceAndScoreOf(litB);
                    archetype_.setClause_seen(*p,isActive(litA) &
                                              isActive(litB));
                }
            }
        }
        //END traverse ternary clauses

        for (p++; *p ; p +=2)
            if(archetype_.clause_unseen_in_sup_comp(*p))
                searchClause(*vt,*p, reinterpret_cast<LiteralID *>(p + 1 + *(p+1)));
    }
}
Example #7
0
bool Solver::BCP(unsigned start_at_stack_ofs) {
	for (unsigned int i = start_at_stack_ofs; i < literal_stack_.size(); i++) {
		LiteralID unLit = literal_stack_[i].neg();
		//BEGIN Propagate Bin Clauses
		for (auto bt = literal(unLit).binary_links_.begin();
				*bt != SENTINEL_LIT; bt++) {
			if (isResolved(*bt)) {
				setConflictState(unLit, *bt);
				return false;
			}
			setLiteralIfFree(*bt, Antecedent(unLit));
		}
		//END Propagate Bin Clauses
		for (auto itcl = literal(unLit).watch_list_.rbegin();
				*itcl != SENTINEL_CL; itcl++) {
			bool isLitA = (*beginOf(*itcl) == unLit);
			auto p_watchLit = beginOf(*itcl) + 1 - isLitA;
			auto p_otherLit = beginOf(*itcl) + isLitA;

			if (isSatisfied(*p_otherLit))
				continue;
			auto itL = beginOf(*itcl) + 2;
			while (isResolved(*itL))
				itL++;
			// either we found a free or satisfied lit
			if (*itL != SENTINEL_LIT) {
				literal(*itL).addWatchLinkTo(*itcl);
				swap(*itL, *p_watchLit);
				*itcl = literal(unLit).watch_list_.back();
				literal(unLit).watch_list_.pop_back();
			} else {
				// or p_unLit stays resolved
				// and we have hence no free literal left
				// for p_otherLit remain poss: Active or Resolved
				if (setLiteralIfFree(*p_otherLit, Antecedent(*itcl))) { // implication
					if (isLitA)
						swap(*p_otherLit, *p_watchLit);
				} else {
					setConflictState(*itcl);
					return false;
				}
			}
		}
	}
	return true;
}
Example #8
0
void RKInput::updateColor () {
	RK_TRACE (PLUGIN);

	QWidget *widget = lineedit;
	if (!widget) widget = textedit;
	RK_ASSERT (widget);

	QPalette palette = widget->palette ();
	if (isEnabled ()) {
		if (isSatisfied ()) {
			palette.setColor (widget->backgroundRole (), QColor (255, 255, 255));
		} else {
			palette.setColor (widget->backgroundRole (), QColor (255, 0, 0));
		}
	} else {
		palette.setColor (widget->backgroundRole (), QColor (200, 200, 200));
	}
	widget->setPalette (palette);
}
 virtual bool isComplete() const
 {
     return isSatisfied();
 }
Example #10
0
bool KauthamDEGoalRegion::isSatisfied(const ob::State *st) const
{
    return isSatisfied(st, NULL);
}
Example #11
0
bool ompl::base::Goal::isSatisfied(const State *st, double *distance) const
{
    if (distance != nullptr)
        *distance = std::numeric_limits<double>::max();
    return isSatisfied(st);
}
Example #12
0
// this is IBCP 30.08
bool Solver::implicitBCP() {
	static vector<LiteralID> test_lits(num_variables());
	static LiteralIndexedVector<unsigned char> viewed_lits(num_variables() + 1,
			0);

	unsigned stack_ofs = stack_.top().literal_stack_ofs();
	unsigned num_curr_lits = 0;
	while (stack_ofs < literal_stack_.size()) {
		test_lits.clear();
		for (auto it = literal_stack_.begin() + stack_ofs;
				it != literal_stack_.end(); it++) {
			for (auto cl_ofs : occurrence_lists_[it->neg()])
				if (!isSatisfied(cl_ofs)) {
					for (auto lt = beginOf(cl_ofs); *lt != SENTINEL_LIT; lt++)
						if (isActive(*lt) && !viewed_lits[lt->neg()]) {
							test_lits.push_back(lt->neg());
							viewed_lits[lt->neg()] = true;

						}
				}
		}
		num_curr_lits = literal_stack_.size() - stack_ofs;
		stack_ofs = literal_stack_.size();
		for (auto jt = test_lits.begin(); jt != test_lits.end(); jt++)
			viewed_lits[*jt] = false;

		vector<float> scores;
		scores.clear();
		for (auto jt = test_lits.begin(); jt != test_lits.end(); jt++) {
			scores.push_back(literal(*jt).activity_score_);
		}
		sort(scores.begin(), scores.end());
		num_curr_lits = 10 + num_curr_lits / 20;
		float threshold = 0.0;
		if (scores.size() > num_curr_lits) {
			threshold = scores[scores.size() - num_curr_lits];
		}

		statistics_.num_failed_literal_tests_ += test_lits.size();

		for (auto lit : test_lits)
			if (isActive(lit) && threshold <= literal(lit).activity_score_) {
				unsigned sz = literal_stack_.size();
				// we increase the decLev artificially
				// s.t. after the tentative BCP call, we can learn a conflict clause
				// relative to the assignment of *jt
				stack_.startFailedLitTest();
				setLiteralIfFree(lit);

				assert(!hasAntecedent(lit));

				bool bSucceeded = BCP(sz);
				if (!bSucceeded)
					recordAllUIPCauses();

				stack_.stopFailedLitTest();

				while (literal_stack_.size() > sz) {
					unSet(literal_stack_.back());
					literal_stack_.pop_back();
				}

				if (!bSucceeded) {
					statistics_.num_failed_literals_detected_++;
					sz = literal_stack_.size();
					for (auto it = uip_clauses_.rbegin();
							it != uip_clauses_.rend(); it++) {
						// DEBUG
						if (it->size() == 0)
							cout << "EMPTY CLAUSE FOUND" << endl;
						// END DEBUG
						setLiteralIfFree(it->front(),
								addUIPConflictClause(*it));
					}
					if (!BCP(sz))
						return false;
				}
			}
	}

	// BEGIN TEST
//	float max_score = -1;
//	float score;
//	unsigned max_score_var = 0;
//	for (auto it =
//			component_analyzer_.superComponentOf(stack_.top()).varsBegin();
//			*it != varsSENTINEL; it++)
//		if (isActive(*it)) {
//			score = scoreOf(*it);
//			if (score > max_score) {
//				max_score = score;
//				max_score_var = *it;
//			}
//		}
//	LiteralID theLit(max_score_var,
//			literal(LiteralID(max_score_var, true)).activity_score_
//					> literal(LiteralID(max_score_var, false)).activity_score_);
//	if (!fail_test(theLit.neg())) {
//		cout << ".";
//
//		statistics_.num_failed_literals_detected_++;
//		unsigned sz = literal_stack_.size();
//		for (auto it = uip_clauses_.rbegin(); it != uip_clauses_.rend(); it++) {
//			setLiteralIfFree(it->front(), addUIPConflictClause(*it));
//		}
//		if (!BCP(sz))
//			return false;
//
//	}
	// END
	return true;
}
Example #13
0
 bool OMPLGoalState::isSatisfied(const ompl::base::State *st) const
 {
   return isSatisfied(st, NULL);
 }