Coverage Control Library
Loading...
Searching...
No Matches
ControllerNN Class Reference

Controller class for neural network based controllers. More...

Public Member Functions

 __init__ (self, dict config, Parameters params, CoverageSystem env)
 Constructor for the neural network controller.
 
 step (self, env)
 step function for the neural network controller
 

Public Attributes

 config = config
 
 params = params
 
 name = self.config["Name"]
 
 use_cnn = self.config["UseCNN"]
 
 use_comm_map = self.config["UseCommMap"]
 
 cnn_map_size = self.config["CNNMapSize"]
 
 device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
 model_file = IOUtils.sanitize_path(self.config["ModelFile"])
 
 model = torch.load(self.model_file).to(self.device)
 
 learning_params_file
 
 learning_params = IOUtils.load_toml(self.learning_params_file)
 
 actions_mean = self.model.actions_mean.to(self.device)
 
 actions_std = self.model.actions_std.to(self.device)
 

Detailed Description

Controller class for neural network based controllers.

Definition at line 94 of file controllers.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
dict config,
Parameters params,
CoverageSystem env )

Constructor for the neural network controller.

Parameters
configConfiguration dictionary
paramsParameters object
envCoverageSystem object

Definition at line 103 of file controllers.py.

Member Function Documentation

◆ step()

step ( self,
env )

step function for the neural network controller

   Performs three steps:
   1. Get the data from the environment
   2. Get the actions from the model
   3. Step the environment using the actions
Parameters
envCoverageSystem object
Returns
Objective value and convergence flag

Definition at line 143 of file controllers.py.

Member Data Documentation

◆ actions_mean

actions_mean = self.model.actions_mean.to(self.device)

Definition at line 125 of file controllers.py.

◆ actions_std

actions_std = self.model.actions_std.to(self.device)

Definition at line 126 of file controllers.py.

◆ cnn_map_size

cnn_map_size = self.config["CNNMapSize"]

Definition at line 109 of file controllers.py.

◆ config

config = config

Definition at line 104 of file controllers.py.

◆ device

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

Definition at line 111 of file controllers.py.

◆ learning_params

learning_params = IOUtils.load_toml(self.learning_params_file)

Definition at line 121 of file controllers.py.

◆ learning_params_file

learning_params_file
Initial value:
= IOUtils.sanitize_path(
self.config["LearningParams"]
)

Definition at line 118 of file controllers.py.

◆ model

model = torch.load(self.model_file).to(self.device)

Definition at line 116 of file controllers.py.

◆ model_file

model_file = IOUtils.sanitize_path(self.config["ModelFile"])

Definition at line 115 of file controllers.py.

◆ name

name = self.config["Name"]

Definition at line 106 of file controllers.py.

◆ params

params = params

Definition at line 105 of file controllers.py.

◆ use_cnn

use_cnn = self.config["UseCNN"]

Definition at line 107 of file controllers.py.

◆ use_comm_map

use_comm_map = self.config["UseCommMap"]

Definition at line 108 of file controllers.py.