PCB Environment 2

Loading...
Searching...
No Matches
UserAgent.hpp
1
2#ifndef GYM_PCB_RL_USERAGENT_H
3#define GYM_PCB_RL_USERAGENT_H
4
5#include "RL/ActionSpace.hpp"
6#include "RL/Agent.hpp"
7#include "RL/CommonActions.hpp"
8#include "RL/CommonStateReprs.hpp"
9#include "RL/Reward.hpp"
10
11 class UserAgent : public Agent
12{
13 public:
14 UserAgent();
15 void setPCB(const std::shared_ptr<PCBoard>&) override;
16 void setManagedConnections(const std::set<Connection *>&) override;
17 void setStateRepresentationParams(PyObject *) override;
18 void setParameter(const std::string &name, int index, PyObject *) override;
19 PyObject *step(PyObject *) override;
20 PyObject *get_state(PyObject *) override;
21 PyObject *reset() override;
22 private:
23 struct {
24 actions::AStarConnect Connect{0};
25 actions::SetRouteGuard RouteGuard;
26 actions::SetLayerMask LayerMask;
27 actions::SetCostMap CostMap;
28 actions::AStarToPoint RouteTo{0, Point_25(0,0,-1), Point_25(0,0,-1)};
29 actions::SegmentToPoint SegmentTo{0, Point_25(0,0,-1), Point_25(0,0,-1)};
30 actions::Unroute Unroute{0};
31 actions::UnrouteSegment UnrouteSegment{0, Point_25(0,0,-1)};
32 actions::UnrouteNet UnrouteNet{0};
33 actions::SetTrack SetTrack{0};
34 actions::LockRouted Lock;
35 } mActions;
36 ActionSpace mActionSpaceU;
37 ActionSpace mActionSpaceLegacy;
38 struct {
39 std::unique_ptr<sreps::Image> DImage;
40 std::unique_ptr<sreps::Image> GImage;
41 std::unique_ptr<sreps::Image> SImage;
42 StateRepresentation None;
43 sreps::WholeBoard Board;
44 sreps::GridData Grid;
45 sreps::ConnectionEndpoints EndpointsNumpy;
46 sreps::TrackRasterization Raster;
47 sreps::TrackSegments Segments{true};
48 sreps::Metrics Metrics;
49 sreps::CustomFeatures Features;
50 sreps::ImageBbox ImageBox;
51 sreps::ItemSelection Selection;
52 sreps::ClearanceCheck Clearance;
53 std::map<std::string, StateRepresentation *> map;
54 StateRepresentation *def;
55 } mSR;
56 Reward mLastReward;
57 RouterResult mRouterResult;
58 IBox_3 mGridSRBox{IBox_3::EMPTY()};
59 IVector_2 mImageSize{128, 128};
60
61 Action::Result _action(PyObject *);
62 void initActionsUser();
63 void initActionsLegacy();
64 void initSR();
65 void loadAllConnections();
66
67 PyObject *_get_state(PyObject *) const;
68};
69
70#endif // GYM_PCB_RL_USERAGENT_H
ActionSpace
Definition ActionSpace.hpp:13
IVector_2
Definition IPoint2.hpp:10
Point_25
Definition Geometry.hpp:131
StateRepresentation
The subclass create(PyObject *) functions check if the PyObject matches and return a new instace if i...
Definition StateRepresentation.hpp:17
Action::Result
Definition Action.hpp:21
IBox_3
Definition IPoint3.hpp:60
RouterResult
Definition Reward.hpp:15