stateLst runStateBCD (actualStatePtr actual, const int vp, const int vmax, const int vmin, const int iv) { stateDscPtr tmp = actual->state; // at leat on of the values > corresponding istant threshold --> instant state upgraded! if ((vp > tmp->vp) || (vmax > tmp->vmax) || (vmin > tmp->vmin) || (iv > tmp->iv)) // let's see if we can upgrade activity state... upgradeState (actual, tmp); else { // all values <= corresponding previuos instant threshold --> instant state downgraded! if ((vp <= (prevState (tmp->level))->vp) && (vmax <= (prevState (tmp->level))->vmax) && (vmin <= (prevState (tmp->level))->vmin) && (iv <= (prevState (tmp->level))->iv)) // let's see if we can downgrade activity state... downgradeState (actual, tmp); // instant state has not changed! else resetState (actual, tmp); } return (actual->state)->level; }
void Tracker::predict() { predictedState(0) = prevState(0) + prevState(3)*deltaT; predictedState(1) = prevState(0) + prevState(4)*deltaT; predictedState(2) = prevState(0) + prevState(5)*deltaT; predictedState(3) = prevState(0) ; predictedState(4) = prevState(0) ; predictedState(5) = prevState(0) ; predCov = G*prevCov*G.inverse() + R; }
void stepRight(void) { // if (posX > MAX_X) // { // return; // } posX++; intDecrement = INTDEC_INIT;; TIMSK0 |= _BV(TOIE0); stepSequence[AXIS_Y] = prevState(stepSequence[AXIS_Y]); coilState(AXIS_Y); INTERSTEP_DELAY; }
// // External Interface // void stepForward(void) { // if (posY > MAX_Y) // { // return; // } posY++; intDecrement = INTDEC_INIT;; TIMSK0 |= _BV(TOIE0); stepSequence[AXIS_X] = prevState(stepSequence[AXIS_X]); coilState(AXIS_X); INTERSTEP_DELAY; }
/** Update the previous state map.*/ void LexicalReorderingFeatureFunction::updateTarget() { m_prevStates.clear(); m_accumulator.ZeroAll(); const Hypothesis * currHypo = getSample().GetTargetTail(); LRStateHandle prevState(dynamic_cast<const LexicalReorderingState*>(m_mosesLexReorder->EmptyHypothesisState(currHypo->GetInput()))); while ((currHypo = (currHypo->GetNextHypo()))) { LRStateHandle currState(dynamic_cast<const LexicalReorderingState*>(m_mosesLexReorder->Evaluate(currHypo->GetTranslationOption(),prevState.get(),&m_accumulator))); for (size_t i = 0; i < currHypo->GetCurrTargetWordsRange().GetNumWordsCovered(); ++i) { m_prevStates.push_back(prevState); } prevState = currState; } }
inline void downgradeState (actualStatePtr actual, stateDscPtr tmp) { // reset upgrade counter to sup threshold cause we're looking for upgrade! actual->ucount = tmp->sup; // if downgrade counter fires... if (!(--(actual->dcount))) { // downgrade actual state... actual->state = prevState (tmp->level); // ...and initialize new actual state's thresholds actual->dcount = (actual->state)->low; actual->ucount = (actual->state)->sup; } }
/* Score due to two segments. The left and right refer to the target positions.**/ void LexicalReorderingFeatureFunction::doContiguousPairedUpdate (const TranslationOption* leftOption,const TranslationOption* rightOption, const TargetGap& gap, FVector& scores) { vector<float> accumulator(m_mosesLexReorder->GetNumScoreComponents(),0); //The previous state of the (new) current hypo. LRStateHandle prevState(m_prevStates[gap.segment.GetStartPos()]); //Evaluate the hypos in the gap prevState.reset(prevState->Expand(*leftOption,accumulator)); addScore(accumulator,scores); prevState.reset(prevState->Expand(*rightOption,accumulator)); addScore(accumulator,scores); //if there's a hypo on the right, then evaluate it. if (gap.rightHypo) { prevState.reset(prevState->Expand(gap.rightHypo->GetTranslationOption(),accumulator)); addScore(accumulator,scores); } }
void SingleStateFeatureFunction::updateTarget() { //Update the prevStates map, and the cached scores m_prevStates.clear(); m_accumulator.ZeroAll(); const Moses::Hypothesis* currHypo = getSample().GetTargetTail(); StateHandle prevState( m_mosesFeature->EmptyHypothesisState(currHypo->GetInput())); while ((currHypo = (currHypo->GetNextHypo()))) { StateHandle currState(m_mosesFeature->Evaluate( *currHypo, prevState.get(), &m_accumulator)); for (size_t i = 0; i < currHypo->GetCurrTargetWordsRange(). GetNumWordsCovered(); ++i) { m_prevStates.push_back(prevState); } prevState = currState; } }
/** Score due to two segments. The left and right refer to the target positions.**/ void SingleStateFeatureFunction::doContiguousPairedUpdate( const TranslationOption* leftOption, const TranslationOption* rightOption, const TargetGap& gap, FVector& scores) { ScoreComponentCollection accumulator; //The previous state of the (new) current hypo. StateHandle prevState(m_prevStates[gap.segment.GetStartPos()]); //Evaluate the hypos in the gap prevState.reset(m_mosesFeature->Evaluate( *leftOption,prevState.get(),&accumulator)); prevState.reset(m_mosesFeature->Evaluate( *rightOption,prevState.get(),&accumulator)); //if there's a hypo on the right, evaluate it if (gap.rightHypo) { prevState.reset(m_mosesFeature->Evaluate( gap.rightHypo->GetTranslationOption(),prevState.get(),&accumulator)); } scores += accumulator.GetScoresVector(); }
long double DimerReactionStabilizationData::rate(const DimerData *dimer) const { return (dimer->first->value() == prevState() && dimer->second->value() == prevState()) ? rateValue(dimer) : 0; }
long double CellReactionData::rate(const CellData *site) const { return (site->value() == prevState()) ? rateValue(site) : 0; }