Skip to content

Commit 23ef569

Browse files
committed
Added next step of tearing(preliminary)
1 parent a29f8ed commit 23ef569

2 files changed

Lines changed: 31 additions & 5 deletions

File tree

sbg/sbg_algorithms.cpp

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ PWMap SBGSCC::calculate()
640640
auto total = std::chrono::duration_cast<std::chrono::microseconds>(
641641
end - begin
642642
);
643-
Util::SBG_LOG << "Total SCC exec time: " << total.count() << " [μs]\n\n";
643+
Util::SBG_LOG << "Total SCC exec time: " << total.count() << " [μs]\n\n";
644644

645645
if (debug())
646646
Util::SBG_LOG << "SCC result: " << rmap.compact() << "\n\n";
@@ -829,31 +829,56 @@ PWMap SBGTearing::sccStep()
829829
return new_rmap;
830830
}
831831

832+
void SBGTearing::restoreSBG()
833+
{
834+
V_ = dsbg_.V();
835+
Vmap_ = dsbg_.Vmap();
836+
837+
E_ = dsbg_.E();
838+
Emap_ = dsbg_.Emap();
839+
subEmap_ = dsbg_.subEmap();
840+
841+
mapB_ = dsbg_.mapB();
842+
mapD_ = dsbg_.mapD();
843+
}
844+
832845
PWMap SBGTearing::calculate()
833846
{
834-
if (debug()) Util::SBG_LOG << "SCC dsbg: \n" << dsbg() << "\n\n";
847+
if (debug()) Util::SBG_LOG << "Tearing dsbg: \n" << dsbg() << "\n\n";
835848

836849
auto begin = std::chrono::high_resolution_clock::now();
837850
PWMap rmap = sccStep();
838851
Set vrem = fact_.createSet();
852+
Set e_scc = fact_.createSet();
839853
do {
854+
// SCC
840855
do {
841856
rmap = sccStep();
842857
} while (Ediff() != fact_.createSet());
843-
858+
//
859+
e_scc = E();
844860
if (E() != fact_.createSet()) {
845861
Set erem_b = mapB().preImage(rmap.image());
846862
Set erem_d = mapD().preImage(rmap.image());
847863
vrem = vrem.cup(mapB().image(erem_b)).cup(mapD().image(erem_d));
848-
std::cout << erem_b.cup(erem_d) << std::endl;
849864
E_ = E().difference(erem_b.cup(erem_d));
850865
}
851866
rmap_ = rmap.compact();
852867
} while (E() != fact_.createSet());
868+
restoreSBG();
869+
Set e_notscc = E().difference(e_scc);
870+
Set e_to_R = mapD().preImage(rmap.image());
871+
PWMap mapD_notscc = mapD().restrict(e_to_R);
872+
873+
Set erem = e_scc.intersection(mapB().preImage(vrem));
874+
Set mapD_aux = mapD().image(erem);
875+
853876
auto end = std::chrono::high_resolution_clock::now();
854877

855878
auto total = std::chrono::duration_cast<std::chrono::microseconds>(end - begin);
856-
Util::SBG_LOG << "Total SCC exec time: " << total.count() << " [μs]\n\n";
879+
Util::SBG_LOG << "Total Tearing exec time: " << total.count() << " [μs]\n\n";
880+
std::cout << vrem << std::endl;
881+
std::cout << dsbg().E() << std::endl;
857882

858883
if (debug()) {
859884
Util::SBG_LOG << "Tearing result: " << rmap.compact() << "\n\n";

sbg/sbg_algorithms.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ struct SBGTearing {
205205
private:
206206
PWMap sccMinReach(const DSBG &dg) const;
207207
PWMap sccStep();
208+
void restoreSBG();
208209
};
209210
////////////////////////////////////////////////////////////////////////////////
210211
// Topological sort ------------------------------------------------------------

0 commit comments

Comments
 (0)