Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Model solving memory problem in C++

    Posted 12/11/13 07:12 AM

    Originally posted by: Broncho


    I coded objective and constraints, no errors any more. Then I will solve the model. 

    The model solving codes are:

    IloCplex cplex(env);
    cplex.extract(model);
    cplex.solve();

    Before these codes, I have 

    IloEnv env;

    IloModel model(env);

    No compile errors, but when I run it, an error points at a file malloc.c 

    void * __cdecl _malloc_base (size_t size)
    {
        void *res = NULL;
     
        //  validate size
        if (size <= _HEAP_MAXREQ) {
            for (;;) {
     
                //  allocate memory block
                res = _heap_alloc(size);   ////<<<---this is the error line!! The value of " size" us 4008 in the Autos box.  
     
                //  if successful allocation, return pointer to memory
                //  if new handling turned off altogether, return NULL

    Thus, it seems to be a memory problem. And the problem occurs on line IloCplex cplex(env);. 

    If it is because of memory, how to solve it? Thanks.

     

    PS: I also have freed the memory for all expression type after I used them, so they cannot occupy any  memory.  

     

    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Model solving memory problem in C++

    Posted 12/13/13 10:07 AM

    It is hard to tell what exactly is going on. Could you provide a full stack trace?

    My guess is that one of the two following things happened:

    1. You end()ed too much. That means you called end() on something that is still used by the IloCplex instance. When the IloCplex attempts to access this then it will access stale pointers and bad things will happen. Did you by any change call env.end() before the line IloCplex cplex(env)?
    2. You forgot to initialize something that you passed to the IloCplex instance.

    #CPLEXOptimizers
    #DecisionOptimization