Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Debugging ILOG CP programmes 2

    Posted 12/09/11 08:34 AM

    Originally posted by: anahana


    Hi guys,

    First of all, sorry for posting the same subject again, but I already closed the first one and marked it as "answered".

    My question is: I know I can't step into functions from the pre-compiled libraries from ILOG CP when I debug a piece of code, but can't I view the contents of an instance of IloArray for example without having to print it on the screen (i.e. in debug mode)? The only information I can get about arrays in debug mode is their size.

    Regards,
    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Debugging ILOG CP programmes 2

    Posted 12/09/11 10:11 AM

    Originally posted by: SystemAdmin


    Hello again!

    In general, for Concert objects (starting with "Ilo") you can usually see their content because delivered header files contain their definitions. It is not the case for CP Optimizer objects (starting with "Ilc") though.

    However the case of IloArray is a bit special. IloArray is a template class with only one data member: pointer _impl to non-template class IloArrayI (the "I" stands for implementation). Both these classes are defined in delivered header file concert/include/ilconcert/iloenv.h, so you can see their structure.

    Note that IloArrayI is not documented and you should not access this class directly in your code (undocumented classes can change from release to release without any notice). However IloArrayI is what you see in the debugger when you try to look inside an instance of IloArray class. IloArray delegates most of the work to IloArrayI, however IloArrayI does not know the data type of items stored in the array. The role or IloArray is to cast the data to the right type before returning the result to the user.

    So, in case of IloArray, debugger cannot show you the content of the array (even if you would have the whole source code). However, some debuggers allow you to call functions and see their results. They can even call functions you define after each step. For example, you can see how yourArray->getSize() is changing. I believe Visual C++ has this ability, however I do not use Visual C++ so I can't give you details (in Linux gdb you can do that using "print" and "display" commands). Also, I do not know whether your debugger will understand
    
    yourArray[1]
    
    or you whether you have to write something like
    
    yourArray.operator[](1)
    
    .

    I know it is not very convenient, but I do not know about a better way. Note that just for the purpose of debugging, you can define your own formatting function for IloArray (returning char* for example). Then you can instruct the debugger to re-evaluate this function after each step and this way effectively display the content of the array each time the program is paused.

    I hope it helps, Petr
    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: Debugging ILOG CP programmes 2

    Posted 12/09/11 02:38 PM

    Originally posted by: anahana


    Hi Petr,

    Thanks for getting back to me so soon, and for your detailed reply. My debugger accepts things like "yourArray[1]", it would be very helpful to call functions and see their results, I don't need more than that. I'll search around and see how VC can do it. If anything comes to mind, please let me know.

    Regards,
    #CPOptimizer
    #DecisionOptimization