CkPttn 1.2.4
Loading...
Searching...
No Matches
FMKWayConstrMgr.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 "FMConstrMgr.hpp" // for FMConstrMgr, FMConstrMgr::node_t, Lega...
13// #include "moveinfo.hpp" // for MoveInfo
14
15// forward declare
16template <typename Node> struct MoveInfo;
17template <typename Node> struct MoveInfoV;
18
24template <typename Gnl> class FMKWayConstrMgr : public FMConstrMgr<Gnl> {
25 private:
26 std::vector<int> illegal;
27
28 public:
36 FMKWayConstrMgr(const Gnl& hyprgraph, double bal_tol, std::uint8_t num_parts)
37 : FMConstrMgr<Gnl>{hyprgraph, bal_tol, num_parts}, illegal(num_parts, 1) {}
38
44 auto select_togo() const -> std::uint8_t;
45
51 auto init(std::span<const std::uint8_t> part) -> void {
53 auto it = this->diff.begin();
54 for (auto& il : this->illegal) {
55 il = (*it < this->lowerbound);
56 ++it;
57 }
58 }
59
67};
FM partition constraint manager.
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
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
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
Fiduccia-Mattheyses num_parts-Way Partition Constraint Manager.
Definition FMKWayConstrMgr.hpp:24
auto select_togo() const -> std::uint8_t
Selects the next partition to move a node to.
FMKWayConstrMgr(const Gnl &hyprgraph, double bal_tol, std::uint8_t num_parts)
Constructs a new FMKWayConstrMgr object.
Definition FMKWayConstrMgr.hpp:36
auto init(std::span< const std::uint8_t > part) -> void
Initializes the FMKWayConstrMgr object with the given partition information.
Definition FMKWayConstrMgr.hpp:51
auto check_legal(const MoveInfoV< typename Gnl::node_t > &move_info_v) -> LegalCheck
Checks if the given move information is legal according to the constraints.
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