c++ - How to get number of constraints from Cplex -
i have long program i've written in c++ , i'm using ilog cplex12.5 solver solve it. how can total number of constraints? there function it?
there class ilomodel::iterator class lets visit iloextractable objects in ilomodel object. iloextractable has method asconstraint return empty handle if extractable not constraint. getimpl() method ilog concert handle return 0. can iterate across extractable objects , count ones who's asconstraint function don't return empty handle.
#include <ilconcert/ilomodel.h> unsigned getnumconstraints(ilomodel m) { unsigned count = 0; ilomodel::iterator iter(m); while (iter.ok()) { if ((*iter).asconstraint().getimpl()) { ++count; } ++iter; } return count; }
Comments
Post a Comment