Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

'IloAlgorithm::CannotChangeException"

  • 1.  'IloAlgorithm::CannotChangeException"

    Posted 04/17/12 03:02 PM

    Originally posted by: SystemAdmin


    I am loading a model using importModel, and then trying to update the upperbound of some constraints.
    Trying to update gives this exception: terminate called after throwing an instance of 'IloAlgorithm::CannotChangeException'

    Here is the relevant code:
    cplex.importModel(model, modelFilePath, obj, vars, rngs);
    cplex.setParam(IloCplex::RootAlg, IloCplex::AutoAlg);
    cplex.extract(model);

    rngsidx.setUB(ub);

    How to avoid this exception?
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/17/12 03:08 PM

    Originally posted by: SystemAdmin


    Reposted with better formatting

    I am loading a model using importModel, and then trying to update the upperbound of some constraints.
    Trying to update gives this exception: terminate called after throwing an instance of 'IloAlgorithm::CannotChangeException'

    Here is the relevant code:
    cplex.importModel(model, modelFilePath, obj, vars, rngs);
    cplex.setParam(IloCplex::RootAlg, IloCplex::AutoAlg);
    cplex.extract(model);
    


    rngs[idx].setUB(ub);
    


    How to avoid this exception?
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/17/12 10:22 PM

    Originally posted by: SystemAdmin


    I tried solving the model before setting my own bounds on the constraints. I am getting this error.
    cplex.solve() returns
    Signal: floating point exception.
    Suggestion: check for integer or floating point division by zero.

    All I am doing is this:
    model = *new IloModel(env);
     cplex = *new IloCplex(model);
     obj = *new IloObjective(env);
     vars = *new IloNumVarArray(env);
     rngs = *new IloRangeArray(env);
     cplex.importModel(model, modelFilePath, obj, vars, rngs);
     cplex.extract(model);
     cplex.solve();
    


    When I try to read and solve the same model using the cplex interpreter
    read model.mps mps
    primopt
    

    The model is optimized without any problem.

    Please suggest the possible cause of error.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/18/12 12:59 AM

    Originally posted by: SystemAdmin


    This code looks odd:
    model = *new IloModel(env);
    

    I am not sure if that is the reason for your trouble but could you try if the problem persists if you just write
    model = IloModel(env);
    

    and the same for the cplex, obj, vars, and rngs?
    If that does not help, could you attach your model file here?
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/18/12 01:02 AM

    Originally posted by: SystemAdmin


    Your code looks good, provided that idx is a valid index into rngs. Could you double check that
    • idx is less than rngs.getSize()
    • rngsidx.getImpl() is not NULL.
    Could you run the code through a debugger and provide a stack trace for the exception here?
    Could you provide the offending model here and tell us what idx and ub are when the exception occurs?
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/18/12 10:08 AM

    Originally posted by: SystemAdmin


    rngs.getSize and rngsidx are both non-zero/non-null.
    idx = 0 and lower bound that I am trying to set is 1156.78

    The model file (mps) is attached.

    Thanks,
    Akhil
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/18/12 10:23 AM

    Originally posted by: SystemAdmin


    here is the backtrace for the CannotChangeException

    
    terminate called after throwing an instance of 
    'IloAlgorithm::CannotChangeException'   Program received signal SIGABRT, Aborted. 0x00007ffff5793a75 in *__GI_raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64       ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. in ../nptl/sysdeps/unix/sysv/linux/raise.c (gdb) bt #0  0x00007ffff5793a75 in *__GI_raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1  0x00007ffff57975c0 in *__GI_abort () at abort.c:92 #2  0x00007ffff60498c5 in __gnu_cxx::__verbose_terminate_handler() () from /dcsdata/home/alanger/workspace/lib/libstdc++.so.6 #3  0x00007ffff6047cf6 in ?? () from /dcsdata/home/alanger/workspace/lib/libstdc++.so.6 #4  0x00007ffff6047d23 in std::terminate() () from /dcsdata/home/alanger/workspace/lib/libstdc++.so.6 #5  0x00007ffff6047e1e in __cxa_throw () from /dcsdata/home/alanger/workspace/lib/libstdc++.so.6 #6  0x0000000000f26002 in IloEnvI::change(IloExtractableI const*, IloChange const&) () #7  0x0000000000f9ab46 in IloExtractableI::notify(IloChange const&) () #8  0x000000000068f862 in IloRangeI::setLb (this=0x1d94be8, val=1158.78) at /dcsdata/home/alanger/workspace/cplex_studio_124/concert/include/ilconcert/ilolinear.h:441 #9  0x000000000068f62d in IloRange::setLb (this=0x1d93170, lb=1158.78) at /dcsdata/home/alanger/workspace/cplex_studio_124/concert/include/ilconcert/ilolinear.h:234 #10 0x000000000068f652 in IloRange::setLB (this=0x1d93170, lb=1158.78) at /dcsdata/home/alanger/workspace/cplex_studio_124/concert/include/ilconcert/ilolinear.h:237 #11 0x00000000006900da in jet::CPLEX_Solver::set_row_bnds (this=0x1b23880, idx=0, side=0, lb=@0x1ad4a00, ub=@0x1ad4a00) at ../src/CPLEX_Solver.h:128 #12 0x000000000068c992 in jet::Stg2Solver::solve (this=0x1b1cca0, msg=0x1d648e0) at ../src/Stg2Solver.C:104 #13 0x000000000068e41b in jet::CkIndex_Stg2Solver::_call_solve_AllocMsg (impl_msg=0x1d648e0, impl_obj=0x1b1cca0) at ./stage2Solver.def.h:97 #14 0x00000000006ec634 in CkDeliverMessageFree (epIdx=134, msg=0x1d648e0, obj=0x1b1cca0) at ck.C:575 #15 0x00000000007097f9 in CkLocRec_local::invokeEntry (this=0x1b1d000, obj=0x1b1cca0, msg=0x1d648e0, epIdx=134, doFree=
    
    true) at cklocation.C:1409 #16 0x0000000000709aa7 in CkLocRec_local::deliver (this=0x1b1d000, msg=0x1d648e0, type=CkDeliver_inline, opts=0) at cklocation.C:1472 #17 0x000000000070b616 in CkLocMgr::deliver (this=0x1b175c0, m=0x1d648e0, type=CkDeliver_inline, opts=0) at cklocation.C:2286 #18 0x00000000006f2648 in CkLocMgr::deliverInline (this=0x1b175c0, m=0x1d648e0) at cklocation.h:549 #19 0x00000000006ee327 in _processArrayEltMsg (ck=0x1aae940, env=0x1d64888) at ck.C:1137 #20 0x00000000006ee4ff in _processHandler (converseMsg=0x1d64888, ck=0x1aae940) at ck.C:1220 #21 0x000000000079604a in CmiHandleMessage (msg=0x1d64888) at convcore.c:1595 #22 0x0000000000796290 in CsdScheduleForever () at convcore.c:1797 #23 0x00000000007961f2 in CsdScheduler (maxmsgs=-1) at convcore.c:1740 #24 0x00000000007942e4 in ConverseRunPE (everReturn=0) at machine.c:2652 #25 0x00000000007947aa in ConverseInit (argc=3, argv=0x7fffffffe368, fn=0x6e18e3 <_initCharm(int, char**)>, usc=0, everReturn=0) at machine.c:2868 #26 0x00000000006f7b0c in main (argc=3, argv=0x7fffffffe368) at main.C:25
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/18/12 10:26 AM

    Originally posted by: SystemAdmin


    Thank you. I reproduced the problem here. Right now I am investigating what the issue is.
    I will let you know as soon as I find it.
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/18/12 11:10 AM

    Originally posted by: SystemAdmin


    OK, what you observe is actually expected behavior. The problem is that rngs[0] is
    c1: x28  + x688  + x2546  + x2558  + x2570  + x2576  + x2582  + x2606  + x2612  + x2615  + x2621  + x2624  + x2630  + x2636  + x2660  == 444.3
    

    If you set the lower bound for this range to 1156.78 then this range becomes infeasible. Unfortunately, infeasible range constraints are not supported by the CPLEX callable library and therefore an exception is raised.
    To avoid this exception you need to change the bounds in a way that does not render the constraint infeasible.
    Note that this only applies to ranged constraints. It does not apply to constraints for which either the lower or the upper bound is infinite.
    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/18/12 11:28 AM

    Originally posted by: SystemAdmin


    Thanks Daniel for pointing that out, I actually wanted to change the rhs of the constraint while keeping the constraint sense to be equality.
    I was doing that by issuing setLB followed by setUB on the rngsidx.
    I just saw in the reference manual that there is a setBounds(lb, ub) method to do so.
    After using this, I am not getting that exception anymore.

    But I am still getting the Floating point exception when I try to solve this model from the C++ program.
    The program gets optimized without any problem from the cplex interpreter. Can you please look into this issue.
    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/18/12 01:04 PM

    Originally posted by: SystemAdmin


    What is the exact version of CPLEX you use? On which operating system?
    Could you do
    cplex.exportModel("model.sav");
    

    right before calling cplex.solve() and attach the created model.sav file here?
    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/18/12 01:22 PM

    Originally posted by: SystemAdmin


    I am using CPLEX optimizer 12.4.0.0 and I running it on Ubuntu 10.04.4 LTS
    Please see attached the sav file (written just before the first call to cplex.solve())

    Arent you getting the floating point exception when solving using the C++ interface
    #CPLEXOptimizers
    #DecisionOptimization


  • 13.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/18/12 01:22 PM

    Originally posted by: SystemAdmin


    I am using CPLEX optimizer 12.4.0.0 and I running it on Ubuntu 10.04.4 LTS
    Please see attached the sav file (written just before the first call to cplex.solve())

    Arent you getting the floating point exception when solving using the C++ interface?
    #CPLEXOptimizers
    #DecisionOptimization


  • 14.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/19/12 01:55 AM

    Originally posted by: SystemAdmin


    I'm sorry, I cannot reproduce the floating point exception here.
    Do you get the same exception when you solve model.sav in the interactive? Could you provide the CPLEX output and/or a stack trace for the exception here?
    #CPLEXOptimizers
    #DecisionOptimization


  • 15.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/19/12 09:40 AM

    Originally posted by: SystemAdmin


    When I tried solving the model in a standalone C++ program - which just solves this model, it works fine.
    Originally, I am trying to solve the model as part of a bigger C++ parallel program, which is where I get this flaoting point excpetion.
    There seems to be something wrong with other settings in that program. But I am not able to figure out what is going wrong. Here is the stacktrace:
    
    IBM ILOG License Manager: 
    "IBM ILOG Optimization Suite for Academic Initiative" is accessing CPLEX 12 with option(s): 
    "e m b q ".   Selected objective sense:  MINIMIZE Selected objective  name:  obj Selected RHS        name:  rhs Selected bound      name:  bnd [New Thread 0x7fffe8458700 (LWP 19369)] [New Thread 0x7fffe7c57700 (LWP 19370)] [New Thread 0x7fffe7456700 (LWP 19371)] [New Thread 0x7fffe6c55700 (LWP 19372)] [New Thread 0x7fffe6454700 (LWP 19373)] [New Thread 0x7fffe5c53700 (LWP 19374)]   Program received signal SIGFPE, Arithmetic exception. 0x00007ffff57da8a3 in sYSTRIm (av=0x7ffff5adee40, p=<value optimized out>) at malloc.c:3469 3469 malloc.c: No such file or directory. in malloc.c (gdb) bt #0  0x00007ffff57da8a3 in sYSTRIm (av=0x7ffff5adee40, p=<value optimized out>) at malloc.c:3469 #1  _int_free (av=0x7ffff5adee40, p=<value optimized out>) at malloc.c:5023 #2  0x00007ffff57dcf34 in _int_memalign (av=0x7ffff5adee40, alignment=128, bytes=<value optimized out>) at malloc.c:5535 #3  0x00007ffff57dd8f2 in *__GI___libc_memalign (alignment=128, bytes=208) at malloc.c:3880 #4  0x00007ffff57ddb49 in __posix_memalign (memptr=0x7fffffffd690, alignment=140737315204672, size=0) at malloc.c:6298 #5  0x0000000000adc1d0 in _72214214d78c983d152821788976a8c6 () #6  0x0000000000adb7fe in _0ff8510b91f0240cafe918f6ab601dab () #7  0x0000000000acacfc in _6c1d46d73b0dde26d6b83f067d127490 () #8  0x0000000000e619c3 in _a63ebf32b5fa955337ab6918eae01350 () #9  0x0000000000a9dc53 in CPXlpopt () #10 0x000000000080628e in IloCplexI::solve() () #11 0x0000000000eefb13 in IloAlgorithm::callSolve() 
    
    const () #12 0x0000000000eefb94 in IloAlgorithm::solve() 
    
    const () #13 0x000000000068fb58 in IloCplex::solve (this=0x7fffffffdd50) at /dcsdata/home/alanger/workspace/cplex_studio_124/cplex/include/ilcplex/ilocplexi.h:2938 #14 0x0000000000690044 in CPLEX_Solver (this=0x1b23880, modelFilePath=0x1ad78f8 
    "fixed.mps") at ../src/CPLEX_Solver.h:38 #15 0x000000000068c34c in jet::Stg2Solver::getToWork (this=0x1b1cca0) at ../src/Stg2Solver.C:29 #16 0x000000000068e566 in jet::CkIndex_Stg2Solver::_call_getToWork_void (impl_msg=0x1b172e0, impl_obj=0x1b1cca0) at ./stage2Solver.def.h:114 #17 0x00000000006ec814 in CkDeliverMessageFree (epIdx=135, msg=0x1b172e0, obj=0x1b1cca0) at ck.C:575 #18 0x00000000007099d9 in CkLocRec_local::invokeEntry (this=0x1b1d000, obj=0x1b1cca0, msg=0x1b172e0, epIdx=135, doFree=
    
    true) at cklocation.C:1409 #19 0x0000000000709c87 in CkLocRec_local::deliver (this=0x1b1d000, msg=0x1b172e0, type=CkDeliver_inline, opts=0) at cklocation.C:1472 #20 0x000000000070b7f6 in CkLocMgr::deliver (this=0x1b175c0, m=0x1b172e0, type=CkDeliver_inline, opts=0) at cklocation.C:2286 #21 0x00000000006f2828 in CkLocMgr::deliverInline (this=0x1b175c0, m=0x1b172e0) at cklocation.h:549 #22 0x00000000006ee507 in _processArrayEltMsg (ck=0x1aae940, env=0x1b17288) at ck.C:1137 #23 0x00000000006ee6df in _processHandler (converseMsg=0x1b17288, ck=0x1aae940) at ck.C:1220 #24 0x000000000079622a in CmiHandleMessage (msg=0x1b17288) at convcore.c:1595 #25 0x0000000000796470 in CsdScheduleForever () at convcore.c:1797 #26 0x00000000007963d2 in CsdScheduler (maxmsgs=-1) at convcore.c:1740 #27 0x00000000007944c4 in ConverseRunPE (everReturn=0) at machine.c:2652 #28 0x000000000079498a in ConverseInit (argc=3, argv=0x7fffffffe368, fn=0x6e1ac3 <_initCharm(int, char**)>, usc=0, everReturn=0) at machine.c:2868 #29 0x00000000006f7cec in main (argc=3, argv=0x7fffffffe368) at main.C:25
    


    It looks like CPLEX is trying to spawn multiple threads, and something is going wrong there. Probably I would try to turn off CPLEX multithreading
    #CPLEXOptimizers
    #DecisionOptimization


  • 16.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/19/12 10:24 AM

    Originally posted by: SystemAdmin


    Turning off multithreading by setting the Threads parameter to 1, did resolve the problem.
    #CPLEXOptimizers
    #DecisionOptimization


  • 17.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/19/12 10:25 AM

    Originally posted by: SystemAdmin


    When you say your program is "parallel C++", does that mean you create multiple threads yourself and call CPLEX from multiple threads simultaneously? If that is the case, does each thread use its own IloEnv, IloModel and IloCplex?
    Could you run you program through 'valgrind' and see if that gives any hints?
    #CPLEXOptimizers
    #DecisionOptimization


  • 18.  Re: 'IloAlgorithm::CannotChangeException"

    Posted 04/19/12 10:40 AM

    Originally posted by: SystemAdmin


    Actually, I do not want to use CPLEX multithreading. Because I will be running different instances of CPLEX (solving different models) on mutiple processes that will occupy all the cores on my machine. So, as of now I do not intend to use CPLEX multithreading. So, for now the issue is resolved for me.

    As far as the floating point exception with the multi-threaded version is concerned, my program does not create multiple threads. It launches multiple processes, each having its own Cplex instance. It appears that when Cplex tries to launch multiple threads from these processes, some environment settings go haywire causing the exception. I can see a strage "malloc.c" not found error in the gdb backtrace (in the reply above).
    #CPLEXOptimizers
    #DecisionOptimization