Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Combining two tuples

    Posted Fri November 16, 2012 03:14 AM

    Originally posted by: arguen


    Hello,
    I want to combine two tuples that has one element in common.

    Current tuples are as follows:
    
    tuple V_tuple 
    { string v; 
    // Vessel v string w;
    // Cargo tank w on vessel v 
    } tuple IJV_tuple 
    { string i;  
    // Port i string j; 
    // Port j string v;
    // Vessel v 
    }   
    {V_tuple
    } VW =...; 
    {IJV_tuple
    } IJV =...; 
    // Available arcs (i in N to j in N) and travel times for each vessel v
    


    Not all vessels can visit all ports - and this is given in IJV tuple. A vessel that can visit i can visit j also.

    And I want to combine this two in the following tuple type:

    
    tuple IVW_tuple 
    { string i;  
    // Port i string v; 
    // Vessel v string w;
    // W^mx_v: number of cargo tanks 
    }
    


    This way I will get rid of some infeasible pairs (port & vessel-tank)

    I tried following codes one at a time:
    
    
    {IVW_tuple
    } IVW = 
    {<a.i,b.v,b.w>| a in IJVT, b in VW
    }; 
    {IVW_tuple
    } IVW = 
    {<a.i,a.v,b.w>| a in IJVT, b in VW
    };
    


    But none of them worked.

    My question is: How can I introduce to OPL that v is common element and make the association on it.

    Thank you..
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: Combining two tuples

    Posted Fri November 16, 2012 03:52 PM

    Originally posted by: arguen


    To be more precise:
    my tuplesets as follows:
    
    IJV = 
    { <PA, PA, VA> <PA, DB, VA> <PA, PA, VB> <PA, DA, VB> <DA, PA, VB> <DA, DA, VB> <DB, PA, VA> <DB, DB, VA> 
    } VW = 
    { 
    // <vessel v, tank w> <VA, VA1> <VB, VB1> <VB, VB2> 
    };
    

    Note that VA doesn't serve DA and VB doesn't serve DB.

    Thus, I want the new combined tuple gives the following result:
    
    <i v w> PA      VA      VA1 PA  VB      VB1 PA  VB      VB2 DA  VB      VB1 DA  VB      VB2 DB  VA      VA1
    


    However the current results are as follows:
    
    
    {IVW_tuple
    } IVW = 
    {<a.i,b.v,b.w>| a in IJVT, b in VW
    }; <i v w> PA        VA      VA1 PA  VB      VB1 PA  VB      VB2 DA  VA      VA1 DA  VB      VB1 DA  VB      VB2 DB  VA      VA1 DB  VB      VB1 DB  VB      VB2
    

    Above result is wrong because i.e. VA serves DA .
    
    <i v w> PA    VA      VA1 PA  VA      VB1 PA  VA      VB2 PA  VB      VA1 PA  VB      VB1 PA  VB      VB2 DA  VB      VA1 DA  VB      VB1 DA  VB      VB2 DB  VA      VA1 DB  VA      VB1 DB  VA      VB2
    

    Above result is wrong because i.e. VA seems to have tanks VB1 and VB2 although those tanks belong to VB.

    Thanks for your time.
    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: Combining two tuples

    Posted Sat November 17, 2012 01:16 AM

    Originally posted by: arguen


    I found solution as follows:
    
    
    {IVW_tuple
    } IVW = 
    {<i,v,w>| <i,j,v> in IJV, <v,w> in VW
    };
    

    I was thinking that this would give error since j is not in use but it didn't.
    #DecisionOptimization
    #OPLusingCPOptimizer