Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Error with cplex.getValue function, how to solve?

    Posted Fri April 06, 2012 10:09 PM

    Originally posted by: R9UA_Ishan_Mukherjee


    I am using Visual Studio 2008, C++

    I have this line of code in my program:

    IloNum r = cplex.getValue(varX[i][j]);

    Which is called after I solve a model. When that line is commented there are no problems (other than I can't read my results). When that line is not commented and I try to run the program, I end up getting this error message pop up: Unhandled exception at 0x7655b9bc in routemodel.exe: Microsoft C++ exception: IloCplex::Exception at memory location 0x0018f2b8..

    It opens up tidtable.c and takes to here:

    _CRTIMP PFLS_GETVALUE_FUNCTION __cdecl __set_flsgetvalue()
    {
    #ifdef _M_IX86
    PFLS_GETVALUE_FUNCTION flsGetValue = FLS_GETVALUE;
    if (!flsGetValue)
    {
    flsGetValue = _decode_pointer(gpFlsGetValue);
    TlsSetValue(__getvalueindex, flsGetValue);
    }
    return flsGetValue;
    #else /* _M_IX86 */
    return NULL;
    #endif /* _M_IX86 */
    }

    Specifically it points to the error being on this line: PFLS_GETVALUE_FUNCTION flsGetValue = FLS_GETVALUE;

    I don't have the technical understanding to have any idea what's going on. How do I fix this?
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Error with cplex.getValue function, how to solve?

    Posted Fri April 06, 2012 10:11 PM

    Originally posted by: R9UA_Ishan_Mukherjee


    Also, I have tried it with bool and int r as well (the variable is a bool).
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Error with cplex.getValue function, how to solve?

    Posted Fri April 06, 2012 10:52 PM

    Originally posted by: mlapp007


    Two things I would check:

    1. Does your model solve to optimality? That is, if a solution is not reached, you generally cannot obtain the variable values.
    2. Are the indices on i and j valid? (i.e. within the bounds of the array?)

    Cheers,

    Marcial
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Error with cplex.getValue function, how to solve?

    Posted Sat April 07, 2012 09:32 AM

    Originally posted by: SystemAdmin


    One more thing to check: is variable
    X[i][j]
    

    properly initialized? Is it possible that the variable de-allocated before you query the value? Does the error occur with any values for i and j that are within the range of the array or only with some particular values?
    #CPLEXOptimizers
    #DecisionOptimization