I am having 13 inputparameters ['L1', 'L3', 'L5', 'L6', 'L7', 'W1', 'W3', 'W5', 'W6',…
- User
I am having 13 input_parameters ['L1', 'L3', 'L5', 'L6', 'L7', 'W1', 'W3', 'W5', 'W6', 'W7', 'Io', 'Cp', 'Vc'] to be tune to get the target output all transistor must be in saturation 'saturation_condition', and '7' objective performance metric values 'area', 'power dissipation', 'DC gain', 'Slew rate', 'Bandwidth3dB', 'Unity gain bandwidth', and 'Phase margin'. input_parameters ['L1', 'L3', 'L5', 'L6', 'L7', 'W1', 'W3', 'W5', 'W6', 'W7', 'Io', 'Cp', 'Vc'] has constraints: 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.2e-6, 0.2e-6, 0.2e-6, 0.2e-6, 0.2e-6, 50e-6, 50e-6, 50e-6, 50e-6, 50e-6, 30e-6, 10e-12, 1.4]) Target output need to be achieve within the constraints: target_metrics = { 'Area': (1e-12, 1e-10), 'PowerDissipation': (0.005, 0.25), 'SlewRate': (20, 60), 'Gain': (70, 100), 'Bandwidth3dB': (30e3, 100e3), 'UnityGainFreq': (30e6, 100e6), 'PhaseMargin': (65, 90)
From my Circuit environment,
I am having the normalized State space representation: Normalized continuous variables (13), One-hot encoded regions (24), binary saturation state (1), normalized performance metrics (7). I am having 'reward' generation function which properly adapts the strategy of my requirement of objectives.
I need you to implement RL algorithm with policy network for PPO (Proximal Policy Optimization) in an actor-critic setting involves designing two neural networks: the actor and the critic. The actor network maps the state space to the action space suggesting actions to take, while the critic network estimates the value of the state-action pairs, essentially critiquing the actions proposed by the actor. The implementation must provide me the values of 'action' in continuous action space, to execute the below statement. 'next_state, reward, done, previous_metrics = env.step(action, perf_metrics)'
Continuous Action space of 13 variables ['L1', 'L3', 'L5', 'L6', 'L7', 'W1', 'W3', 'W5', 'W6', 'W7', 'Io', 'Cp', 'Vc'] are must be with in its bounds.
to implement the RL algorithm you have the
Training Loop
for episode in range(num_episodes): # Define the Training Loop state, performance_metrics = env.reset()
state space (normalized) (45) current 'input_parameters' continuous variables (13), for a transistor in region 1, the one-hot encoding would be [1, 0, 0]. For a transistor in saturation (region 2), it would be [0, 1, 0], and for region 3 it would be [0, 0, 1], For 8 transistors, One-hot encoded regions (24), Consolidated status of all 8 transistors, binary indicator that specifies whether they are all in saturation (1) or not (0), binary saturation state (1), current normalized performance metrics 'area', 'power dissipation', 'DC gain', 'Slew rate', 'Bandwidth3dB', 'Unity gain bandwidth', and 'Phase margin' (7).
- Assistant
- User
target_metrics = { 'Area': (1e-12, 1e-10), 'PowerDissipation': (0.005, 0.25), 'SlewRate': (20, 60), 'Gain': (70, 100), 'Bandwidth3dB': (30e3, 100e3), 'UnityGainFreq': (30e6, 100e6), 'PhaseMargin': (65, 90) whether the actor and critic are implemented with the proper description of my state space and the target what i need to achieve state space (normalized) (45) current 'input_parameters' continuous variables (13), for a transistor in region 1, the one-hot encoding would be [1, 0, 0]. For a transistor in saturation (region 2), it would be [0, 1, 0], and for region 3 it would be [0, 0, 1], For 8 transistors, One-hot encoded regions (24), Consolidated status of all 8 transistors, binary indicator that specifies whether they are all in saturation (1) or not (0), binary saturation state (1), current normalized performance metrics 'area', 'power dissipation', 'DC gain', 'Slew rate', 'Bandwidth3dB', 'Unity gain bandwidth', and 'Phase margin' (7).
- Assistant
- User
File d:\opamp circuits\rl\rl_codenew_8.py:348 actor_optimizer = optim.Adam(actor.parameters(), lr=1e-4)
File ~\anaconda3\envs\spyder\Lib\site-packages\torch\optim\adam.py:45 in init super().init(params, defaults)
File ~\anaconda3\envs\spyder\Lib\site-packages\torch\optim\optimizer.py:273 in init raise ValueError("optimizer got an empty parameter list")
ValueError: optimizer got an empty parameter list
- Assistant
- User
- Assistant
- User
- Assistant
- User
File d:\opamp circuits\rl\rl_codenew_8.py:322 in scale_action scaled_actions = low + (high - low) * scale_to_01
TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and 'Tensor'
- Assistant
The error you're encountering,
TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and 'Tensor', occurs because you're trying to perform an operation between a NumPy array (, ) and a PyTorch tensor (). To resolve this, you need to make sure all operands are of the same type. In this case, it's more straightforward to convert the NumPy arrays to PyTorch tensors since your final action should be a tensor to pass it through your environment and model. - User
- Assistant
- User
how to adjust the Learning Rate The learning rate can significantly impact how boldly the actor updates its policy. If the learning rate is too low, changes in the policy might be too gradual to notable affect the environment within a reasonable number of episodes. Consider experimenting with different learning rates for your actor’s optimizer.
- Assistant
- User
i increased the lr in actor_optimizer into lr=9e-4, after very few training loop, all teh values in the action spaces are getting saturated and i am getting no change in the action space there after
- Assistant
- User
- Assistant