boundslow = np.array([0.18e-6, 0.18e-6, 0.18e-6, 0.18e-6, 0.18e-6, 0.5e-6, 0.5e-6,…
- User
bounds_low = np.array([0.18e-6, 0.18e-6, 0.18e-6, 0.18e-6, 0.18e-6, 0.5e-6, 0.5e-6, 0.5e-6, 0.5e-6, 0.5e-6, 15e-6, 0.1e-12, 0.8]) bounds_high = np.array([0.181e-6, 0.181e-6, 0.181e-6, 0.181e-6, 0.181e-6, 50e-6, 50e-6, 50e-6, 50e-6, 50e-6, 30e-6, 10e-12, 1.4])
def select_action(self, state, performance_metrics):
codeaction_means, action_stds = self.actor(state) #print("action_means", action_means) dist = torch.distributions.Normal(action_means, action_stds) action = dist.sample() log_probs = dist.log_prob(action).sum(axis=-1) # Summing over actions if action space is multi-dimensional # Using tanh to squash gnn_output to [-1, 1] scaled_action = torch.tanh(action) # Now scale and shift the normalized output to the action bounds scaled_actions = self.actor.bounds_low + (self.actor.bounds_high - self.actor.bounds_low) * ((scaled_action + 1) / 2) return scaled_actions.detach().numpy(), log_probs.detach(), performance_metricsthe generated scaled_actions for the variables ['L1', 'L3', 'L5', 'L6', 'L7', 'W1', 'W3', 'W5', 'W6', 'W7', 'Ib', 'Cc', 'Vb'] are given below, scaled_actions [1.80509517e-07 1.80819271e-07 1.80095896e-07 1.80696972e-07 1.80001436e-07 4.65847370e-05 2.53096073e-06 4.97751280e-05 2.59442113e-05 1.44306505e-05 1.51796494e-05 4.49659407e-12 1.36775255e+00]
i need to roundoff the values of scaled_actions for the variables 'L1', 'L3', 'L5', 'L6', 'L7', 'W1', 'W3', 'W5', 'W6', 'W7', with two decimal points, i need to roundoff the values of scaled_actions for the variable 'Ib' without decimal point, i need to roundoff the values of scaled_actions for the variables 'Cc', 'Vb' with one decimal point.
- Assistant
- User
i am getting [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1.2]
- Assistant
- User
bounds_low = np.array([0.18e-6, 0.18e-6, 0.18e-6, 0.18e-6, 0.18e-6, 0.5e-6, 0.5e-6, 0.5e-6, 0.5e-6, 0.5e-6, 15e-6, 0.1e-12, 0.8]) bounds_high = np.array([0.181e-6, 0.181e-6, 0.181e-6, 0.181e-6, 0.181e-6, 50e-6, 50e-6, 50e-6, 50e-6, 50e-6, 30e-6, 10e-12, 1.4])
def select_action(self, state, performance_metrics):
code - Assistant
- User
rounded_actions[11] = np.round(scaled_actions_np[11], 1) # for Cc in 1e-12 scaling factor , i need to roundoff the values of scaled_actions for the variables 'Cc', with one decimal point example, for 'Cc' if the value is 1.203123e-12 then i need result as 1.2e-12
- Assistant