Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Failed Initial Propagation - Internal Constraints

    Posted 09/26/12 02:30 PM

    Originally posted by: SystemAdmin


    I'm converting an existing custom iLog JConfigurator -based product configurator (Questions and Answers) to use CPOptimizer (CPlex 12.2). I'm using the java interface ONLY, duplicating the old IloClass / IloInstance / IloField / IloClassDomain object hierarchy. This construct does not exist in CPOptimizer so I've have to build compatibility tables to duplicate these parent / child relationships. My initial propagation is failing but it fails on a constraint called "P internal constraint". According to the documentation, I was under the impression that ALL internal constraints would be displayed (using logging and propagation logging set to verbose) with an M internal constraint.

    I've named every last one of my constraints but still the verbose logging gives me NO help whatsoever. Is there any way to see the detail behind these internal constraints? I am attaching an excerpt of my logging (I've removed some constraint propagation from the middle):

    !
    ! Satisfiability problem - 4,114 variables, 79,275 constraints
    ! FailLimit = 0
    ! LogVerbosity = Verbose
    ! PropagationLog = Verbose
    ! TimeLimit = 600,000

    % Begin initial propagation
    % P COP compatibility table
    % --- Q_Market_Answer is reduced to http://-1..1 3..14 16..43 45..65
    % P internal constraint
    % --- Question0000009Answer is reduced to http://-1..1 3..14 16..43 45..52
    % P internal constraint
    % --- Q_Market_A1081001 is fixed to -1
    % P internal constraint
    % --- Q_Market_A2581785 is fixed to -1
    % P internal constraint
    % --- Q_Market_A2681786 is fixed to -1
    % P Plan option definitive list compatibility table
    % --- Q_ProductType_Answer is reduced to http://-1..0 2 4
    % --- Q_State_Answer is reduced to http://-1..10 12..13
    % --- Q_Plan_Answer is reduced to http://-1 .. 9
    % --- Q_Option_Answer is reduced to http://-1 1..75
    % --- StatePlanOption is reduced to http://-1..4 6 8..10 12..16 18..21 23..34 36..45 47..50 52..65 67..68 71 73..75 78..81 83..89 91..96 98..112 114..116 118..127 129..130 132..146 148..150 152 154..166 168..176 178..180 182..183 185..186 188 190..197 199 202..209 211..214 216..222 224 227 229..234
    % P internal constraint
    % --- Q_ProductType_A3IDM is fixed to -1
    % P internal constraint
    % --- Q_ProductType_A5PPO is fixed to -1
    % P internal constraint
    % --- Question0000014Answer is reduced to http://-1..10 12..13
    % P internal constraint
    % --- Q_Plan_A10400 is fixed to -1
    % P internal constraint
    % --- Q_Option_A49155 is fixed to -1
    % P internal constraint
    % --- Q_Option_A40072 is fixed to -1
    % P internal constraint
    % --- Q_Option_A39071 is fixed to -1
    % P internal constraint
    % --- Q_Option_A26040 is fixed to -1
    % P internal constraint
    % --- Q_Option_A41100 is fixed to -1
    % P internal constraint
    % --- Q_Option_A28042 is fixed to -1
    % P internal constraint
    % --- Q_Option_A29043 is fixed to -1
    % P internal constraint
    % --- Q_Option_A60204 is fixed to -1
    % P internal constraint
    % --- Q_Option_A72216 is fixed to -1
    % P internal constraint
    % --- Q_Option_A73217 is fixed to -1
    % P internal constraint
    % --- Q_Option_A23026 is fixed to -1
    % P internal constraint
    % --- Q_Option_A50156 is fixed to -1
    % P internal constraint
    % --- Q_Option_A51157 is fixed to -1
    % P internal constraint
    % --- Q_Option_A67211 is fixed to -1
    % P internal constraint
    % --- Q_Option_A10010 is fixed to -1
    % P internal constraint
    % --- Q_Option_A16016 is fixed to -1
    % P internal constraint
    % --- Q_Option_A44150 is fixed to -1
    % P internal constraint
    % --- Q_State_A13UT is fixed to -1
    % P [Multivalued Parent RolledUpQuestion for IloClass Question0004842] Domain Reduction Ct
    % --- Question0004842 is fixed to -1
    % --- RolledUpQuestion is reduced to http://-1..1 3 6..8 12..13 18..456
    % P [Multivalued Parent RolledUpQuestion for IloClass Question0002073] Domain Reduction Ct
    % --- Question0002073 is fixed to -1
    % --- RolledUpQuestion is reduced to http://-1..1 3 6..8 12..13 18 20..456
    % P [Multivalued Parent RolledUpQuestion for IloClass Question0010160] Domain Reduction Ct
    % --- Question0010160 is fixed to -1
    % --- RolledUpQuestion is reduced to http://-1..1 3 6..8 12..13 18 20..21 23..456
    % P [Multivalued Parent RolledUpQuestion for IloClass Question0010067] Domain Reduction Ct
    % --- Question0010067 is fixed to -1
    % --- RolledUpQuestion is reduced to http://-1..1 3 6..8 12..13 18 20..21 24..456
    % P [Multivalued Parent RolledUpQuestion for IloClass Question0004475] Domain Reduction Ct
    % --- Question0004475 is fixed to -1
    % --- RolledUpQuestion is reduced to http://-1..1 3 6..8 12..13 18 20..21 24 27 31 33..35 39 42..44 52..54 57..59 61..62 64..69 74 76..77 79 84..85 89 91 93..95 97 99..101 103 105 107 116 119 125 127 133..134 138 165 173 185 188..189 191 194 196 198 200..202 205 207..208 211..224 227..232 234..235 240 243..245 251 253 255 260..262 264 266..267 269..271 275 279..282 284..285 287 289 291..298 301 305..306 309 322 326 328..329 342 349..350 354..363 365..369 372..375 378..382 400..401 403..410 415..418 435..436 438..439 442 444..445 447 450 452..453 456
    % P [Multivalued Parent RolledUpQuestion for IloClass Question0003585] Domain Reduction Ct
    % --- Question0003585 is fixed to -1
    % --- RolledUpQuestion is reduced to http://-1..1 3 6..8 12..13 18 20..21 24 27 31 33..35 39 42..44 52..54 57..59 61..62 64..69 74 76..77 79 84..85 89 91 93..95 97 99..101 103 105 107 116 119 125 127 133..134 138 165 173 185 188..189 191 194 196 198 200..202 205 207..208 211..224 227..232 234..235 240 243..245 251 253 255 260..262 264 266..267 269..271 275 279..282 284..285 287 289 291..298 301 305..306 309 322 326 328..329 342 349..350 354..363 365..369 372..375 378..382 400..401 403..410 415..418 435..436 438..439 442 444..445 447 450 452..453
    ! Problem found infeasible at the root node
    % P internal constraint
    Failure (1)
    !
    ! Solution status : Terminated normally, model has no solution
    ! Number of branches : 0
    ! Number of fails : 1
    ! Total memory usage : 301.5 Mb (184.5 Mb CP Optimizer + 117.1 Mb Concert)
    ! Time spent in solve : 0.58s (0.25s engine + 0.33s extraction)
    ! Search speed (br. / s) : 0
    !

    If I iterate the model looking only for IloConstraint instances, the only output I get is for constraints that I specifically built, which are all named...

    Any suggestions?
    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Failed Initial Propagation - Internal Constraints

    Posted 09/28/12 06:06 AM

    Originally posted by: ol


    Hello,
    As for displaying internal constraints: P was used instead of M in the previous versions of the libraries.
    If you want to send the model, we may help you to find the problem. If you do not want to send it to the forum, you can just post your email and I'll contact you directly.
    Regards,
    Olivier
    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: Failed Initial Propagation - Internal Constraints

    Posted 09/28/12 09:38 AM

    Originally posted by: SystemAdmin


    Thank you for your reply! I'm not sure I can submit the model, as it's built dynamically while reading a product rules database and mapping file of questions (spreadsheet). I'm not using OPL, with separate model and data files, but rather calling the IloCP Java interface directly to create simple integer decision variables. I'm simulating the IloClass / IloClassSetField structure of iLog JConfigurator using parent/child relationships and compatibility tables. To account for questions and/or answers that no longer exist, I've settled on using -1 to represent NOT_POSSIBLE.

    My biggest challenge was realizing that the JConfigurator member() method (member(IloClass, IloClassSetField)) was generating an existence constraint (LHS) based on an ever-changing IloClassSetField domain. During my program conversion to IloCP, however, I updated this with calls to IloCP.member(IloIntExpr, int[]), but this constraint simply says that the decision variable exists in a "static" integer array - it's not an existence constraint at all. I believe that this was contributing to my initial propagation failure mentioned above.

    My solution to this existence problem has been to create the constraint with IloCP.and(IloCP.member(IloIntExpr, int[]), IloCP.neq(IloIntExpr, -1)), which says that as long as the decision variable is NOT -1 (NOT_POSSIBLE) then I exist. If I had written this simply as IloCP.neq(IloIntExpr, -1) then IloCP would immediately reduce the domain of the decision variable, eliminating -1, which is not correct.

    The initial propagation now succeeds with 7,119 variables and 134,870 constraints... But it's failing after propagating 4 additional interactive constraints (these are successful). However, it's now failing when I attempt to propagate an effective date constraint (strange). Job security, I suppose!!
    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: Failed Initial Propagation - Internal Constraints

    Posted 10/01/12 10:25 AM

    Originally posted by: ol


    Hi,
    In order to translate a setClassField from JConfig, you need to express a constraint set variable and to use constraints over this set.
    For example, given an IloIntVar X, taking its possible values in {a,b,c,...,z}, you can do a mapping to integers:

    
    IloIntVar indexOfX = cp.intVar(0,26-1); IloInt[] Map = 
    
    new 
    
    int[] 
    {a,b,c,...,z
    }; cp.add(cp.eq(X,cp.element(Map, indexOfX)));
    


    and, then, use the integers to index an array of 0-1 variables that represent the set.

    
    IloIntVar[] mySet = cp.intVarArray(26, 0, 1);
    


    Constraints over the set like "X is in my set", or "cardinality(mySet) < 5" can be expressed easily:

    
    cp.add(cp.eq(cp.element(mySet, indexOfX), 1)); cp.add(cp.gt(cp.sum(mySet),5))
    


    Regards,
    Olivier
    #CPOptimizer
    #DecisionOptimization


  • 5.  Re: Failed Initial Propagation - Internal Constraints

    Posted 10/09/12 09:07 AM

    Originally posted by: SystemAdmin


    In the simplest case, I have 2 class (IloClass) instances with domains:

    Q_Option_Answers[NotPossible-1, Ans10018, Ans12019, Ans41100, Ans53150]
    Question0000007Answers[NotPossible-1, Ans10018, Ans12019]

    The two are related as they contain the same "answers" (Ans10018 and Ans12019) so I've been using compatibility tables with allowed tuples, as in:

    Q_Option_Answershttp://-1 .. 3, Question0000007Answershttp://-1 .. 1

    -1, -1
    0, 0
    1, 1
    2, -1
    3, -1

    This almost works because all values are accounted for, but when an answer to subquestion 7 (Question0000007Answer)http://-1 .. 1 appears "possible", then only the related parent
    answershttp://-1 .. 1 appear possible.

    What I need is be able to say:

    When Question7Answers memberOf Q_Option_Answers Implies Question0000007 memberOf RollupQuestions

    In other words, as long as any value in the subset domain exists in the superset domain, then the subquestion is possible, otherwise no. I'm just not sure how to
    accomplish this...
    #CPOptimizer
    #DecisionOptimization


  • 6.  Re: Failed Initial Propagation - Internal Constraints

    Posted 10/15/12 01:02 PM

    Originally posted by: ol


    Hi,

    I try to reformulate: you have a variable X and a variable S, and want that the variable S is a superset of X (from your previous mail, I assume that both X and S are variables, i.e, that possible values can be removed during search)
    If I understand well your problem, you are using the domain of an integer variable as a set, but this is not a possible approach in general (although it may be possible in quite specific cases).
    You need set variables, they are not directly available in CPO but you can use an array of boolean variables, as I explained in my previous post.

    To translate:

    "When Question7Answers memberOf Q_Option_Answers Implies Question0000007 memberOf RollupQuestions"

    you can for example add the following constraint:

    
    cp.add(cp.ge( cp.element(setOfRollupQuesitons, indexOfX), cp.element(setOfOptionsanswers, indexOfX)));
    


    where indexOfX is the index of the (integer) variable Question7Answers, and is defined as in my previous post.

    Regards,
    Olivier
    #CPOptimizer
    #DecisionOptimization


  • 7.  Re: Failed Initial Propagation - Internal Constraints

    Posted 10/15/12 01:02 PM

    Originally posted by: ol


    Hi,

    I try to reformulate: you have a variable X and a variable S, and want that the variable S is a superset of X (from your previous mail, I assume that both X and S are variables, i.e, that possible values can be removed during search)
    If I understand well your problem, you are using the domain of an integer variable as a set, but this is not a possible approach in general (although it may be possible in quite specific cases).
    You need set variables, they are not directly available in CPO but you can use an array of boolean variables, as I explained in my previous post.

    To translate:

    "When Question7Answers memberOf Q_Option_Answers Implies Question0000007 memberOf RollupQuestions"

    you can for example add the following constraint:

    
    cp.add(cp.ge( cp.element(setOfRollupQuesitons, indexOfX), cp.element(setOfOptionsanswers, indexOfX)));
    


    where indexOfX is the index of the (integer) variable Question7Answers, and is defined as in my previous post.

    Regards,
    Olivier
    #CPOptimizer
    #DecisionOptimization


  • 8.  Re: Failed Initial Propagation - Internal Constraints

    Posted 10/17/12 08:28 PM

    Originally posted by: SystemAdmin


    I've relaxed the "allowed" compatibility table constraint to use the indexed element approach, thereby still tying the 2 decision variables together. In other words, parent value is an index into int[]. Values in parent but not in child map to 0 (NOT_POSSIBLE) while all other indexed values map to the child equivalent:

    0, 0
    1, 0
    2, 2
    3, 3
    4, 0
    .
    .
    .

    I then also bumped the values up by 1 to allow for a value of zero (0) to mean NOT_POSSIBLE while all other positive integers represent actual answers. I think the negative one (-1) was causing strangeness. As soon as a child dvar becomes 0 (NOT_POSSIBLE) (and all other child dvar values become NOT_POSSIBLE) this implies that the parent becomes NOT_POSSIBLE (0).

    By doing so, the memberOf (LHS) constraint is simply cp.neq(dvar, 0).

    This appears to be working, as the model propagates successfully and I'm able to completely answer all possible questions (my application is a product configuration driven by questions and answers). Some combination of values invalidate other combinations, etc. So far, it is working fine using this approach.

    Thanks for your insight...
    #CPOptimizer
    #DecisionOptimization


  • 9.  Re: Failed Initial Propagation - Internal Constraints

    Posted 10/19/12 12:54 PM

    Originally posted by: ol


    Hello,
    if you are ok with this solution, it's fine. But, if two questions have the same parent question and get different value, this model forces the parent question to have two different values. This is not possible for an integer variable, and the solver will detect a failure. An array of boolean variables for representing the parent question solves this problem.
    Regards,
    Olivier
    #CPOptimizer
    #DecisionOptimization