Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Getting memory consumption in callbacks: HOW ????

    Posted 11/24/10 05:20 AM

    Originally posted by: Stidsen


    Hi

    I am running a customized Branch & Cut algorithm, where I use Cplex
    cutcallback, incumbentcallback and branchcallback. I have a problem
    with controlling the memory consumption ... It seems that the standard
    parameters (CPX_PARAM_TRELIM, CPX_PARAM_WORKMEM and CPX_PARAM_NODEFILEIND)
    have no effect. That is ok, if I could just somehow FROM INSIDE MY CALLBACKS
    get an estimate of the current memory usage ... then I could terminate
    the code my self ... Does anybody know how to get such an estimate ...
    (it does not have to be very precise). And yes, I know I can get counts
    on the current no of nodes, but depending on the problem instance, same number
    of nodes can have very different memory usage ...

    Any help will be appreciated !

    Best Regards Thomas Stidsen
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Getting memory consumption in callbacks: HOW ????

    Posted 11/24/10 05:51 AM

    Originally posted by: SystemAdmin


    This is a very complicated issue. Actually, if someone says "how much memory is consumed" it is not really clear what this means.

    For example, one way of measuring memory is the total amount of virtual memory that is allocated by the process. But this does not necessarily mean that the memory is actually paged into physical memory. You can easily allocate several GB of memory without doing any harm to your machine, as long as you are not actually using all the memory at the same time.

    Accessing the memory statistics is not easily portable across multiple platforms. But if you just want to have a solution for your platform, then you may be able to find the appropriate OS calls. On Linux, for example, you could read out the proc file system to get some statistics.

    Tobias
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Getting memory consumption in callbacks: HOW ????

    Posted 11/24/10 06:49 AM

    Originally posted by: SystemAdmin


    Wait, are you saying that these parameters are ignored?
    Or is it just that they do not provide enough granularity?

    As Tobias said, assessing the actual memory consumption of a process is kind of difficult. On Linux/Unix operating systems you may read the /proc file system (as suggested by Tobias) or use function getrusage() directly. In Windows GetProcessMemoryInfo() may help. In any case, make sure that you do not compare virtual memory ...
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Getting memory consumption in callbacks: HOW ????

    Posted 11/24/10 07:01 AM

    Originally posted by: Stidsen


    Hi Daniel

    Yes I am saying that the parameters are ignored ... at least I cannot make them work ... I have tried to set them in a number of different ways but the program
    seems to ignore them and my memory usage (on the bigger examples) simply grows and grows until the OS (Linux) shuts the process down.

    My current best guess is that these parameters stop having an effect when you start to use callbacks .... (I may be wrong).

    Comments ?

    Best Regards Thomas
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Getting memory consumption in callbacks: HOW ????

    Posted 11/24/10 07:10 AM

    Originally posted by: SystemAdmin


    No, parameters should work even if callbacks are present.
    I just wrote a short test program to confirm that.
    What values did you try for the parameters?
    I take it you set the parameters before you invoke CPXmipopt() and not from the callbacks (which would be wrong).
    Are you attaching user data to nodes via the branch-callback (CPLEX has no means to keep track of the size of that data).
    #CPLEXOptimizers
    #DecisionOptimization