i have this in the main :

#define N 23


     readData(c); // just read a matrix of integer size N (in this case matrix 23*23) 
     lp (c,d);   // resolve it by cplex with a time limit cplex command  1h 30

 time = (final_time -start-time) *0.001;

 printf("\n CPU = %f sec\n\n", time);

the problem shows:


efault row names c1, c2 ... being created.
solution status is Feasible
obj. value: 5557
gap : 1.1697

 CPU = 10800.494141 sec

why the time is so large? did the main() spend another 1 h just to read a matrix size 23*23 !!!!!!

asked 04 Dec '15, 04:22

fathese's gravatar image

accept rate: 0%

Are you measuring CPU time or wall clock time? See here .

(04 Dec '15, 06:47) Sune

i just made in cplex instructions:

cplex.setParam ( IloCplex :: TiLim ,5400) ; and i didn't fix any clocktime

and the time return by the main fonction the program is 10800 sec and not by cplex as it was mentionned in the code.

aren't they both cpu time?

(04 Dec '15, 07:36) fathese
  1. You should compute the CPU time for each segment of your code separately (one for reading data and one for solving the problem). You could do the same for different parts of your lp() method (model construction, solving, etc.) to make sure it is written correctly. This way you could make sure that if there is a problem with CPLEX CPU time and where the problem is.

  2. Are you solving a LP model or a MIP one?

(05 Dec '15, 12:42) Ehsan ♦

i have check the cpu time and they were correct and logic for each step i think this is a problem in setting 1 or multithread

(07 Dec '15, 08:13) fathese


answered 04 Dec '15, 07:56

Erling_MOSEK's gravatar image

accept rate: 3%

i check the c time and the cplex time and i found that cplex is responsable for this time but what is the cause

   cplex.setParam ( IloCplex :: TiLim ,5400) ;


           if ( !cplex.solve() ) {
           env.error() << "Failed to optimize LP." << endl;
           throw(-1); }

           env.out() << "solution status is " << cplex.getStatus() << endl;
        env.out() << "obj. value: "<< cplex.getObjValue() << endl;

        catch (IloException& ex) 
            cerr << "Error1: " << ex << endl;
        catch (...)
            cerr << "Error2" << endl;

if i write:cplex gettime it return a time much longer than fixed  by tilim (5 hours or plus!!)
what indicate time fixed by cplex tilim ?
what did cplex do at that time??

answered 08 Dec '15, 02:58

fathese's gravatar image

accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 04 Dec '15, 04:22

Seen: 744 times

Last updated: 08 Dec '15, 02:58

OR-Exchange! Your site for questions, answers, and announcements about operations research.