我有一个由定义的多图
typedef std::pair<int, int> au_pair; //vertices
typedef std::pair<int, int> acq_pair; //ch qlty specified by C
typedef std::multimap<int, acq_pair> au_map;
typedef au_map::iterator It_au;
没有。的模拟取决于au_map
. 例如:如果au_map.size() = 5
我将有 C1、C2、C3、C4、C5。因此 2^5 = 32 例。
例如:如果是au_map.size()=4
,我需要模拟我的算法 16 个案例。
for(size_t i = 0; i != 16; ++i)
{
for(It_au it = a_map.begin(); it != a_map.end();)
{
acq_pair it1 = it->second;
//case 0:
//C1 = 0, C2 = 0, C3 = 0, C4 = 0
//@Matthieu M 's suggestion http://stackoverflow.com/questions/3110975/c-case-declaration-closed
//bool const c1 = i & 1;
//bool const c2 = i & 2;
//bool const c3 = i & 4;
//bool const c4 = i & 8;
//Update it1.second with corresponding C values
it->second.second = C1;
it++;
it->second.second = C2;
it++;
it->second.second = C3;
it++;
it->second.second = C4;
it++;
}
//simulate algorithm
}
如何使这个过程自动化,C 的大小根据au_map.size()
?因此,我将有 C1, C2, C3, C4 whenau_map.size() = 4
和 C1, C2, C3, C4, C5 when au_map.size() = 5
。
另外,什么是具有这些值的向量的首选,或者将其添加到多图内的一对中?矢量查找时间小于多图。
此外,如果我继续向多图插入值,新/更新的值是否会传递给算法?