Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Why is changing all data?

    Posted 08/06/19 08:28 AM

    Originally posted by: trxw


    Please help! This is driving me crazy. I don´t understand when populating TodosLosTurnos3x8Encontrados through an auxiliar variable called Turno3x8Aux in line 

    114 Turno3x8Aux.CtasEn3x8.add((3*(i-1)+k));

    when k= 85 is the problem, it is supposed to add {1,2,3,4,5,6} only to the current TodosLosTurnos3x8Encontrados, however it changes all previous tuples (with values {1,2,3}) as soon as the line 114 is executed.!!

     

                        for (i=1;i<=NumSect3x8;i++){
                            Turno3x8Aux.TurnoDel3x8.InstanteIncialTurno=j.InstanteIncialTurno;    
                            Turno3x8Aux.TurnoDel3x8.DuracionTotalTurno=j.DuracionTotalTurno;
                            Turno3x8Aux.TurnoDel3x8.ActividadTotalTurno=j.ActividadTotalTurno;        
                            for (k=1;k<=3;k++){
                                //S_Ctas.add(3*(i-1)+k);                        
                                
                                Turno3x8Aux.CtasEn3x8.add((3*(i-1)+k));  
                            }                    
                        }
                        if (NumSect3x8>0){
                            TodosLosTurnos3x8Encontrados.add(Turno3x8Aux);

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Why is changing all data?

    Posted 09/03/19 04:08 AM

    Hi,

    you get that because you copy sets addresses and not set content.

    If you do

    //  TodosLosTurnos3x8Encontrados.add(Turno3x8Aux); // Not so good
                            for(var z in Turno3x8Aux.CtasEn3x8) myset[y].add(z);
                            TodosLosTurnos3x8Encontrados.add(Turno3x8Aux.TurnoDel3x8,myset[y]);

    then you ll get

    {<<61 84 63> {1 2 3}> <<65 84 63> {1 2 3}>
         <<69 84 63> {1 2 3}> <<73 84 63> {1 2 3}>
         <<77 84 63> {1 2 3}> <<81 84 63> {1 2 3}>
         <<85 84 63> {1 2 3 4 5 6}>
         <<89 84 63> {1 2 3 4 5 6}>
         <<93 84 63> {1 2 3 4 5 6}>
         <<97 84 63> {1 2 3 4 5 6}>
         <<101 84 63> {1 2 3 4 5 6}>
         <<105 84 63> {1 2 3 4 5 6}>
         <<109 84 63> {1 2 3 4 5 6}>}

    if you do

    writeln(TodosLosTurnos3x8Encontrados);

    in interactive scripting

     

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Why is changing all data?

    Posted 09/03/19 08:35 AM

    Originally posted by: trxw


    Thanks!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer