eOSState cMenuBouquetsList::DeleteBouquet() { if (Interface->Confirm(tr("Delete Bouquet?"))) { cChannel *bouquet = GetBouquet(Current()); cChannel *next = (cChannel *) bouquet->Next(); /* Delete all channels up to the beginning */ /* of the next bouquet */ while (next && !next->GroupSep()) { cChannel *p = next; next = (cChannel *) next->Next(); Channels.Del(p); } /* Delete the bouquet itself */ Channels.Del(bouquet); /* Remove the OSD-item */ cOsdMenu::Del(Current()); Propagate(); if (Current() < -1) SetCurrent(0); return osContinue; } return osContinue; }
//------------------------------------------------------------------------------ bool RunSimulator::Execute() { #ifdef DEBUG_SIMULATOR_EXECUTION MessageInterface::ShowMessage(wxT("\n\nThe \"%s\" command is running...\n"), GetTypeName().c_str()); #endif // Reset the command if called after it has completed execution // todo: Debug this piece; reentrance in a For loop doesn't work yet // if (commandComplete) // TakeAction("Reset"); // Here we should check to see if the command is currently propagating and // finish that first... // Respond to the state in the state machine Solver::SolverState state = theSimulator->GetState(); #ifdef DEBUG_SIMULATOR_EXECUTION MessageInterface::ShowMessage(wxT("\nSimulator state is %d\n"), state); #endif switch (state) { case Solver::INITIALIZING: PrepareToSimulate(); break; case Solver::PROPAGATING: Propagate(); break; case Solver::CALCULATING: Calculate(); break; case Solver::LOCATING: // The LOCATING state shouldn't trigger until we have event location // implemented, so this case should not fire. LocateEvent(); break; case Solver::SIMULATING: Simulate(); break; case Solver::FINISHED: Finalize(); break; default: throw CommandException(wxT("Unknown state ") wxT(" encountered in the RunSimulator command")); } state = theSimulator->AdvanceState(); return true; }
/** * @brief Propagates all beacons in the world. * * Should be called everytime someone joins or leaves a team. */ void PropagateAll() { for ( gentity_t *ent = nullptr; (ent = G_IterateEntities( ent )); ) { if ( ent->s.eType != ET_BEACON ) continue; Propagate( ent ); } }
void Viewport::Init(Interactor* i, Alignment a) { SetClassName("Viewport"); background = nil; align = a; shape->Rigid(hfil, hfil, vfil, vfil); perspective = new Perspective; Propagate(false); if (i != nil) { Insert(i); } }
void wxMoColourLevelCtrl::SetColourValue( wxColour p_ColourValue, bool propagate ) { ///necesarry to map m_ColourValue internally to RGB and HSV UpdateColour( p_ColourValue ); ///internal process of colour ProcessColour(); if (propagate) { Propagate(); } }
void NeuralNetwork::Train(FloatsVector& inputs, FloatsVector& desiredOutputs) { FloatsVector outputs(outputNeuronCount); FloatsVector hiddenOutputs(hiddenNeuronCount); FloatsVector outputDeltas(outputNeuronCount); FloatsVector hiddenDeltas(hiddenNeuronCount); const float eta = 0.3; assert(inputs.size() == inputNeuronCount); assert(desiredOutputs.size() == outputNeuronCount); // Feedforward the current values Propagate(inputs, outputs, hiddenOutputs); // Calculate the deltas from the output for (int k = 0; k < outputNeuronCount; k++) { outputDeltas[k] = desiredOutputs[k] - outputs[k]; } // Propagate the deltas back to the hidden layer for (int j = 0; j < hiddenNeuronCount; j++) { for (int k = 0; k < outputNeuronCount; k++) { hiddenDeltas[j] += outputWeights[k * hiddenNeuronCount + j] * outputDeltas[k]; } } // Now update the weights for the input->hidden weights for (int i = 0; i < inputNeuronCount; i++) { for (int j = 0; j < hiddenNeuronCount; j++) { float deltaWeight = eta * hiddenDeltas[j] * hiddenOutputs[j] * (1.0 - hiddenOutputs[j]); inputWeights[j * inputNeuronCount + i] += deltaWeight; } } // And update the hidden->output weights for (int j = 0; j < hiddenNeuronCount; j++) { for (int k = 0; k < outputNeuronCount; k++) { float deltaWeight = eta * outputDeltas[k] * outputs[k] * (1.0 - outputs[k]) * hiddenOutputs[j]; outputWeights[k * hiddenNeuronCount + j] += deltaWeight; } } }
bool PointAlgebraReasoner::Close() { pair<int, int> ij; int signal=0; while(!Queue.empty()) { ij= Queue.front(); signal= Propagate(ij.first, ij.second); if(! signal) //contradiction (inconsistent network) return signal; Queue.pop(); } return true; }
Viewport::Viewport ( Sensor* in, Painter* out, Interactor* i, Alignment a ) : (in, out) { Init(i, a); } void Viewport::Init (Interactor* i, Alignment a) { SetClassName("Viewport"); align = a; shape->Rigid(hfil, hfil, vfil, vfil); perspective = new Perspective; Propagate(false); if (i != nil) { Insert(i); } }
int main(int argc, char **argv) { MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &size); MPI_Comm_rank(MPI_COMM_WORLD, &rank); GetParam(argc, argv); if (rank == 0) OutParam(); MPI_Barrier(MPI_COMM_WORLD); Allocate(); Propagate(); Finalize(); MPI_Finalize(); }
void cMenuBouquetsList::Move(int From, int To) { int CurrentChannelNr = cDevice::CurrentChannel(); cChannel *CurrentChannel = Channels.GetByNumber(CurrentChannelNr); cChannel *FromChannel = GetBouquet(From); cChannel *ToChannel = GetBouquet(To); if (To > From) for (cChannel * channel = (cChannel *) ToChannel->Next(); channel && !channel->GroupSep(); channel = (cChannel *) channel->Next()) ToChannel = channel; if (FromChannel && ToChannel && FromChannel != ToChannel) { int FromIndex = FromChannel->Index(); int ToIndex = ToChannel->Index(); cChannel *NextFromChannel = NULL; while (FromChannel && (!FromChannel->GroupSep() || !NextFromChannel)) { NextFromChannel = (cChannel *) FromChannel->Next(); Channels.Move(FromChannel, ToChannel); if (To > From) ToChannel = FromChannel; FromChannel = NextFromChannel; } if (From != To) { cOsdMenu::Move(From, To); Propagate(); isyslog("bouquet from %d moved to %d", FromIndex, ToIndex); } if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr) { isyslog("CurrentChannelNr = %d; CurrentChannel::number = %d", CurrentChannelNr, CurrentChannel->Number()); Channels.SwitchTo(CurrentChannel->Number()); } } }
void NeuralNetwork::Propagate(FloatsVector& inputs, FloatsVector& outputs) { std::vector<float> hiddenLayerValues(hiddenNeuronCount); Propagate(inputs, outputs, hiddenLayerValues); }
/** * @brief Tags an entity. */ void Tag( gentity_t *ent, team_t team, bool permanent ) { int data; vec3_t origin, mins, maxs; bool dead, player; gentity_t *beacon, **attachment; team_t targetTeam; // Get the beacon attachment owned by the tagging team. switch( team ) { case TEAM_ALIENS: attachment = &ent->alienTag; break; case TEAM_HUMANS: attachment = &ent->humanTag; break; default: return; } // Just refresh existing tags. if ( *attachment ) { RefreshTag( *attachment, true ); return; } switch( ent->s.eType ) { case ET_BUILDABLE: targetTeam = ent->buildableTeam; data = ent->s.modelindex; dead = G_Dead( ent ); player = false; BG_BuildableBoundingBox( ent->s.modelindex, mins, maxs ); break; case ET_PLAYER: targetTeam = (team_t)ent->client->pers.team; dead = G_Dead( ent ); player = true; BG_ClassBoundingBox( ent->client->pers.classSelection, mins, maxs, nullptr, nullptr, nullptr ); // Set beacon data to class (aliens) or weapon (humans). switch( targetTeam ) { case TEAM_ALIENS: data = ent->client->ps.stats[ STAT_CLASS ]; break; case TEAM_HUMANS: data = BG_GetPlayerWeapon( &ent->client->ps ); break; default: return; } break; default: return; } // Don't tag dead targets. if ( dead ) return; // Set beacon origin to center of target bounding box. VectorCopy( ent->s.origin, origin ); BG_MoveOriginToBBOXCenter( origin, mins, maxs ); // Create new beacon and attach it. beacon = New( origin, BCT_TAG, data, team ); beacon->tagAttachment = attachment; *attachment = beacon; beacon->s.bc_target = ent - g_entities; // Reset the entity's tag score. ent->tagScore = 0; // Set flags. if( player ) beacon->s.eFlags |= EF_BC_TAG_PLAYER; if( team != targetTeam ) beacon->s.eFlags |= EF_BC_ENEMY; // Set expiration time. if( permanent ) beacon->s.bc_etime = 0; else RefreshTag( beacon, true ); // Update the base clusterings. if ( ent->s.eType == ET_BUILDABLE ) BaseClustering::Update( beacon ); Propagate( beacon ); }
/** * @brief Tags an entity. * @todo Don't create a new beacon entity if retagged since that triggers regeneration of base * clusterings. */ void Tag( gentity_t *ent, team_t team, int owner, qboolean permanent ) { int i, data; vec3_t origin, mins, maxs; qboolean dead, player; gentity_t *beacon, **attachment; team_t targetTeam; switch( ent->s.eType ) { case ET_BUILDABLE: targetTeam = ent->buildableTeam; BG_BuildableBoundingBox( ent->s.modelindex, mins, maxs ); data = ent->s.modelindex; dead = ( ent->health <= 0 ); player = qfalse; break; case ET_PLAYER: targetTeam = (team_t)ent->client->pers.team; BG_ClassBoundingBox( ent->client->pers.classSelection, mins, maxs, NULL, NULL, NULL ); dead = ( ent->client && ent->client->ps.stats[ STAT_HEALTH ] <= 0 ); player = qtrue; // data is the class (aliens) or the weapon number (humans) switch( targetTeam ) { case TEAM_ALIENS: data = ent->client->ps.stats[ STAT_CLASS ]; break; case TEAM_HUMANS: data = BG_GetPlayerWeapon( &ent->client->ps ); break; default: return; } break; default: return; } for( i = 0; i < 3; i++ ) origin[ i ] = ent->s.origin[ i ] + ( mins[ i ] + maxs[ i ] ) / 2.0; switch( team ) { case TEAM_ALIENS: attachment = &ent->alienTag; break; case TEAM_HUMANS: attachment = &ent->humanTag; break; default: return; } if ( *attachment ) Delete( *attachment ); beacon = New( origin, BCT_TAG, data, team, owner ); beacon->tagAttachment = attachment; beacon->s.otherEntityNum2 = ent - g_entities; ent->tagScore = 0; if( player ) beacon->s.eFlags |= EF_BC_TAG_PLAYER; if( team != targetTeam ) beacon->s.eFlags |= EF_BC_ENEMY; if( permanent ) beacon->s.time2 = 0; else RefreshTag( beacon, true ); if( dead ) Delete( beacon, true ); else { *attachment = beacon; if ( ent->s.eType == ET_BUILDABLE ) BaseClustering::Update( beacon ); } Propagate( beacon ); }