Commit e75a45da authored by Chuanren Wu's avatar Chuanren Wu

maxIter as var

parent e345c752
......@@ -64,13 +64,14 @@ std::vector<int> discretizeImpl(
const std::vector<Constraint> &vc
)
{
const long maxIter = 100;
std::vector<int> minRes(vl.size());
std::transform(vl.begin(), vl.end(), minRes.begin(), atLeast1<double>);
// sort(vc) before the iterations?
long iterations = 0;
auto res = minRes;
bool trigger = true;
while (trigger && iterations < 100) {
while (trigger && iterations < maxIter) {
trigger = false;
for (const auto &c : vc) {
if (validate(c, minRes, vl, res)) {
......@@ -79,7 +80,7 @@ std::vector<int> discretizeImpl(
}
++iterations;
}
if (iterations == 100) {
if (iterations >= maxIter) {
#ifndef NDEBUG
std::cout << "max iteration number reached, failed to solve\n";
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment