Originally posted by: Lessi
Hi CPers,
I am familiar with writing MIP models using Concert technology. However, I am totally new with the constraint programming. I want to write the following model using CP.
The model is attached below since it displays "spam" when I try to attach it here.
I am not sure how to write the code for constraints (3) and (7). Which part of the manual I should read to do that? This is how I code at the moment.
IloEnv envCP;
int nbPOIs = candidatePOIs.size();
try {
IloModel modelCP(envCP);
IloIntVarArray pSlaveCP(envCP, nbPOIs, 0, nbPOIs-1); //constraint (6).
modelCP.add(IloAllDiff(envCP, pSlaveCP, "alldifference")); //this is constraint (2)
modelCP.add(pSlaveCP[0] == 0); //constraint (4)
modelCP.add(pSlaveCP[nbPOIs - 1] == nbPOIs - 1); //constraint (5)
I am not sure how to write the code for constraints (3) and (7)
}
}
catch (IloException& ex) {
env.out() << "Error: " << ex << std::endl;
}
env.end();
Thanks,
/Lessi
#CPOptimizer#DecisionOptimization