10#include <mywheel/bpqueue.hpp>
11#include <mywheel/dllist.hpp>
17template <
typename Node>
struct MoveInfo;
32template <
typename Gnl,
typename GainCalc,
class Derived>
class FMGainMgr {
33 Derived& self = *
static_cast<Derived*
>(
this);
34 using node_t =
typename Gnl::node_t;
35 using Item = Dllink<std::pair<node_t, uint32_t>>;
39 Dllist<std::pair<node_t, uint32_t>>
waiting_list{std::make_pair(node_t{}, uint32_t(0))};
69 auto init(std::span<const std::uint8_t> part) -> int;
79 return this->gain_bucket[to_part].is_empty();
99 auto
select(std::span<const std::uint8_t> part) -> std::pair<
MoveInfoV<node_t>,
int>;
126 auto _update_move_2pin_net(std::span<const std::uint8_t> part,
127 const
MoveInfo<node_t>& move_info) ->
void;
135 auto _update_move_3pin_net(std::span<const std::uint8_t> part,
136 const
MoveInfo<node_t>& move_info) ->
void;
144 auto _update_move_general_net(std::span<const std::uint8_t> part,
145 const
MoveInfo<node_t>& move_info) ->
void;
Fiduccia-Mattheyses Gain Manager.
Definition FMGainMgr.hpp:32
auto is_empty_togo(uint8_t to_part) const -> bool
Checks if the gain bucket for the given partition is empty.
Definition FMGainMgr.hpp:78
auto update_move(std::span< const std::uint8_t > part, const MoveInfoV< node_t > &move_info_v) -> void
Updates the gain information for the given set of moves.
std::uint8_t num_parts
Number of partitions.
Definition FMGainMgr.hpp:45
const Gnl & hyprgraph
Reference to the hypergraph being partitioned.
Definition FMGainMgr.hpp:41
GainCalc gain_calc
Gain calculator instance.
Definition FMGainMgr.hpp:49
Dllist< std::pair< node_t, uint32_t > > waiting_list
Waiting list for vertices awaiting movement.
Definition FMGainMgr.hpp:39
std::vector< BPQueue< node_t > > gain_bucket
Gain buckets for each partition (used in bucket-based gain management)
Definition FMGainMgr.hpp:43
auto init(std::span< const std::uint8_t > part) -> int
Initializes the FMGainMgr with the given partition information.
auto select(std::span< const std::uint8_t > part) -> std::pair< MoveInfoV< node_t >, int >
Selects a vertex to move and computes the associated gain.
auto select_togo(uint8_t to_part) -> std::pair< node_t, int >
Selects a node to move to the given partition.
auto is_empty() const -> bool
Checks if all the gain buckets are empty.
FMGainMgr(const Gnl &hyprgraph, std::uint8_t num_parts)
Constructs a new FMGainMgr object.
Move information for a single vertex (without net reference)
Definition moveinfo.hpp:37
Move information for a single vertex in a net.
Definition moveinfo.hpp:18