Topic
  • 5 replies
  • Latest Post - ‏2016-06-15T09:08:51Z by Moit1910
MaxDr
MaxDr
2 Posts

Pinned topic How to Write the Objective Value and Run Time to Excel?

‏2013-10-07T16:00:58Z | excel objective run time value

Hey,

 

After running a configuration in Cplex Studio IDE, I want to write the resulting objective value and run time into an excel file. I have no problems with writing other parameters, but I am kind of stuck with these.

 

Best,

MaxDr.

 

  • AlexFleischer
    AlexFleischer
    2322 Posts

    Re: How to Write the Objective Value and Run Time to Excel?

    ‏2013-10-08T18:10:00Z  

    Hi,

     

    for the objective, if you have dvar int obj; you  need to use SheetWrite on obj

    for the run time, do int d1; and int d2; int t;  and use

    execute

    {

    d1=new Date();

    }

     

    and then later

     

    execute

    {

    d2=new Date();

    t=d2-d1,

    }

    and in the .dat you do a SheetWrite on t

     

    Regards

  • MaxDr
    MaxDr
    2 Posts

    Re: How to Write the Objective Value and Run Time to Excel?

    ‏2013-10-17T01:43:31Z  

    Hi,

     

    for the objective, if you have dvar int obj; you  need to use SheetWrite on obj

    for the run time, do int d1; and int d2; int t;  and use

    execute

    {

    d1=new Date();

    }

     

    and then later

     

    execute

    {

    d2=new Date();

    t=d2-d1,

    }

    and in the .dat you do a SheetWrite on t

     

    Regards

    Hey,

     

    Thank you very much Alex, it worked out perfectly. Just in case of dvar int obj, I needed to use dexpr int obj, and it's done!

     

    Best

  • Moit1910
    Moit1910
    14 Posts

    Re: How to Write the Objective Value and Run Time to Excel?

    ‏2016-06-14T09:58:42Z  

    Hi,

     

    for the objective, if you have dvar int obj; you  need to use SheetWrite on obj

    for the run time, do int d1; and int d2; int t;  and use

    execute

    {

    d1=new Date();

    }

     

    and then later

     

    execute

    {

    d2=new Date();

    t=d2-d1,

    }

    and in the .dat you do a SheetWrite on t

     

    Regards

    Hi,

    I have a problem with that solution.

    I did exactly, what you suggested but I always get an error saying "cannot convert to an integer, "06/14/2016 11:47:26 876" at the line, in that I have d1=new Date();

     

    I also tried d1 == new Date() and d2 == new Date() and this does not give the error but the computed run time for t is always zero then, alltough the actual run time is about 25 seconds in the example I tried that with.

     

    What am I doing wrong?

    Do I have to use something different from integer as type?

     

    In what unit does this give you the run time anyways? Is that minutes or seconds or what is it?

     

    Thank you in advance

     

    Updated on 2016-06-14T14:44:43Z at 2016-06-14T14:44:43Z by Moit1910
  • AlexFleischer
    AlexFleischer
    2322 Posts

    Re: How to Write the Objective Value and Run Time to Excel?

    ‏2016-06-15T07:02:38Z  
    • Moit1910
    • ‏2016-06-14T09:58:42Z

    Hi,

    I have a problem with that solution.

    I did exactly, what you suggested but I always get an error saying "cannot convert to an integer, "06/14/2016 11:47:26 876" at the line, in that I have d1=new Date();

     

    I also tried d1 == new Date() and d2 == new Date() and this does not give the error but the computed run time for t is always zero then, alltough the actual run time is about 25 seconds in the example I tried that with.

     

    What am I doing wrong?

    Do I have to use something different from integer as type?

     

    In what unit does this give you the run time anyways? Is that minutes or seconds or what is it?

     

    Thank you in advance

     

    Hi,

    instead of int, I now use float:

    float d1;
    float d2;

      execute

    {

    d1=new Date();

    }

     

    subject to
    {

    }

     

    execute

    {

    d2=new Date();


    t=d2-d1;
    writeln("time =",t);
    }

    regards

    PS: the result is in miliseconds

    Updated on 2016-06-15T07:03:10Z at 2016-06-15T07:03:10Z by AlexFleischer
  • Moit1910
    Moit1910
    14 Posts

    Re: How to Write the Objective Value and Run Time to Excel?

    ‏2016-06-15T09:08:51Z  

    Hi,

    instead of int, I now use float:

    float d1;
    float d2;

      execute

    {

    d1=new Date();

    }

     

    subject to
    {

    }

     

    execute

    {

    d2=new Date();


    t=d2-d1;
    writeln("time =",t);
    }

    regards

    PS: the result is in miliseconds

    Thank you for your help.

    That one does it. ;-)