Originally posted by: rdumeur
Dear FIFIla,
Ilo prefixed object types are modeling ones. Thus you will use IloIntVar when you want to create an integer variable in your model. For instance, the following snippets
create an "all different" constraint on an array of variables "x". It uses "Ilo" data types "IloIntVarArray" and "IloAllDiff" to create variables and constraints respectively.
#include <ilcp/cp.h>
int main() {
IloEnv env;
IloIntVarArray x(env, 10, 0, 9);
IloModel m(env);
m.add(IloAllDiff(env, x));
IloCP cp(m);
cp.solve();
for(IloInt i = 0; i < 10; ++i)
std::cout << "x[" << i << "] = " << cp.getValue(x[i]) << std::endl;
cp.end();
env.end();
return 0;
}
I hope this helps.
Cheers,
#CPOptimizer#DecisionOptimization