Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src\constraint_solver\expressions.cc doesn't build on VS2013 #60

Closed
orwant opened this issue Aug 5, 2015 · 2 comments
Closed

src\constraint_solver\expressions.cc doesn't build on VS2013 #60

orwant opened this issue Aug 5, 2015 · 2 comments
Assignees
Milestone

Comments

@orwant
Copy link
Collaborator

orwant commented Aug 5, 2015

Originally reported on Google Code with ID 44

What steps will reproduce the problem?
1. Build on Windows with Visual Studio 2013

Error to build file src\constraint_solver\expressions.cc, method Solver::MakeIntVar

To fix it, add the namespace "std" to the vector instances used inside the method:

IntVar* Solver::MakeIntVar(const std::vector<int64>& values, const std::string& name)
{
  const std::vector<int64> cleaned = SortedNoDuplicates(values);
  int64 gcd = 0;
  for (int64 v : cleaned) {
    if (v == 0) {
      continue;
    }
    if (gcd == 0) {
      gcd = std::abs(v);
    } else {
      gcd = MathUtil::GCD64(gcd, std::abs(v));
    }
    if (gcd == 1) {
      break;
    }
  }
  if (gcd == 1) {
    return RegisterIntVar(RevAlloc(new DomainIntVar(this, cleaned, name)));
  } else {
    std::vector<int64> new_values;
    new_values.reserve(values.size());
    for (int64 v : cleaned) {
      DCHECK_EQ(0, v % gcd);
      new_values.push_back(v / gcd);
    }
    const std::string new_name = name.empty() ? "" : "inner_" + name;
    IntVar* const inner =
        RegisterIntVar(RevAlloc(new DomainIntVar(this, new_values, new_name)));
    return MakeProd(inner, gcd)->Var();
  }
}


Reported by izanette on 2014-05-19 18:10:50

@orwant
Copy link
Collaborator Author

orwant commented Aug 5, 2015

Fixed, thanks

Reported by laurent.perron on 2014-05-21 13:50:34

@orwant
Copy link
Collaborator Author

orwant commented Aug 5, 2015

Reported by laurent.perron on 2014-05-21 13:50:54

  • Status changed: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants