python/src/genetic_search.py
def _generate_initial_population(obj: "GeneticCandidateGenerator") -> Sequence[Netlist]:
        # pylint: disable=protected-access
        """
        Generate N (obj._num_individuals) netlists where each netlist has random device widths, lengths and fingers.
        The randomized widths, lengths and fingers follow a normal distribution and satisfy the constraints given in
        class initializer.

        :return: a sequence of randomly generated netlists
        """
        r = obj._range_info
        n = obj._ndevices

        def rand_netlist(idx: int) -> Netlist:
            # Generate fixed point widths if we can vary them
            if Param.WIDTH in obj._search_params:
                widths = obj._rng.integers(0, len(r.widths), n, dtype=np.uint64)
            else:
                widths = np.zeros(n, dtype=np.uint64)

            # Generate fixed point lengths if we can vary them
            if Param.LENGTH in obj._search_params:
                lengths = obj._rng.integers(0, len(r.lengths), n, dtype=np.uint64)
            else:
                lengths = np.zeros(n, dtype=np.uint64)

            if Param.FINGERS in obj._search_params:
                fingers = obj._rng.integers(0, len(r.fingers), n, dtype=np.uint64)
            else:
                fingers = np.zeros(n, dtype=np.uint64)

            return obj._reference_netlist.clone(
                cell_name=obj._get_netlist_name(idx),
                device_widths=tuple(float(r.widths[w]) for w in widths),
                device_lengths=tuple(float(r.lengths[l]) for l in lengths),
                device_fingers=tuple(r.fingers[f] for f in fingers),
            )

        return [rand_netlist(idx) for idx in range(obj._num_individuals)]

        Generate N (obj._num_individuals) netlists where each netlist has random device widths, lengths and fingers.
        The randomized widths, lengths and fingers follow a normal distribution and satisfy the constraints given in
        class initializer.

        :return: a sequence of randomly generated netlists
        
Generate N (obj._num_individuals) netlists where each netlist has random device widths, lengths and fingers.
The randomized widths, lengths and fingers follow a normal distribution and satisfy the constraints given in
class initializer.
Generate N ( obj . _num_individuals ) netlists where each netlist has random device widths lengths and fingers . The randomized widths lengths and fingers follow a normal distribution and satisfy the constraints given in class initializer .
def _generate_initial_population(obj: "GeneticCandidateGenerator") -> Sequence[Netlist]:
        r = obj._range_info
        n = obj._ndevices
        def rand_netlist(idx: int) -> Netlist:
            if Param.WIDTH in obj._search_params:
                widths = obj._rng.integers(0, len(r.widths), n, dtype=np.uint64)
            else:
                widths = np.zeros(n, dtype=np.uint64)
            if Param.LENGTH in obj._search_params:
                lengths = obj._rng.integers(0, len(r.lengths), n, dtype=np.uint64)
            else:
                lengths = np.zeros(n, dtype=np.uint64)
            if Param.FINGERS in obj._search_params:
                fingers = obj._rng.integers(0, len(r.fingers), n, dtype=np.uint64)
            else:
                fingers = np.zeros(n, dtype=np.uint64)
            return obj._reference_netlist.clone(
                cell_name=obj._get_netlist_name(idx),
                device_widths=tuple(float(r.widths[w]) for w in widths),
                device_lengths=tuple(float(r.lengths[l]) for l in lengths),
                device_fingers=tuple(r.fingers[f] for f in fingers),
            )
        return [rand_netlist(idx) for idx in range(obj._num_individuals)]
def _generate_initial_population ( obj : "GeneticCandidateGenerator" ) -> Sequence [ Netlist ] : r = obj . _range_info n = obj . _ndevices def rand_netlist ( idx : int ) -> Netlist : if Param . WIDTH in obj . _search_params : widths = obj . _rng . integers ( 0 , len ( r . widths ) , n , dtype = np . uint64 ) else : widths = np . zeros ( n , dtype = np . uint64 ) if Param . LENGTH in obj . _search_params : lengths = obj . _rng . integers ( 0 , len ( r . lengths ) , n , dtype = np . uint64 ) else : lengths = np . zeros ( n , dtype = np . uint64 ) if Param . FINGERS in obj . _search_params : fingers = obj . _rng . integers ( 0 , len ( r . fingers ) , n , dtype = np . uint64 ) else : fingers = np . zeros ( n , dtype = np . uint64 ) return obj . _reference_netlist . clone ( cell_name = obj . _get_netlist_name ( idx ) , device_widths = tuple ( float ( r . widths [ w ] ) for w in widths ) , device_lengths = tuple ( float ( r . lengths [ l ] ) for l in lengths ) , device_fingers = tuple ( r . fingers [ f ] for f in fingers ) , ) return [ rand_netlist ( idx ) for idx in range ( obj . _num_individuals ) ]
Generate N (obj._num_individuals) netlists where each netlist has random device widths, lengths and fingers.
Generate N ( obj . _num_individuals ) netlists where each netlist has random device widths lengths and fingers .
# pylint: disable=protected-access """
        Generate N (obj._num_individuals) netlists where each netlist has random device widths, lengths and fingers.
        The randomized widths, lengths and fingers follow a normal distribution and satisfy the constraints given in
        class initializer.

        :return: a sequence of randomly generated netlists
        """ # Generate fixed point widths if we can vary them # Generate fixed point lengths if we can vary them
a sequence of randomly generated netlists
a sequence of randomly generated netlists
obj
"GeneticCandidateGenerator"