Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Add own Constraint Propagator in docplex.cp

    Posted Thu July 13, 2023 11:19 AM

    Hey everyone, 

    I am trying to implement following model from Mattias Grönkvist PhD thesis "The Tail Assignment Problem":

    Basically, you want to assign vehicles (aircraft) to flights (set denoted as F). I got the domains, and Constraints 9.1-9.3 implemented with the functions provided by docplex.cp. What I am struggling with is the tunneling function:
    If I am not mistaken I'd need to write my own constraint propagator? What I found in the documentation (file:///Applications/CPLEX_Studio2211/doc/html/en-US/CP_Optimizer/Advanced_user_manual/topics/propagator_overview.html) is the following:
    file:///Applications/CPLEX_Studio2211/doc/html/en-US/CP_Optimizer/Advanced_user_manual/topics/propagator_overview.html
    First, is that the right thing I am looking for? Second, it only mentions C++ and Java, I guess there is no option for Python?
    All the best and cheers in advance, 
    Justus


    ------------------------------
    Justus Kilian Wolff
    ------------------------------


  • 2.  RE: Add own Constraint Propagator in docplex.cp

    Posted Thu July 13, 2023 12:24 PM

    Hello Justus,

    Indeed, implementing a custom constraint propagator is not possible in python.
    You'll need to find a formulation of the tunneling constraint that is based on the existing constraints.
    The documentation you are referring to proposes to use the allowed_assignments constraint (https://rawgit.com/IBMDecisionOptimization/docplex-doc/master/docs/cp/docplex.cp.modeler.py.html#docplex.cp.modeler.allowed_assignments). This is probably the most efficient way, but may not be so obvious to setup (this is just my first feeling, looking at your problem...).
    Another option that may be easier in a first step is to use the if_then constraint (https://rawgit.com/IBMDecisionOptimization/docplex-doc/master/docs/cp/docplex.cp.modeler.py.html#docplex.cp.modeler.if_then). It could be a good way to validate your model before implementing it more efficiently.

    Best regards,



    ------------------------------
    Hugues Juille
    ------------------------------



  • 3.  RE: Add own Constraint Propagator in docplex.cp

    Posted Thu July 13, 2023 12:33 PM

    Hi Hugues, 

    thank you very much for your quick reply. I've used the if_then for my formulation for now. Let's see how that performs when scaling up the problem. If I run into issues I'll probably consider swapping to C++.

    All the best,



    ------------------------------
    Justus Kilian Wolff
    ------------------------------