Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Penalty function in CP Optimizer depending on interval order in a sequence

  • 1.  Penalty function in CP Optimizer depending on interval order in a sequence

    Posted Fri January 31, 2020 12:56 PM

    Originally posted by: Avadrus


    Hello,

    I am using CP optimizer to solve a scheduling problem for which I have created an array of interval variables that is contained in a sequence. Various restrictions are being imposed on these variables through the sequence variable and so far, I have managed to implement all of the constraints that were necessary. The intervals I am using have been given a type in the sequence using the "types" statement.

     

    However, I am now struggling to implement the following: I would like to integrate a penalty term in the objective function that works as follows: If two successive intervals (which represent production jobs in a factory) in a sequence require a different material (the material that each job requires is stored in an array), then the objective function should be incremented by a fixed amount X to be determined (I am considering a minimization problem). This means that for each sequence variable, the intervals it contains and their order has to be extracted and a sum has to add the amount X to the objective if two successive intervals require a different material.

     

    Unfortunately, I am not quite sure whether a goal like this may be implemented in CP Optimizer using OPL, if yes, can anybody help me on which functions should be used to obtain the intervals and their order in each sequence and to sum up the penalty described above?

     

    Thank you very much in advance!

     

    Kind regards


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: Penalty function in CP Optimizer depending on interval order in a sequence

    Posted Fri January 31, 2020 03:25 PM

    Originally posted by: Petr Vilím


    Hello,

    I think that what you're looking for is function typeOfNext: for a given interval variable it returns type of the successor interval variable. Here is its documentation in OPL:

    https://www.ibm.com/support/knowledgecenter/SSSA5P_12.10.0/ilog.odms.ide.help/OPL_Studio/opllang_quickref/topics/tlr_oplsch_typeOfNext.html

    General description (language independent) of the concept is here:

    https://www.ibm.com/support/knowledgecenter/SSSA5P_12.10.0/ilog.odms.ide.help/refcppopl/html/interval_sequence.html#67

    You can use function typeOfNext in the objective. You can also use it to index an array.

    I hope it helps, Petr


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: Penalty function in CP Optimizer depending on interval order in a sequence

    Posted Mon February 03, 2020 10:08 AM

    Originally posted by: Avadrus


    Dear Petr,

    thank you very much for your reply and the suggested solution! I've had a look at the typeOfNext-function in the documentation and was indeed able to realized my desired penalty function using typeOfNext!

     

    Kind regards


    #DecisionOptimization
    #OPLusingCPOptimizer