Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  throwing exception from ilog opl script

    Posted 02/10/20 08:03 AM

    Originally posted by: Marc Habib


    How can I throw an exception from an opl script?

     

    standard JS throw "message" is not allowed.


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: throwing exception from ilog opl script

    Posted 02/10/20 02:34 PM

    Unfortunately, exceptions are not supported in ILOGScript. In case you want to raise an exception to abort execution, you can do something like this:

    if ( errorCondition )
       non_existent_object.non_existent_method();
    

    This will stop with an unknown object or property error.


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: throwing exception from ilog opl script

    Posted 02/12/20 02:13 PM

    Hi,

    int x=2;

    assert as:x==1;

    asserts can give errors but in scripting you may use fail()

    int x=2;

    execute check
    {
      if (x!=1) fail();
    }

    gives execution og check failed

     

    regards


    #DecisionOptimization
    #OPLusingCPOptimizer