Package net.sf.colossus.ai
Class ParallelEvaluatorAI
- java.lang.Object
-
- net.sf.colossus.ai.AbstractAI
-
- net.sf.colossus.ai.SimpleAI
-
- net.sf.colossus.ai.ExperimentalAI
-
- net.sf.colossus.ai.ParallelEvaluatorAI
-
- All Implemented Interfaces:
AI
public class ParallelEvaluatorAI extends ExperimentalAI
DON'T USE THAT ONE YET. This one implements a parallel findBestLegionMove. Unfortunately, SimpleAI implementation of evaluateLegionBattleMove is anything but thread-safe, and it goes very deep: Evaluations functions mostly fall-back to asking the Client object property of the current situation. So they have first to move all BattleCritter (which are only a view of full BattleUnit) to the evaluated position, then evaluate. This version only tests the parallelism, so evaluateLegionBattleMove is random. We would need to (1) implements Strike as BattleClientSide, a proper, per-battle extension of Battle (the way it is done on with BattleServerSide) (2) make sure all evaluate functions only use property of BattleClientSide, even if that means changing the state of BattleClientSide. (3) have a proper deep copy constructor in BattleClientSide, so we can work on several variant at once.- Author:
- Romain Dolbeau
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ParallelEvaluatorAI.findBestLegionMoveThread
-
Nested classes/interfaces inherited from class net.sf.colossus.ai.SimpleAI
SimpleAI.PowerSkill, SimpleAI.TriggerTimeIsUp
-
Nested classes/interfaces inherited from class net.sf.colossus.ai.AbstractAI
AbstractAI.AbstractAIOracle, AbstractAI.CreatureValueConstants, AbstractAI.MoveInfo
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Logger
LOGGER
private static int
NTHREADS
-
Fields inherited from class net.sf.colossus.ai.SimpleAI
MIN_ITERATIONS, timeIsUp, timeLimit
-
Fields inherited from class net.sf.colossus.ai.AbstractAI
bec, client, cvc, hintSectionUsed, random, variant
-
-
Constructor Summary
Constructors Constructor Description ParallelEvaluatorAI(Client client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
evaluateLegionBattleMove(LegionMove lm)
protected LegionMove
findBestLegionMove(java.util.Collection<LegionMove> legionMoves)
Evaluate all legion moves in the list, and return the best one.-
Methods inherited from class net.sf.colossus.ai.ExperimentalAI
battleMove, cleanupBattle, evaluateCritterMove_Defender, evaluateCritterMove_Rangestrike, evaluateCritterMove_Strike, evaluateCritterMove_Titan, evaluateLegionBattleMoveAsAWhole, findLegionMoves, initBattle
-
Methods inherited from class net.sf.colossus.ai.SimpleAI
acquireAngel, chooseRecruit, concede, doInitialGameSplit, findWeakestTwoCritters, flee, getCreatureMoveLimit, getNativeValue, handleCarries, handleMulligans, masterMove, muster, pickColor, pickEngagement, pickEntrySide, pickMarker, pickStrikePenalty, RATIO_DRAW, RATIO_LOSE_HEAVY_LOSS, RATIO_WIN_HEAVY_LOSS, RATIO_WIN_MINIMAL_LOSS, reinforce, retryFailedBattleMoves, setupTimer, split, splitCallback, strike, summonAngel
-
Methods inherited from class net.sf.colossus.ai.AbstractAI
buildEnemyAttackMap, couldRecruitUp, countCreatureAccrossAllLegionFromPlayer, findStrikeMap, generateDamageMap, generateLegionMoves, getAcqStepValue, getBattleStrike, getBattleUnit, getCaretaker, getHintedRecruitmentValue, getHintedRecruitmentValueNonTitan, getHintedRecruitmentValueNonTitan, getInitialSplitHint, getKillValue, getKillValue, getNumberOfWaysToTerrain, getVariantRecruitHint, hasOpponentNativeCreature, isHumanLegion, makeLegionMove, rangeToClosestOpponent, setVariant
-
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
NTHREADS
private static final int NTHREADS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ParallelEvaluatorAI
public ParallelEvaluatorAI(Client client)
-
-
Method Detail
-
evaluateLegionBattleMove
protected int evaluateLegionBattleMove(LegionMove lm)
- Overrides:
evaluateLegionBattleMove
in classSimpleAI
-
findBestLegionMove
protected LegionMove findBestLegionMove(java.util.Collection<LegionMove> legionMoves)
Description copied from class:SimpleAI
Evaluate all legion moves in the list, and return the best one. Break out early if the time limit is exceeded.- Overrides:
findBestLegionMove
in classSimpleAI
-
-