10 #include "buildtype.h" 13 #include <autogradpp/autograd.h> 14 #include <mapbox/variant.hpp> 16 #include <unordered_map> 46 using UnitMap = std::unordered_map<Unit*, float>;
70 mapbox::util::variant<Empty, Position, Area*, UnitMap, torch::Tensor>;
81 using StateT = mapbox::util::variant<
143 bool isFinal =
false;
150 std::shared_ptr<UPCTuple> upc =
nullptr;
158 return isFinal ? upc :
nullptr;
Game state.
Definition: state.h:42
std::pair< BuildType const *, float > createTypeArgMax() const
Returns argmax and probability of the BuildTypeMap distribution in the UPC's state field...
Definition: upc.cpp:172
CommandT command
A distribution over abstract game commands.
Definition: upc.h:94
Command
Abstract "meta" commands for UPCTuples.
Definition: basetypes.h:314
std::pair< Unit *, float > positionUArgMax() const
Returns argmax and probability of position distribution over units.
Definition: upc.cpp:34
int scale
Specifies the (inverse) scale of the position tensor or the single sharp position.
Definition: upc.h:103
std::tuple< UpcId, float > SetCreatePriorityState
Definition: upc.h:50
replayer::Unit Unit
Definition: state.h:36
std::unordered_map< BuildType const *, float > BuildTypeMap
Definition: upc.h:48
float positionProb(int x, int y) const
Returns the probability of a given position.
Definition: upc.cpp:49
(Unit, Position, Command) tuple.
Definition: upc.h:43
Represents a decision of how to control a unit.
Definition: upc.h:135
char Empty
An empty default item for the variants defined below.
Definition: upc.h:45
UnitT unit
A distribution over units that we can control.
Definition: upc.h:90
mapbox::util::variant< Empty, BuildTypeMap, std::string, Position, SetCreatePriorityState, torch::Tensor > StateT
A typedef for additional structured information ("state").
Definition: upc.h:87
UnitMap UnitT
A typedef for the unit distribution.
Definition: upc.h:56
std::unordered_map< Unit *, float > UnitMap
Definition: upc.h:46
static CommandT uniformCommand()
Creates a uniform distribution over all game commands.
Definition: upc.cpp:187
std::pair< Position, float > positionArgMax() const
Returns argmax and probability of position distribution.
Definition: upc.cpp:15
std::shared_ptr< UPCTuple > getFinalUPC() const
if (isFinal):
Definition: upc.h:157
float commandProb(Command c) const
Returns the probability of a given command.
Definition: upc.cpp:101
Main namespace for bot-related code.
Definition: areainfo.cpp:17
torch::Tensor positionTensor(State *state) const
Returns walk tile resolution tensor of position probabilities.
Definition: upc.cpp:109
StateT state
An auxiliary state that can be used to pass additional information.
Definition: upc.h:97
CommandMap CommandT
A typedef for the command distribution.
Definition: upc.h:72
std::unordered_map< Command, float > CommandMap
Definition: upc.h:47
PositionT position
A distribution over positions.
Definition: upc.h:92
Vec2T< int > Position
Definition: basetypes.h:178
mapbox::util::variant< Empty, Position, Area *, UnitMap, torch::Tensor > PositionT
A typedef for the position distribution.
Definition: upc.h:70