Decision Optimization

Decision Optimization

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


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

why using dvar interval duplicates solutions ?

  • 1.  why using dvar interval duplicates solutions ?

    Posted 03/15/16 01:41 PM

    Originally posted by: Oblivion


    Hi,

    I have observed that using dvar interval instead of dvar int can lead to duplicated solutions and I don't understand why. Has anybody some explanation for this ?

    • Consider the Program 1 that tries to fix the beginning of a one unit length task within a window of 3 unit. This version uses a dvar int variable​
    using CP;
    
    execute {
       cp.param.searchType="DepthFirst";
       cp.param.logVerbosity="Quiet";
       cp.param.workers=1;
    }
    
    dvar int b in 0..2; // task beginning
    
    constraints {
            bt >= 0; // at least one constraint involving the variable
                     // otherwise it doesn't backtrack
    }
    
    include "allSolutions.mod"; // A main bloc for enumerating solutions
    
    // --- PostProcessing
    execute {
      writeln("b = ",b);
    }
    

    This program has 3 solutions : 

    ----------- Solution 1-------------
     b = 0
    ----------- Solution 2-------------
     b = 1
    ----------- Solution 3-------------
     b = 2
    
    No (more) solution
    # solutions : 3
    
    • Consider now the Program 2 that does the same but using a dvar interval variable : 
    using CP;
    
    execute {
       cp.param.searchType="DepthFirst";
       cp.param.logVerbosity="Quiet";
       cp.param.workers=1;
    }
    
    dvar interval t in 0..3 size 1;
    
    constraints {
            startOf(t) >= 0;     // at least one constraint for backtrack
    }
    
    include "allSolutions.mod";
    
    // --- Post processing
    
    execute {
      writeln("t = ",t);
    }
    

    Now we get 4 solutions

    ----------- Solution 1-------------
    t =  <1 0 1 1>
    ----------- Solution 2-------------
    t =  <1 0 1 1>
    ----------- Solution 3-------------
    t =  <1 1 2 1>
    ----------- Solution 4-------------
    t =  <1 2 3 1>
    
    No (more) solution
    Nb Solutions : 4
    

    Why is the first solution duplicated ?

    A third version with both variables and an additional constraint  startOf(t) == b  also gives 4 solutions.


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: why using dvar interval duplicates solutions ?

    Posted 03/17/16 05:30 AM

    Originally posted by: rdumeur


    Dear Oblivion,

    First in order to reduce the number of duplicate solutions when using interval var, you may try use setting cp parameters:

    SearchType = "DepthFirst"

    Workers = 1

    But even with those, CPO search with interval var may still produce duplicate solutions.

    Cheers,


    #DecisionOptimization
    #OPLusingCPOptimizer