CkPttn 1.2.5
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 "LegalCheck.hpp" // for LegalCheck
13
14// #include "moveinfo.hpp" // for MoveInfo
15
16// forward declare
17template <typename Node> struct MoveInfo;
18template <typename Node> struct MoveInfoV;
19
25template <typename Gnl> class FMConstrMgr {
26 private:
28 const Gnl& hyprgraph;
30 double bal_tol;
32 unsigned int total_weight{0};
34 unsigned int weight{};
35
36 protected:
38 std::vector<unsigned int> diff;
40 unsigned int lowerbound{};
42 std::uint8_t num_parts;
43
44 using node_t = typename Gnl::node_t;
45
53 FMConstrMgr(const Gnl& hyprgraph, double bal_tol) : FMConstrMgr(hyprgraph, bal_tol, 2) {}
54
63 FMConstrMgr(const Gnl& hyprgraph, double bal_tol, std::uint8_t num_parts);
64
65 public:
71 auto init(std::span<const std::uint8_t> part) -> void;
72
81 auto check_legal(const MoveInfoV<node_t>& move_info_v) -> LegalCheck;
82
92 auto check_constraints(const MoveInfoV<node_t>& move_info_v) -> bool;
93
99 auto update_move(const MoveInfoV<node_t>& move_info_v) -> void;
100
106 auto final_check(std::span<const std::uint8_t> part) -> bool;
107};
Result of a partition legality check.
LegalCheck
Check if the move of v can be satisfied, get better, or not satisfied.
Definition LegalCheck.hpp:11
Fiduccia-Mattheyses Partition Constraint Manager.
Definition FMConstrMgr.hpp:25
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:38
std::uint8_t num_parts
Number of partitions.
Definition FMConstrMgr.hpp:42
FMConstrMgr(const Gnl &hyprgraph, double bal_tol)
Constructs a new FMConstrMgr object with the given hypergraph and balance tolerance,...
Definition FMConstrMgr.hpp:53
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:44
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:40
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