Originally posted by: gravistar
Hi,
I've been trying to use C++ concert technology with the 64-bit version on ubuntu.
I've been trying to display the solution for the following basic LP problem.
#include <ilcp/cp.h>
int nNodes = 22;
int main(
int ,
const
char * [])
{ IloEnv env;
try
{ IloModel model(env); IloNumVarArray vars(env);
for(
int i=0; i<nNodes; i++) vars.add(IloNumVar(env,0.0,1.0)); IloExpr objective(env);
for(
int i=0; i<nNodes; i++) objective += vars[i]; model.add(IloMaximize(env, objective)); IloCP cp(model);
if (cp.solve())
{ cp.out() << std::endl << cp.getStatus() <<
" Solution" << std::endl; IloNumArray vals(env); cp.getValues(vars, vals); cp.out() << std::endl << vals << std::endl;
}
}
catch (IloException& ex)
{ env.out() <<
"Error: " << ex << std::endl;
} env.end();
return 0;
}
However, I get this output:
IBM ILOG CPLEX Optimization Studio Preview Edition good
for 86 more days ! ---------------------------------------------------------------------------- ! Maximization problem - 0 variables, 0 constraints ! Initial process time : 0.00s (0.00s extraction + 0.00s propagation) ! . Log search space : 0.0 (before), 0.0 (after) ! . Memory usage : 530.6 KB (before), 530.6 KB (after) ! Using sequential search. ! ---------------------------------------------------------------------------- ! Best Branches Non-fixed Branch decision * 21.9999999994 34 0.00s - ! ---------------------------------------------------------------------------- ! Search terminated normally, 1 solution found. ! Best objective : 22 (optimal - effective tol. is 0.0022) ! Number of branches : 72 ! Number of fails : 34 ! Total memory usage : 540.3 KB (530.6 KB CP Optimizer + 9.7 KB Concert) ! Time spent in solve : 0.00s (0.00s engine + 0.00s extraction) ! Search speed (br. / s) : 7200.0 ! ---------------------------------------------------------------------------- Error: IloCP::getValue - variable is not fixed
#CPLEXOptimizers#DecisionOptimization