I'm trying to validate my model, this is the relevant part of my code:
cp_model.Maximize(LinearExpr::Sum(obj_final));
SatHelper::ValidateModel(cp_model);
//solve
Model model;
//
// Sets a time limit of 10 seconds.
SatParameters parameters;
parameters.set_max_time_in_seconds(10.0);
model.Add(NewSatParameters(parameters));
// Solve.
const CpSolverResponse response = SolveCpModel(cp_model.Build(), &model);
LOG(INFO) << CpSolverResponseStats(response);
if (response.status() == CpSolverStatus::FEASIBLE) {
for (int j = 0; j < nbTasks; ++j)
{
LOG(INFO) << " x = " << SolutionIntegerValue(response, starts[j]);
}}
For some reason my model is invalid and I want to validate it to get detailed information about it. But I get this error:
error: no matching function for call to ‘operations_research::sat::SatHelper::ValidateModel(operations_research::sat::Model&)’
SatHelper::ValidateModel(model);
and suggests:
note: candidate: static std::__cxx11::string operations_research::sat::SatHelper::ValidateModel(const operations_research::sat::CpModelProto&)
So, what is a CpModelProto
? I read the documentation but it is hard to understand. I've seen most of the c++ examples of or-tools and I haven't found any CpModelProto
in the solving part. And finally, what can I do to validate my model and check where the problem is?
Additionally, if someone can give me a nice explanation of how to print/solve and setting parameters, it will be nice, because the examples use FLAGS and LOG and they are confusing.
Thanks!