Thunderbots Project
Loading...
Searching...
No Matches
pass_generator.h
1#pragma once
2
3#include <random>
4
5#include "proto/parameters.pb.h"
6#include "software/ai/passing/cost_function.h"
7#include "software/ai/passing/pass_with_rating.h"
8#include "software/optimization/gradient_descent_optimizer.hpp"
9#include "software/world/world.h"
10
15{
16 public:
22 explicit PassGenerator(const TbotsProto::PassingConfig& passing_config);
23
32 PassWithRating getBestPass(const World& world,
33 const std::vector<RobotId>& robots_to_ignore = {});
34
35 private:
45 std::map<RobotId, std::vector<Point>> sampleReceivingPositionsPerRobot(
46 const World& world, const std::vector<RobotId>& robots_to_ignore);
47
56 PassWithRating optimizeReceivingPositions(
57 const World& world,
58 const std::map<RobotId, std::vector<Point>>& receiving_positions_map);
59
60 // Weights used to normalize the parameters that we pass to GradientDescent
61 // (see the GradientDescent documentation for details)
62 // These weights are *very* roughly the step that gradient descent will take
63 // in each respective dimension for a single iteration. They are tuned to
64 // ensure passes converge as fast as possible, but are also as stable as
65 // possible
66 static constexpr double PASS_SPACE_WEIGHT = 0.1;
67 std::array<double, NUM_PARAMS_TO_OPTIMIZE> optimizer_param_weights = {
68 PASS_SPACE_WEIGHT, PASS_SPACE_WEIGHT};
69
70 // The optimizer we're using to find passes
72
73 std::map<RobotId, Point> previous_best_receiving_positions_;
74
75 // the random seed used to initialize the random number generator
76 static constexpr int RNG_SEED = 1010;
77
78 // A random number generator for use across the class
79 std::mt19937 random_num_gen_;
80
81 // Passing configuration
82 TbotsProto::PassingConfig passing_config_;
83};
Definition gradient_descent_optimizer.hpp:36
Definition pass_generator.h:15
PassWithRating getBestPass(const World &world, const std::vector< RobotId > &robots_to_ignore={})
Definition pass_generator.cpp:15
Definition world.h:23
Definition pass_with_rating.h:6