Shortcuts

EDA Problems

Environment for Electronic Design Automation (EDA) problems

Decap Placement Problem (DPP)

class rl4co.envs.dpp.DPPEnv(*, min_loc=0, max_loc=1, num_keepout_min=1, num_keepout_max=50, max_decaps=20, data_dir='data/dpp/', chip_file='10x10_pkg_chip.npy', decap_file='01nF_decap.npy', freq_file='freq_201.npy', url=None, td_params=None, **kwargs)[source]

Bases: RL4COEnvBase

Decap placement problem as done in DevFormer paper: https://arxiv.org/abs/2205.13225

The environment is a 10x10 grid with 100 locations containing either a probing port or a keepout region. The goal is to place decaps (decoupling capacitors) to maximize the impedance suppression at the probing port. Decaps cannot be placed in keepout regions or at the probing port and the number of decaps is limited.

Parameters:
  • min_loc (float) – Minimum location value. Defaults to 0.

  • max_loc (float) – Maximum location value. Defaults to 1.

  • num_keepout_min (int) – Minimum number of keepout regions. Defaults to 1.

  • num_keepout_max (int) – Maximum number of keepout regions. Defaults to 50.

  • max_decaps (int) – Maximum number of decaps. Defaults to 20.

  • data_dir (str) – Directory to store data. Defaults to “data/dpp/”. This can be downloaded from this [url](https://drive.google.com/uc?id=1IEuR2v8Le-mtHWHxwTAbTOPIkkQszI95).

  • chip_file (str) – Name of the chip file. Defaults to “10x10_pkg_chip.npy”.

  • decap_file (str) – Name of the decap file. Defaults to “01nF_decap.npy”.

  • freq_file (str) – Name of the frequency file. Defaults to “freq_201.npy”.

  • url (Optional[str]) – URL to download data from. Defaults to None.

  • td_params (Optional[TensorDict]) – TensorDict parameters. Defaults to None.

Initializes internal Module state, shared by both nn.Module and ScriptModule.

generate_data(batch_size)[source]

Generate initial observations for the environment with locations, probe, and action mask Action_mask eliminates the keepout regions and the probe location, and is updated to eliminate placed decaps

get_reward(td, actions)[source]

We call the reward function with the final sequence of actions to get the reward Calling per-step would be very time consuming due to decap simulation

load_data(fpath, batch_size=[])[source]

Dataset loading from file

render(decaps, probe, action_mask, ax=None, legend=True)[source]

Plot a grid of 1x1 squares representing the environment. The keepout regions are the action_mask - decaps - probe

name = 'dpp'

Multi-port Decap Placement Problem (mDPP)

class rl4co.envs.mdpp.MDPPEnv(*, num_probes_min=2, num_probes_max=5, reward_type='minmax', td_params=None, **kwargs)[source]

Bases: DPPEnv

Multiple decap placement problem (mDPP) environment This is a modified version of the DPP environment where we allow multiple probing ports The reward can be calculated as:

  • minmax: min of the max of the decap scores

  • meansum: mean of the sum of the decap scores

The minmax is more challenging as it requires to find the best decap location for the worst case

Parameters:
  • num_probes_min (int) – minimum number of probes

  • num_probes_max (int) – maximum number of probes

  • reward_type (str) – reward type, either minmax or meansum

  • td_params (Optional[TensorDict]) – TensorDict parameters

Initializes internal Module state, shared by both nn.Module and ScriptModule.

generate_data(batch_size)[source]

Generate initial observations for the environment with locations, probe, and action mask Action_mask eliminates the keepout regions and the probe location, and is updated to eliminate placed decaps

get_reward(td, actions)[source]

We call the reward function with the final sequence of actions to get the reward Calling per-step would be very time consuming due to decap simulation

render(td, actions=None, ax=None, legend=True, settings=None)[source]

Plot a grid of squares representing the environment. The keepout regions are the action_mask - decaps - probe

name = 'mdpp'