MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / computeHeatMap

Method computeHeatMap

cp-profiler/src/cpprofiler/conductor.cpp:589–650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587}
588
589void Conductor::computeHeatMap(ExecID eid, std::vector<NodeID> ns)
590{
591
592 auto it = exec_meta_.find(eid);
593
594 if (it == exec_meta_.end())
595 {
596 print("No metadata for eid {} (ExecMeta)", eid);
597 return;
598 }
599
600 /// check if namemap is there
601 const auto nm = it->second.name_map;
602
603 if (!nm)
604 {
605 print("no name map for eid: {}", eid);
606 return;
607 }
608
609 const auto exec = executions_.at(eid);
610
611 const auto &sd = exec->solver_data();
612
613 std::unordered_map<int, int> con_counts;
614
615 for (const auto& n : ns)
616 {
617 const auto *cs = sd.getContribConstraints(n);
618
619 if (!cs)
620 continue;
621
622 for (int con_id : *cs)
623 {
624 con_counts[con_id]++;
625 }
626 }
627
628 int max_count = 0;
629 for (const auto& p : con_counts)
630 {
631 if (p.second > max_count)
632 {
633 max_count = p.second;
634 }
635 }
636
637 const auto url = getHeatMapUrl(*nm, con_counts, max_count);
638
639 if (url.empty())
640 return;
641
642 std::stringstream label;
643
644 for (const auto n : ns)
645 {
646 label << std::to_string(n) << ' ';

Callers

nothing calls this directly

Calls 7

getHeatMapUrlFunction · 0.85
to_stringFunction · 0.85
findMethod · 0.80
getContribConstraintsMethod · 0.80
strMethod · 0.80
printFunction · 0.50
endMethod · 0.45

Tested by

no test coverage detected