Decision Optimization

Decision Optimization

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


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

bug: name of IloCumulativeFunction is null when set through constructor

  • 1.  bug: name of IloCumulativeFunction is null when set through constructor

    Posted 04/03/17 06:29 PM

    Originally posted by: JorisK


    linux mint, CP optimizer 12.7, java 8 interface

    bug: the name of a cumulFunction isn't instantiated correctly when the name is provided at construction time of the cumul function:

    IloCumulFunctionExpr resources=cp.cumulFunctionExpr("resourceConsumption");
    System.out.println("Name of cumul function: "+resources.getName());
    //Expected result: Name of cumul function: resourceConsumption
    //Actual result: Name of cumul function: null
    
    //workaround: explicitly set the name of the cumul function through setName():
    resources.setName("test");
    System.out.println("Name of cumul function: "+resources.getName());
    //Result: Name of cumul function: test
    

     A small working example is attached.


    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: bug: name of IloCumulativeFunction is null when set through constructor

    Posted 04/06/17 04:48 AM

    Originally posted by: Paul Shaw


    When you write something like:
    
     resources=cp.sum(resources, cp.stepAtStart(sourceDepot, 10)); //Vehicle starts with full supply
    

    a new cumul function is created which is the sum of two children.  This new cumul function does not

    have a name until you name it with setName.  If you write the following

            //Resource consumption
            IloCumulFunctionExpr resources=cp.cumulFunctionExpr("resourceConsumption");
            IloCumulFunctionExpr total=cp.sum(resources, cp.stepAtStart(sourceDepot, 10)); //Vehicle starts with full supply
            total=cp.diff(total, cp.stepAtStart(job1, 4)); //Job1 needs 4 supply
            total=cp.diff(total, cp.stepAtStart(job2, 5)); //Job2 needs 5 supply
            total=cp.diff(total, cp.stepAtStart(job3, 8)); //Job3 needs 8 supply
            total=cp.sum(total, cp.stepAtStart(resupply, 0, 10)); //Resupply up to max vehicle capacity
            total.setName("total");
    

    then the variable total will have the name "total" while the variable "resources" will have the name "resourceConsumption".


    #CPOptimizer
    #DecisionOptimization