Originally posted by: Trino
Thank you very much for the replies @BillCook and @EdKlotz. I tried the workaround proposed by Bill and it worked just fine, I'm not getting anymore that segmentation fault error. However I would like to try finding out why that error was happening.
Before trying what EdKlotz suggested I want to check whether or not the problem is in my code that calls concorde and see if I'm doing something wrong with the parameter values that I use to call CCtsp_solve_dat
The CCtsp_solve_dat function has the following prototype
int CCtsp_solve_dat (int ncount, CCdatagroup *indat, int *in_tour,
int *out_tour, double *in_val, double *optval, int *success,
int *foundtour, char *name, double *timebound, int *hit_timebound,
int silent, CCrandstate *rstate)
In order to fill in an instance of CCdatagroup I first create the array of edges with size equal to the total number of edges*2, where the first edge connects the vertices in indexes 0 and 1, the second connects 2 and 3 and so on. I also create the array for the weights of each edge with total size equal to the number of edges and since my original weight values are double I multiply them by a scale factor of 1e3. Then I have the following code to create and fill the CCdatagroup instance:
CCdatagroup dataGroup;
CCutil_init_datagroup(&dataGroup);
CCutil_graph2dat_matrix(numVertices, numEdges, edgesC, edgesValuesC, INT_MAX, &dataGroup);
After this point I define and initialize the other variables needed to call CCtsp_solve_dat
int *solutionTour = new int[numVertices]
,success = INT_MAX
,foundTour = INT_MAX
,hitTimeBound = INT_MAX
,concordeSeed = (int)CCutil_real_zeit();
double optVal = INT_MAX;
CCrandstate rstate;
CCutil_sprand (concordeSeed, &rstate);
Then I finally call CCtsp_solve_dat by doing
CCtsp_solve_dat(numVertices, &dataGroup, NULL, solutionTour, NULL, &optVal, &success, &foundTour, NULL, NULL, &hitTimeBound, false, &rstate);
Am I missing something or doing something wrong?
Thank you.
Bruno.
#CPLEXOptimizers#DecisionOptimization