You can use the undocumented macro ILOARRAY_INPUT_OPERATOR to allow this sort of input (note that bools are provided as "0" and "1", not "false" and "true"):
#include <sstream>
#include <iostream>
#include <ilcplex/ilocplex.h>
ILOARRAY_INPUT_OPERATOR(IloBoolArray, IloArray<IloBoolArray>)
int
main(void)
{
std::stringstream ints("[1,2,3,4,5]");
std::stringstream ints2D("[[1,2,3,4,5],[6,7,8,9]]");
std::stringstream bools("[1,1,0,1,0]");
std::stringstream bools2D("[[1,1,0,1,0],[0,1,0]]");
IloEnv env;
IloIntArray intArray(env);
ints >> intArray;
std::cout << intArray << std::endl;
IloArray<IloIntArray> intArray2D(env);
ints2D >> intArray2D;
std::cout << intArray2D << std::endl;
IloBoolArray boolArray(env);
bools >> boolArray;
std::cout << boolArray << std::endl;
IloArray<IloBoolArray> boolArray2D(env);
bools2D >> boolArray2D;
std::cout << boolArray2D << std::endl;
env.end();
return 0;
}
#CPLEXOptimizers#DecisionOptimization