void SimpSMTSolver::initialize( ) { CoreSMTSolver::initialize( ); #ifdef PRODUCE_PROOF if ( config.sat_preprocess_booleans != 0 || config.sat_preprocess_theory != 0 ) { opensmt_warning( "disabling SATElite preprocessing to track proof" ); use_simplification = false; config.sat_preprocess_booleans = 0; config.sat_preprocess_theory = 0; } #else use_simplification = config.sat_preprocess_booleans != 0; #endif // Add clauses for true/false // Useful for expressing TAtoms that are constantly true/false const Var var_True = newVar( ); const Var var_False = newVar( ); setFrozen( var_True, true ); setFrozen( var_False, true ); vec< Lit > clauseTrue, clauseFalse; clauseTrue.push( Lit( var_True ) ); addClause( clauseTrue ); clauseFalse.push( Lit( var_False, true ) ); addClause( clauseFalse ); theory_handler = new THandler( egraph, config, *this, trail, level, assigns, var_True, var_False ); }
Cluster::Cluster() { setBumpObjectType(BumpCluster); setFrozen(true); setCollisions(false); reset(); }
lbool SimpSolver::solve(const vec<Lit>& assumps, bool do_simp, bool turn_off_simp) { vec<Var> extra_frozen; lbool result = l_True; do_simp &= use_simplification; do_simp &= (decisionLevel() == 0); if (do_simp){ // Assumptions must be temporarily frozen to run variable elimination: for (int i = 0; i < assumps.size(); i++){ Var v = var(assumps[i]); // If an assumption has been eliminated, remember it. if (isEliminated(v)) remember(v); if (!frozen[v]){ // Freeze and store. setFrozen(v, true); extra_frozen.push(v); } } if(eliminate(turn_off_simp)) result = l_True; else result = l_False; } if (result == l_True) result = Solver::solve(assumps); if (result == l_True) { extendModel(); #ifndef NDEBUG verifyModel(); #endif } if (do_simp) // Unfreeze the assumptions that were frozen: for (int i = 0; i < extra_frozen.size(); i++) setFrozen(extra_frozen[i], false); return result; }
lbool SimpSMTSolver::solve( const vec< Lit > & assumps , const unsigned conflicts , bool do_simp , bool turn_off_simp) { vec<Var> extra_frozen; bool result = true; if ( config.sat_preprocess_theory == 0 ) goto skip_theory_preproc; opensmt_error( "preprocess theory has been temporairly disabled in this version" ); skip_theory_preproc: // Added Code //================================================================================================= do_simp &= use_simplification; if (do_simp) { // Assumptions must be temporarily frozen to run variable elimination: for (int i = 0; i < assumps.size(); i++) { Var v = var(assumps[i]); // If an assumption has been eliminated, remember it. if (isEliminated(v)) remember(v); if (!frozen[v]) { // Freeze and store. setFrozen(v, true); extra_frozen.push(v); } } result = eliminate(turn_off_simp); } #ifdef STATISTICS CoreSMTSolver::preproc_time = cpuTime( ); #endif lbool lresult = l_Undef; if (result) lresult = CoreSMTSolver::solve(assumps, conflicts); else lresult = l_False; if (lresult == l_True) { extendModel(); // Previous line // #ifndef NDEBUG #ifndef SMTCOMP verifyModel(); #endif } if (do_simp) // Unfreeze the assumptions that were frozen: for (int i = 0; i < extra_frozen.size(); i++) setFrozen(extra_frozen[i], false); return lresult; }
void Monster::think(const double elapsedTime) { Entity::think(elapsedTime); if(!mIsDying && mHealth <= 0) kill(); if(mIsStunned) { if(mPosition.Y > -0.5) { mVelocity.Y -= 0.005; mPosition += mVelocity; if(game->getCurrentMap()->getTile(int(mPosition.X + mVelocity.X), int(mPosition.Z)).type == TYPE_WALL) { mVelocity.X = -mVelocity.X; mVelocity *= MONSTER_DAMPING; } if(game->getCurrentMap()->getTile(int(mPosition.X), int(mPosition.Z + mVelocity.Z)).type == TYPE_WALL) { mVelocity.Z = -mVelocity.Z; mVelocity *= MONSTER_DAMPING; } } else { mIsStunned = false; mPosition.Y = -0.5; } } if(mIsDying) { if(mDeathTimer.getElapsedTime() >= 500) mShouldDelete = true; return; } if(mIsFrozen) { if(mFreezeTimer.getElapsedTime() < 5000) { return; } else setFrozen(false); } if(mIsFleeing) { Vec2d motion = Vec2d(playerPos.X-mPosition.X,playerPos.Z-mPosition.Z); motion.normalize(); motion /= 35; if((playerPos.X - mPosition.X) + (playerPos.Z - mPosition.Z) < 0.3) { int goalStr = game->getCurrentMap()->getTile(int(mPosition.X), int(mPosition.Z)).goodCreatureGoal; playerPos = mPosition; for(int i = -1; i < 2; ++i) for(int j = -1; j < 2; ++j) if(game->getCurrentMap()->getTile(i + int(mPosition.X), j + int(mPosition.Z)).type != TYPE_WALL && goalStr < game->getCurrentMap()->getTile(i + int(mPosition.X), j + int(mPosition.Z)).goodCreatureGoal && game->getCurrentMap()->getTile(i + int(mPosition.X), j + int(mPosition.Z)).goodCreatureGoal < 100) { goalStr = game->getCurrentMap()->getTile(i + int(mPosition.X), j + int(mPosition.Z)).goodCreatureGoal; playerPos.X = mPosition.X + i; playerPos.Z = mPosition.Z + j; } } game->getCurrentMap()->setGoal(int(playerPos.X), int(playerPos.Z), 0); game->getCurrentMap()->setGoal(int(mPosition.X), int(mPosition.Z), 0); //Increase position of monster. mPosition -= Vec3d(motion.X(),0,motion.Y()); } else { Vec2d motion = Vec2d(playerPos.X-mPosition.X,playerPos.Z-mPosition.Z); motion.normalize(); motion /= 50; if((playerPos.X - mPosition.X) + (playerPos.Z - mPosition.Z) < 0.3) { int goalStr = game->getCurrentMap()->getTile(int(mPosition.X), int(mPosition.Z)).goodCreatureGoal; playerPos = mPosition; for(int i = -1; i < 2; ++i) for(int j = -1; j < 2; ++j) if(game->getCurrentMap()->getTile(i + int(mPosition.X), j + int(mPosition.Z)).type != TYPE_WALL && goalStr < game->getCurrentMap()->getTile(i + int(mPosition.X), j + int(mPosition.Z)).goodCreatureGoal && game->getCurrentMap()->getTile(i + int(mPosition.X), j + int(mPosition.Z)).goodCreatureGoal < 100) { goalStr = game->getCurrentMap()->getTile(i + int(mPosition.X), j + int(mPosition.Z)).goodCreatureGoal; playerPos.X = mPosition.X + i; playerPos.Z = mPosition.Z + j; } } game->getCurrentMap()->setGoal(int(playerPos.X), int(playerPos.Z), 0); game->getCurrentMap()->setGoal(int(mPosition.X), int(mPosition.Z), 0); //Increase position of monster. mPosition += Vec3d(motion.X(),0,motion.Y()); } /*if(rand() % 500 == 0) { attack(); } if(rand() % 5000 == 0) { makeMonsterNoise(); }*/ if(mVoice) mVoice->setPosition(mPosition); }
void StimulusGroupReferenceNode::thaw(){ setFrozen(false); }
void StimulusGroupReferenceNode::freeze(){ setFrozen(true); }