CkPttn 1.2.4
Loading...
Searching...
No Matches
NNPartMgr.hpp
Go to the documentation of this file.
1
6#pragma once
7
8// **Special code for two-pin nets**
9
10#include <cstdint> // for uint8_t
11#include <span> // for span
12// #include <xnetwork/classes/graph.hpp>
13
14// forward declare
15// template <typename graph_t> struct Netlist;
16// using SimpleNetlist = Netlist<xnetwork::SimpleGraph>;
17
18enum class LegalCheck;
19
50template <typename Gnl, typename GainMgr, typename ConstrMgr> //
51class NNPartMgr {
52 public:
53 using GainCalc_ = typename GainMgr::GainCalc_;
54 using GainMgr_ = GainMgr;
55 using ConstrMgr_ = ConstrMgr;
56
57 // using Der = Derived<Gnl, GainMgr, ConstrMgr>;
58
59 protected:
61 const Gnl& hyprgraph;
63 GainMgr& gain_mgr;
65 ConstrMgr& validator;
67 size_t num_parts;
68 // std::vector<std::uint8_t> snapshot;
69 // std::vector<std::uint8_t> part;
70
71 public:
73
82 NNPartMgr(const Gnl& hyprgraph, GainMgr& gain_mgr, ConstrMgr& constr_mgr, size_t num_parts)
84
90 void init(std::span<std::uint8_t> part);
91
98 auto legalize(std::span<std::uint8_t> part) -> LegalCheck;
99
105 void optimize(std::span<std::uint8_t> part);
106
107 private:
113 void _optimize_1pass(std::span<std::uint8_t> part);
114
120 auto final_check(std::span<const std::uint8_t> part) -> bool {
121 return this->validator.final_check(part);
122 }
123};
LegalCheck
Check if the move of v can satisfied, GetBetter, or NotSatisfied.
Definition FMConstrMgr.hpp:22
No-Nonsense Partitioning Algorithm Manager Base.
Definition NNPartMgr.hpp:51
ConstrMgr & validator
Constraint manager for validating partition constraints.
Definition NNPartMgr.hpp:65
const Gnl & hyprgraph
Reference to the hypergraph being partitioned.
Definition NNPartMgr.hpp:61
void init(std::span< std::uint8_t > part)
Initializes the partition manager with the given partition.
GainMgr & gain_mgr
Gain manager for computing and managing gains.
Definition NNPartMgr.hpp:63
GainMgr GainMgr_
Definition NNPartMgr.hpp:54
typename GainMgr::GainCalc_ GainCalc_
Definition NNPartMgr.hpp:53
size_t num_parts
Number of partitions.
Definition NNPartMgr.hpp:67
int total_cost
Definition NNPartMgr.hpp:72
ConstrMgr ConstrMgr_
Definition NNPartMgr.hpp:55
auto legalize(std::span< std::uint8_t > part) -> LegalCheck
Legalizes the partition to satisfy balance constraints.
NNPartMgr(const Gnl &hyprgraph, GainMgr &gain_mgr, ConstrMgr &constr_mgr, size_t num_parts)
Construct a new Part Mgr Base object.
Definition NNPartMgr.hpp:82
void optimize(std::span< std::uint8_t > part)
Optimizes the partition using the FM algorithm.