Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  run-time exception with IloGoal

    Posted 07/23/12 04:45 PM

    Originally posted by: mslusky


    Hello,

    I am trying to implement search goals in my model, but I keep getting a run-time exception. The error message is “non-fixed constrained variable” and it is thrown by the class IloCP::SolverErrorExceptionExprI.

    Our model is built in its own class called SchedulingModel. We call two functions SchedulingModel::build() and SchedulingModel::solve()
    The IloModel class is built inside the build() function.
    The code I am using for the goals is copied directly from the CP Optimizer documentation. I define the goals outside the class in a new header file:
    
    ILCGOAL0(Greetings)
    { IloCP cp = getCP(); cp.out() << 
    "Greetings" << std::endl; 
    
    return 0; 
    } ILOCPGOALWRAPPER0(GreetingsConcert,cp) 
    { 
    
    return Greetings(cp); 
    }
    


    And then in SchedulingModel::solve() we do
    
    _cp.extract(_model) 
    // _model is of type IloModel IloGoal g = GreetingsConcert(env); _cp.solve(g);
    


    In trying to debug, here are some things I tried:
    • We moved the three lines listed above under two lines outside (Is this what you meant?) the solve() function to be directly in the main() procedure. When main is called, the program crashes with the above error.
    • We then replaced the entire build() procedure with code that generates a different and simpler model (copied from a different forum posting) and called the modified main() procedure from above. It does not crash.
    • We called _cp.solve() on our original model without any goals passed as arguments. It does not crash.

    So it seems that some part of our model is not compatible with search goals. I can’t post the whole model because it is proprietary, but do you have any ideas of what sort of things could cause this error or what other steps I can take to try to isolate the problem?

    Thank you,
    Marla
    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: run-time exception with IloGoal

    Posted 07/24/12 06:02 AM

    Originally posted by: SystemAdmin


    Hello,
    It seems that some part of the code is trying to access the value of a decision variable or of an expression (getValue()) whereas the variable or expression is still not fixed in the engine. Except for the message "non-fixed constrained variable", I think the exception when printed should also display the variable/expression in question. Does it also print that?
    By the way, does it crash before, after or inside the call to "_cp.solve(g)" ? Does it crash before or after executing your goal (display of "Greetings") ? It is clear that if you access the value of some variables/expressions after executing your goal you will get this type of exception because the goal has fixed nothing.

    Philippe
    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: run-time exception with IloGoal

    Posted 07/24/12 03:04 PM

    Originally posted by: mslusky


    Hi Philippe,

    All the calls to getValue and getIntValue occur after the solve function, but I commented them out anyway, and I get the same behavior.

    The message from the exception just says "non-fixed constrainted variable". There is nothing besides that.

    The crash occurs inside the call to _cp.solve().

    When we run the goal on our model, it displays "Greetings" once and then crashes. When we run the goal on a dummy model, it prints twice. Here is the full model file from our model:
    
    ! ---------------------------------------------------------------------------- ! Minimization problem - 1375 variables, 8060 constraints ! Preprocessing : 2126 extractables eliminated, 5 constraints generated ! DefaultInferenceLevel = Low ! LogVerbosity         = Verbose ! LogPeriod            = 1 ! SearchType           = DepthFirst ! Workers              = 1 ! TimeLimit            = 180 ! Initial process time : 0.34s (0.06s extraction + 0.28s propagation) !  . Log search space  : 6178.4 (before), 6137.6 (after) !  . Memory usage      : 14.6 MB (before), 469.5 MB (after) ! Using sequential search. ! ---------------------------------------------------------------------------- !          Best Branches  Non-fixed            Branch decision Greetings ! Warning: not all model variables are fixed
    

    (then it crashes, which is why the file doesn't end with the usual bits and branches, fails, etc.)
    Here is the full model file from the dummy model:
    
    ! ---------------------------------------------------------------------------- ! Minimization problem - 360 variables, 360 constraints ! Initial process time : 0.01s (0.01s extraction + 0.00s propagation) !  . Log search space  : 720.0 (before), 0.0 (after) !  . Memory usage      : 1.4 MB (before), 1.4 MB (after) !  . Variables fixed   : 360 ! Using sequential search. ! ---------------------------------------------------------------------------- !          Best Branches  Non-fixed            Branch decision Greetings *             0        0 0.01s                      - Greetings ! ---------------------------------------------------------------------------- ! Search terminated normally, 1 solution found. ! Best objective         : 0 (optimal - effective tol. is 1.000000e-009) ! Number of branches     : 0 ! Number of fails        : 0 ! Total memory usage     : 1.7 MB (1.5 MB CP Optimizer + 0.3 MB Concert) ! Time spent in solve    : 0.01s (0.00s engine + 0.01s extraction) ! Search speed (br. / s) : 0 ! ----------------------------------------------------------------------------
    


    What else can I try?

    Thanks,
    Marla
    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: run-time exception with IloGoal

    Posted 07/25/12 08:41 AM

    Originally posted by: SystemAdmin


    Hello,
    I think the problem is due to the search log of CP Optimizer that tries to get the value of the objective (I see that your model is a minimization problem) and complains that the objective is not fixed in the engine.
    A simple work-around is to switch off the search log and, if necessary, display the adequate information yourself:

    
    _cp.extract(_model) 
    // _model is of type IloModel cp.setParameter(IloCP::LogVerbosity, IloCP::Quiet); 
    // Switch off search log IloGoal g = GreetingsConcert(env); _cp.solve(g); std::cout << 
    "Number of variables   : " << cp.getInfo(IloCP::NumberOfVariables)   << std::endl; std::cout << 
    "Number of constraints : " << cp.getInfo(IloCP::NumberOfConstraints) << std::endl; std::cout << 
    "Memory usage          : " << cp.getInfo(IloCP::MemoryUsage)         << std::endl; std::cout << 
    "Total time            : " << cp.getInfo(IloCP::TotalTime)    << 
    "s" << std::endl;
    


    Philippe
    #CPOptimizer
    #DecisionOptimization


  • 5.  Re: run-time exception with IloGoal

    Posted 07/25/12 09:16 AM

    Originally posted by: Vgoel77


    Thanks for the reply. I assume you mean that CP optimiser will always throw an error if log verbosity is set to anything other than quiet when search goals are being used. Is that correct or are we doing something different/unusual which is causing CP optimiser to throw this error?

    We would like to see the progress information that is displayed in the search log to understand if our strategy for defining goals and search phrases is working. Is there an alternate solution so that we can keep displaying the search log?
    Thanks
    Vikas
    #CPOptimizer
    #DecisionOptimization