Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How to declare 6*6*4 array in opl studio

    Posted 12/27/19 09:07 AM

    Originally posted by: Mathsg


    I am interested to write 6*6*4 array in opl cplex.

    I have declared like this

    Int cmf [route][nodes][nodes] = …;

     

    How to write the data file?

    Nodes = 1..6;

    Nodes = 1..6;

    While route = 4;

    I have declared like 

    cmf = [[[[  [0 1 2 1 2 3]
     [1 0 1 1 2 2]
      [2 1 0 2 1 1]
      [1 1 2 0 1 2]
      [2 2 1 1 0 1]
      [3 2 1 2 1 0]]
     
      [ [0 2 3 2 3 4]
      [2 0 3 3 3 3]
      [3 3 0 3 3 2]
      [2 2 3 0 2 3]
      [3 3 3 3 0 2]
      [4 3 2 3 2 0]]] 
      
      [ [0 4 4 4 4 5]
      [4 0 4 4 3 4]
      [4 4 0 3 3 4]
      [4 3 3 0 4 4]
      [4 3 3 4 0 4]
      [4 4 4 4 4 0]]]
     
      [  [0 5 4 5 4 5]
     [5 0 5 5 3 4]
      [4 5 0 3 4 5]
      [5 4 3 0 5 4]
      [4 3 4 4 0 5]
      [5 4 5 4 5 0]] ];

     

    but it give me an error of data array unexpected  for int. Kindly help me. your help will be highly appricated. thank you


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How to declare 6*6*4 array in opl studio

    Posted 01/07/20 11:39 AM

    Your array has too many dimensions. You need to define only three dimensions (i.e. only three opening square brackets in the beginning). Something like

    cmf = [ [ [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6] ],
            [ [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6] ],
            [ [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6] ],
            [ [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6], [ 1, 2, 3, 4, 5, 6] ] ];


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: How to declare 6*6*4 array in opl studio