CkPttn 1.2.4
Loading...
Searching...
No Matches
FMConstrMgr.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <cstdint> // for uint8_t
9#include <span> // for span
10#include <vector> // for vector
11
12// #include "moveinfo.hpp" // for MoveInfo
13
14// forward declare
15template <typename Node> struct MoveInfo;
16template <typename Node> struct MoveInfoV;
17
23
29template <typename Gnl> class FMConstrMgr {
30 private:
32 const Gnl& hyprgraph;
34 double bal_tol;
36 unsigned int total_weight{0};
38 unsigned int weight{};
39
40 protected:
42 std::vector<unsigned int> diff;
44 unsigned int lowerbound{};
46 std::uint8_t num_parts;
47
48 using node_t = typename Gnl::node_t;
49
57 FMConstrMgr(const Gnl& hyprgraph, double bal_tol) : FMConstrMgr(hyprgraph, bal_tol, 2) {}
58
67 FMConstrMgr(const Gnl& hyprgraph, double bal_tol, std::uint8_t num_parts);
68
69 public:
75 auto init(std::span<const std::uint8_t> part) -> void;
76
85 auto check_legal(const MoveInfoV<node_t>& move_info_v) -> LegalCheck;
86
96 auto check_constraints(const MoveInfoV<node_t>& move_info_v) -> bool;
97
103 auto update_move(const MoveInfoV<node_t>& move_info_v) -> void;
104
110 auto final_check(std::span<const std::uint8_t> part) -> bool;
111};
LegalCheck
Check if the move of v can satisfied, GetBetter, or NotSatisfied.
Definition FMConstrMgr.hpp:22
Fiduccia-Mattheyses Partition Constraint Manager.
Definition FMConstrMgr.hpp:29
auto final_check(std::span< const std::uint8_t > part) -> bool
Performs a final check on the partitioning based on the given partition information.
auto check_legal(const MoveInfoV< node_t > &move_info_v) -> LegalCheck
Check if the proposed move of the given nodes can be legally performed, and if so,...
auto update_move(const MoveInfoV< node_t > &move_info_v) -> void
Update the partitioning based on the proposed node moves.
std::vector< unsigned int > diff
Difference between current partition weight and target for each partition.
Definition FMConstrMgr.hpp:42
std::uint8_t num_parts
Number of partitions.
Definition FMConstrMgr.hpp:46
FMConstrMgr(const Gnl &hyprgraph, double bal_tol)
Constructs a new FMConstrMgr object with the given hypergraph and balance tolerance,...
Definition FMConstrMgr.hpp:57
FMConstrMgr(const Gnl &hyprgraph, double bal_tol, std::uint8_t num_parts)
Constructs a new FMConstrMgr object with the given hypergraph, balance tolerance, and number of parti...
typename Gnl::node_t node_t
Definition FMConstrMgr.hpp:48
auto check_constraints(const MoveInfoV< node_t > &move_info_v) -> bool
Check if the proposed moves in the given vector of move information can be legally performed while sa...
auto init(std::span< const std::uint8_t > part) -> void
Initializes the FMConstrMgr with the given partition information.
unsigned int lowerbound
Lower bound for partition weight (based on balance tolerance)
Definition FMConstrMgr.hpp:44
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