private static bool PutCalculationRowObjectToSimioValues(IStepExecutionContext context, IPropertyReaders rowReader, CalculationRow calcRow)
        {
            try
            {
                IStateProperty stateReader = (IStateProperty)rowReader.GetProperty("StateField1");
                IState         state       = stateReader.GetState(context);
                state.StateValue = calcRow.MyReal1;

                stateReader      = (IStateProperty)rowReader.GetProperty("StateField2");
                state            = stateReader.GetState(context);
                state.StateValue = calcRow.MyReal2;

                stateReader      = (IStateProperty)rowReader.GetProperty("StateField3");
                state            = stateReader.GetState(context);
                state.StateValue = calcRow.MyReal3;

                stateReader      = (IStateProperty)rowReader.GetProperty("StateField4");
                state            = stateReader.GetState(context);
                state.StateValue = calcRow.MyReal4;

                return(true);
            }
            catch (Exception ex)
            {
                Logit(context, $"Err={ex.Message}");
                return(false);
            }
        }
        private static bool PutSimioValuesToCalculationRowObject(IStepExecutionContext context, Random rand, IPropertyReaders rowReader, CalculationRow calcRow)
        {
            try
            {
                // Use the row reader to get a state reader
                IStateProperty stateReader = (IStateProperty)rowReader.GetProperty("StateField1");
                IState         state       = stateReader.GetState(context);
                state.StateValue = (10 * calcRow.MyKey) + 1; // Mock to create a value for the state
                calcRow.MyReal1  = state.StateValue;

                stateReader      = (IStateProperty)rowReader.GetProperty("StateField2");
                state            = stateReader.GetState(context);
                state.StateValue = (10 * calcRow.MyKey) + 2; // Mock to create a value for the State
                calcRow.MyReal2  = state.StateValue;

                stateReader      = (IStateProperty)rowReader.GetProperty("StateField3");
                state            = stateReader.GetState(context);
                state.StateValue = (10 * calcRow.MyKey) + 3; // Mock to create a value for the State
                calcRow.MyReal3  = state.StateValue;

                stateReader      = (IStateProperty)rowReader.GetProperty("StateField4");
                state            = stateReader.GetState(context);
                state.StateValue = (10 * calcRow.MyKey) + 4; // Mock to create a value for the State
                calcRow.MyReal4  = state.StateValue;

                return(true);
            }
            catch (Exception ex)
            {
                Logit(context, $"Err={ex.Message}");
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Method called when a process token executes the step.
        /// </summary>
        public ExitType Execute(IStepExecutionContext context)
        {
            // Prepare Message
            //=================
            AgentConnection agentConnection = (AgentConnection)_agentProperty.GetElement(context);
            var             socket          = agentConnection.GetSocket();
            var             states          = ReadRepeatingProperty(context, _statesProperty, "State");
            var             action          = _actionProperty.GetState(context).StateValue;
            var             reward          = _rewardProperty.GetState(context).StateValue;
            var             episode         = _episodeProperty.GetState(context).StateValue;
            var             status          = _statusProperty.GetState(context).StateValue;

            var requestMessage = new AgentRequestMessage()
            {
                Status        = status,
                EpisodeNumber = episode,
                Reward        = reward,
                States        = states
            };

            // Send Request Message to Agent
            //===============================
            var  message = JsonConvert.SerializeObject(requestMessage);
            bool result  = socket.TrySendFrame(TimeSpan.FromSeconds(3), message);

            if (!result)
            {
                context.ExecutionInformation.ReportError("Failed to communicate with agent");
            }

            // Wait For Response Message From Agent
            //======================================
            string responseMessage;

            result = socket.TryReceiveFrameString(TimeSpan.FromSeconds(3), out responseMessage);
            if (!result)
            {
                context.ExecutionInformation.ReportError("Failed to communicate with agent");
            }
            var jsonresponse = JsonConvert.DeserializeObject <AgentResponseMessage>(responseMessage);


            // Return Action Value
            //======================================
            context.ExecutionInformation.TraceInformation(responseMessage);
            (_actionProperty.GetState(context) as IRealState).Value = jsonresponse.Action;
            context.ReturnValue = jsonresponse.Action;

            return(ExitType.FirstExit);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Method called when a process token executes the step.
        /// </summary>
        public ExitType Execute(IStepExecutionContext context)
        {
            // Get Excel data
            ExcelConnectElementEPPlus Excelconnect = (ExcelConnectElementEPPlus)prExcelconnectElement.GetElement(context);

            if (Excelconnect == null)
            {
                context.ExecutionInformation.ReportError("ExcelConnectEPPlus element is null.  Makes sure ExcelWorkbook is defined correctly.");
            }
            String worksheetString   = prWorksheet.GetStringValue(context);
            Int32  rowInt            = (Int32)prRow.GetDoubleValue(context);
            Int32  startingColumnInt = Convert.ToInt32(prStartingColumn.GetDoubleValue(context));

            int numReadIn       = 0;
            int numReadFailures = 0;

            for (int ii = 0; ii < rprStates.GetCount(context); ii++)
            {
                // Tokenize the input
                string resultsString = Excelconnect.ReadResults(worksheetString, rowInt, startingColumnInt + ii, context);

                // The thing returned from GetRow is IDisposable, so we use the using() pattern here
                using (IPropertyReaders row = rprStates.GetRow(ii, context))
                {
                    // Get the state property out of the i-th tuple of the repeat group
                    IStateProperty stateprop = (IStateProperty)row.GetProperty("State");
                    // Resolve the property value to get the runtime state
                    IState state = stateprop.GetState(context);

                    if (TryAsNumericState(state, resultsString) ||
                        TryAsDateTimeState(state, resultsString) ||
                        TryAsStringState(state, resultsString))
                    {
                        numReadIn++;
                    }
                    else
                    {
                        numReadFailures++;
                    }
                }
            }

            string worksheetName = prWorksheet.GetStringValue(context);

            context.ExecutionInformation.TraceInformation($"Read from row={rowInt} worksheet={worksheetName} into {numReadIn} state columns. {numReadFailures} read failures");

            // We are done reading, have the token proceed out of the primary exit
            return(ExitType.FirstExit);
        }
Exemplo n.º 5
0
        private List <double> ReadRepeatingProperty(IStepExecutionContext context, IRepeatingPropertyReader rp, string propertyname)
        {
            var result = new List <double>();

            for (int i = 0; i < rp.GetCount(context); i++)
            {
                using (IPropertyReaders row = rp.GetRow(i, context))
                {
                    IStateProperty stateprop = (IStateProperty)row.GetProperty(propertyname);
                    IState         state     = stateprop.GetState(context);
                    result.Add(state.StateValue);
                }
            }
            return(result);
        }
        /// <summary>
        /// Method called when a process token executes the step.
        /// </summary>
        public ExitType Execute(IStepExecutionContext context)
        {
            IState _pala0  = _propPala0.GetState(context);
            double pala0   = Convert.ToDouble(_pala0.StateValue);
            IState _pala1  = _propPala1.GetState(context);
            double pala1   = Convert.ToDouble(_pala1.StateValue);
            IState _pala2  = _propPala2.GetState(context);
            double pala2   = Convert.ToDouble(_pala2.StateValue);
            IState _pala3  = _propPala3.GetState(context);
            double pala3   = Convert.ToDouble(_pala3.StateValue);
            IState _pala4  = _propPala4.GetState(context);
            double pala4   = Convert.ToDouble(_pala4.StateValue);
            IState _pala5  = _propPala5.GetState(context);
            double pala5   = Convert.ToDouble(_pala5.StateValue);
            IState _pala6  = _propPala6.GetState(context);
            double pala6   = Convert.ToDouble(_pala6.StateValue);
            IState _pala7  = _propPala7.GetState(context);
            double pala7   = Convert.ToDouble(_pala7.StateValue);
            IState _pala8  = _propPala8.GetState(context);
            double pala8   = Convert.ToDouble(_pala8.StateValue);
            IState _pala9  = _propPala9.GetState(context);
            double pala9   = Convert.ToDouble(_pala9.StateValue);
            IState _pala10 = _propPala10.GetState(context);
            double pala10  = Convert.ToDouble(_pala10.StateValue);
            IState _pala11 = _propPala11.GetState(context);
            double pala11  = Convert.ToDouble(_pala11.StateValue);
            IState _pala12 = _propPala12.GetState(context);
            double pala12  = Convert.ToDouble(_pala12.StateValue);
            IState _pala13 = _propPala13.GetState(context);
            double pala13  = Convert.ToDouble(_pala13.StateValue);
            IState _pala14 = _propPala14.GetState(context);
            double pala14  = Convert.ToDouble(_pala14.StateValue);
            IState _pala15 = _propPala15.GetState(context);
            double pala15  = Convert.ToDouble(_pala15.StateValue);
            IState _pala16 = _propPala16.GetState(context);
            double pala16  = Convert.ToDouble(_pala16.StateValue);
            IState _pala17 = _propPala17.GetState(context);
            double pala17  = Convert.ToDouble(_pala17.StateValue);
            IState _pala18 = _propPala18.GetState(context);
            double pala18  = Convert.ToDouble(_pala18.StateValue);
            IState _pala19 = _propPala19.GetState(context);
            double pala19  = Convert.ToDouble(_pala19.StateValue);
            IState _pala20 = _propPala20.GetState(context);
            double pala20  = Convert.ToDouble(_pala20.StateValue);



            SerializarElement sr = new SerializarElement();

            if (File.Exists(sr.SerializationFile))
            {
                Vect v = sr.deserializa();
                vectores = sr.deserializa();

                vectores.MipYc    = v.MipYc;
                vectores.MipYv    = v.MipYv;
                vectores.MipTc    = v.MipTc;
                vectores.MipTv    = v.MipTv;
                vectores.PlYc     = v.PlYc;
                vectores.PlYv     = v.PlYv;
                vectores.PlTc     = v.PlTc;
                vectores.PlTv     = v.PlTv;
                vectores.PlTcmalo = v.PlTcmalo;


                //Dinamico
                vectores.Din1   = v.Din1;
                vectores.DesCam = v.DesCam;
                vectores.Fila   = v.Fila;

                //LP
                vectores.TCV           = v.TCV;
                vectores.TCC           = v.TCC;
                vectores.TCj           = v.TCj;
                vectores.TDi           = v.TDi;
                vectores.Destij        = v.Destij;
                vectores.Dj            = v.Dj;
                vectores.Uj            = v.Uj;
                vectores.Ui            = v.Ui;
                vectores.RLi           = v.RLi;
                vectores.RUi           = v.RUi;
                vectores.Mine          = v.Mine;
                vectores.Mineralocado  = v.Mineralocado;
                vectores.Lastrealocado = v.Lastrealocado;
            }

            if (pala0 == 0)
            {
                for (int x = 0; x < 30; x = x + 1)
                {
                    vectores.Din1[x, 4]       = pala1;
                    vectores.Din1[x + 30, 4]  = pala2;
                    vectores.Din1[x + 60, 4]  = pala3;
                    vectores.Din1[x + 90, 4]  = pala4;
                    vectores.Din1[x + 120, 4] = pala5;
                    vectores.Din1[x + 150, 4] = pala6;
                    vectores.Din1[x + 180, 4] = pala7;
                    vectores.Din1[x + 210, 4] = pala8;
                    vectores.Din1[x + 240, 4] = pala9;
                    vectores.Din1[x + 270, 4] = pala10;
                    vectores.Din1[x + 300, 4] = pala11;
                    vectores.Din1[x + 330, 4] = pala12;
                    vectores.Din1[x + 360, 4] = pala13;
                    vectores.Din1[x + 390, 4] = pala14;
                    vectores.Din1[x + 420, 4] = pala15;
                    vectores.Din1[x + 450, 4] = pala16;
                    vectores.Din1[x + 480, 4] = pala17;
                    vectores.Din1[x + 510, 4] = pala18;
                    vectores.Din1[x + 540, 4] = pala19;
                    vectores.Din1[x + 570, 4] = pala20;
                }
            }


            //filas
            else if (pala0 == 1)
            {
                vectores.Fila[0]  = pala1;
                vectores.Fila[1]  = pala2;
                vectores.Fila[2]  = pala3;
                vectores.Fila[3]  = pala4;
                vectores.Fila[4]  = pala5;
                vectores.Fila[5]  = pala6;
                vectores.Fila[6]  = pala7;
                vectores.Fila[7]  = pala8;
                vectores.Fila[8]  = pala9;
                vectores.Fila[9]  = pala10;
                vectores.Fila[10] = pala11;
                vectores.Fila[11] = pala12;
                vectores.Fila[12] = pala13;
                vectores.Fila[13] = pala14;
                vectores.Fila[14] = pala15;
                vectores.Fila[15] = pala16;
                vectores.Fila[16] = pala17;
                vectores.Fila[17] = pala18;
                vectores.Fila[18] = pala19;
                vectores.Fila[19] = pala20;
            }



            //numero alocados

            else if (pala0 == 3)
            {
                for (int x = 0; x < 30; x = x + 1)
                {
                    vectores.Din1[x, 5]       = pala1;
                    vectores.Din1[x + 30, 5]  = pala2;
                    vectores.Din1[x + 60, 5]  = pala3;
                    vectores.Din1[x + 90, 5]  = pala4;
                    vectores.Din1[x + 120, 5] = pala5;
                    vectores.Din1[x + 150, 5] = pala6;
                    vectores.Din1[x + 180, 5] = pala7;
                    vectores.Din1[x + 210, 5] = pala8;
                    vectores.Din1[x + 240, 5] = pala9;
                    vectores.Din1[x + 270, 5] = pala10;
                    vectores.Din1[x + 300, 5] = pala11;
                    vectores.Din1[x + 330, 5] = pala12;
                    vectores.Din1[x + 360, 5] = pala13;
                    vectores.Din1[x + 390, 5] = pala14;
                    vectores.Din1[x + 420, 5] = pala15;
                    vectores.Din1[x + 450, 5] = pala16;
                    vectores.Din1[x + 480, 5] = pala17;
                    vectores.Din1[x + 510, 5] = pala18;
                    vectores.Din1[x + 540, 5] = pala19;
                    vectores.Din1[x + 570, 5] = pala20;
                }
            }

            else if (pala0 == 4) //Si es de mineral 0, si es de esteril 1
            {
                vectores.Mine[0]  = pala1;
                vectores.Mine[1]  = pala2;
                vectores.Mine[2]  = pala3;
                vectores.Mine[3]  = pala4;
                vectores.Mine[4]  = pala5;
                vectores.Mine[5]  = pala6;
                vectores.Mine[6]  = pala7;
                vectores.Mine[7]  = pala8;
                vectores.Mine[8]  = pala9;
                vectores.Mine[9]  = pala10;
                vectores.Mine[10] = pala11;
                vectores.Mine[11] = pala12;
                vectores.Mine[12] = pala13;
                vectores.Mine[13] = pala14;
                vectores.Mine[14] = pala15;
                vectores.Mine[15] = pala16;
                vectores.Mine[16] = pala17;
                vectores.Mine[17] = pala18;
                vectores.Mine[18] = pala19;
                vectores.Mine[19] = pala20;
            }

            else if (pala0 == 5) //numero de camiones que salieron de cada pala hacia el chancador
            {
                vectores.Mineralocado[0]  = pala1;
                vectores.Mineralocado[1]  = pala2;
                vectores.Mineralocado[2]  = pala3;
                vectores.Mineralocado[3]  = pala4;
                vectores.Mineralocado[4]  = pala5;
                vectores.Mineralocado[5]  = pala6;
                vectores.Mineralocado[6]  = pala7;
                vectores.Mineralocado[7]  = pala8;
                vectores.Mineralocado[8]  = pala9;
                vectores.Mineralocado[9]  = pala10;
                vectores.Mineralocado[10] = pala11;
                vectores.Mineralocado[11] = pala12;
                vectores.Mineralocado[12] = pala13;
                vectores.Mineralocado[13] = pala14;
                vectores.Mineralocado[14] = pala15;
                vectores.Mineralocado[15] = pala16;
                vectores.Mineralocado[16] = pala17;
                vectores.Mineralocado[17] = pala18;
                vectores.Mineralocado[18] = pala19;
                vectores.Mineralocado[19] = pala20;
            }

            else if (pala0 == 6) //numero de camiones que salieron de cada pala el esteril
            {
                vectores.Lastrealocado[0]  = pala1 * vectores.Mine[0];
                vectores.Lastrealocado[1]  = pala2 * vectores.Mine[1];
                vectores.Lastrealocado[2]  = pala3 * vectores.Mine[2];
                vectores.Lastrealocado[3]  = pala4 * vectores.Mine[3];
                vectores.Lastrealocado[4]  = pala5 * vectores.Mine[4];
                vectores.Lastrealocado[5]  = pala6 * vectores.Mine[5];
                vectores.Lastrealocado[6]  = pala7 * vectores.Mine[6];
                vectores.Lastrealocado[7]  = pala8 * vectores.Mine[7];
                vectores.Lastrealocado[8]  = pala9 * vectores.Mine[8];
                vectores.Lastrealocado[9]  = pala10 * vectores.Mine[9];
                vectores.Lastrealocado[10] = pala11 * vectores.Mine[10];
                vectores.Lastrealocado[11] = pala12 * vectores.Mine[11];
                vectores.Lastrealocado[12] = pala13 * vectores.Mine[12];
                vectores.Lastrealocado[13] = pala14 * vectores.Mine[13];
                vectores.Lastrealocado[14] = pala15 * vectores.Mine[14];
                vectores.Lastrealocado[15] = pala16 * vectores.Mine[15];
                vectores.Lastrealocado[16] = pala17 * vectores.Mine[16];
                vectores.Lastrealocado[17] = pala18 * vectores.Mine[17];
                vectores.Lastrealocado[18] = pala19 * vectores.Mine[18];
                vectores.Lastrealocado[19] = pala20 * vectores.Mine[19];
            }


            sr.serializa(vectores);
            sr.closeStream();
            return(ExitType.FirstExit);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Method called when a process token executes the step.
        /// </summary>
        public ExitType Execute(IStepExecutionContext context)
        {
            IState _timenow = _propTimenow.GetState(context);
            double timenow  = Convert.ToDouble(_timenow.StateValue);
            IState _salida  = _propSalida.GetState(context);
            double salida   = Convert.ToDouble(_salida.StateValue);
            IState _aux     = _propAux.GetState(context);
            double aux      = Convert.ToDouble(_aux.StateValue);

            SerializarElement sr = new SerializarElement();

            if (File.Exists(sr.SerializationFile))
            {
                Vect v = sr.deserializa();
                vectores = sr.deserializa();

                vectores.MipYc = v.MipYc;
                vectores.MipYv = v.MipYv;
                vectores.MipTc = v.MipTc;
                vectores.MipTv = v.MipTv;

                //Dinamico
                vectores.Din1   = v.Din1;
                vectores.DesCam = v.DesCam;
                vectores.Fila   = v.Fila;

                //LP
                vectores.TCV           = v.TCV;
                vectores.TCC           = v.TCC;
                vectores.TCj           = v.TCj;
                vectores.TDi           = v.TDi;
                vectores.Destij        = v.Destij;
                vectores.Dj            = v.Dj;
                vectores.Uj            = v.Uj;
                vectores.Ui            = v.Ui;
                vectores.RLi           = v.RLi;
                vectores.RUi           = v.RUi;
                vectores.PlYc          = v.PlYc;
                vectores.PlYv          = v.PlYv;
                vectores.PlTc          = v.PlTc;
                vectores.PlTv          = v.PlTv;
                vectores.PlTcmalo      = v.PlTcmalo;
                vectores.Mine          = v.Mine;
                vectores.Mineralocado  = v.Mineralocado;
                vectores.Lastrealocado = v.Lastrealocado;
            }


            /*
             *              vectores.PlTc[30, 0]; #flujo pala 1
             *              vectores.PlTc[30, 1]; #flujo pala 2
             *              etc etc
             *
             *              vectores.Din1[x, 4] = pala1; #Ultimo tiempo que pala 1 tuvo una asignacion
             *              vectores.Din1[x + 30, 4] = pala2; #Ultimo tiempo que pala 2 tuvo una asignacion
             *              vectores.Din1[x + 60, 4] = pala3; etc
             *              vectores.Din1[x + 90, 4] = pala4;
             *              vectores.Din1[x + 120, 4] = pala5;
             *              vectores.Din1[x + 150, 4] = pala6;
             *              vectores.Din1[x + 180, 4] = pala7;
             *              vectores.Din1[x + 210, 4] = pala8;
             *              vectores.Din1[x + 240, 4] = pala9;
             *              vectores.Din1[x + 270, 4] = pala10;
             *              vectores.Din1[x + 300, 4] = pala11;
             *              vectores.Din1[x + 330, 4] = pala12;
             *              vectores.Din1[x + 360, 4] = pala13;
             *              vectores.Din1[x + 390, 4] = pala14;
             *              vectores.Din1[x + 420, 4] = pala15;
             *              vectores.Din1[x + 450, 4] = pala16;
             *              vectores.Din1[x + 480, 4] = pala17;
             *              vectores.Din1[x + 510, 4] = pala18;
             *              vectores.Din1[x + 540, 4] = pala19;
             *              vectores.Din1[x + 570, 4] = pala20;
             *
             *              timenow; #tiempo actual
             *
             *
             *
             */
            double[] tij_op   = new double[20];
            double[] desv_tij = new double[20];
            double[] Puntaje  = new double[20] {
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
            };
            double Pmax     = -10000000000;
            double Destino  = 0;
            double botadero = 0;

            for (int i = 0; i < 20; i++)
            {
                if (vectores.Din1[30 * i, 4] > 0)
                {
                    tij_op[i]   = 1 / ((vectores.PlTc[30, i] + 1) / 300);
                    desv_tij[i] = (timenow - vectores.Din1[30 * i, 4]) - tij_op[i];
                    Puntaje[i]  = desv_tij[i] / tij_op[i];
                }
            }

            for (int j = 0; j < 20; j++)
            {
                if (vectores.Din1[30 * j, 4] > 0)
                {
                    {
                        if (Puntaje[j] > Pmax)
                        {
                            Pmax    = Puntaje[j];
                            Destino = j + 1;
                        }
                    }
                }
            }

            if (Destino == 4 || Destino == 5 || Destino == 6 || Destino == 10 || Destino == 17 || Destino == 18)
            {
                botadero = 1;
            }

            else if (Destino == 7 || Destino == 8 || Destino == 12)
            {
                botadero = 4;
            }

            else if (Destino == 1 || Destino == 2 || Destino == 3 || Destino == 11)
            {
                botadero = 8;
            }

            else
            {
                Destino  = Pmax;
                botadero = 3;
            }
            _salida.StateValue = Destino;
            _aux.StateValue    = botadero;

            sr.serializa(vectores);

            sr.closeStream();
            return(ExitType.FirstExit);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Method called when a process token executes the step.
        /// </summary>
        public ExitType Execute(IStepExecutionContext context)
        {
            IState _timenow = _propTimenow.GetState(context);
            double timenow  = Convert.ToDouble(_timenow.StateValue);
            IState _salida  = _propSalida.GetState(context);
            double salida   = Convert.ToDouble(_salida.StateValue);
            IState _aux     = _propAux.GetState(context);
            double aux      = Convert.ToDouble(_aux.StateValue);

            SerializarElement sr = new SerializarElement();

            if (File.Exists(sr.SerializationFile))
            {
                Vect v = sr.deserializa();
                vectores = sr.deserializa();

                vectores.MipYc    = v.MipYc;
                vectores.MipYv    = v.MipYv;
                vectores.MipTc    = v.MipTc;
                vectores.MipTv    = v.MipTv;
                vectores.PlYc     = v.PlYc;
                vectores.PlYv     = v.PlYv;
                vectores.PlTc     = v.PlTc;
                vectores.PlTv     = v.PlTv;
                vectores.PlTcmalo = v.PlTcmalo;

                //Dinamico
                vectores.Din1   = v.Din1;
                vectores.DesCam = v.DesCam;
                vectores.Fila   = v.Fila;

                //LP
                vectores.TCV           = v.TCV;
                vectores.TCC           = v.TCC;
                vectores.TCj           = v.TCj;
                vectores.TDi           = v.TDi;
                vectores.Destij        = v.Destij;
                vectores.Dj            = v.Dj;
                vectores.Uj            = v.Uj;
                vectores.Ui            = v.Ui;
                vectores.RLi           = v.RLi;
                vectores.RUi           = v.RUi;
                vectores.Mine          = v.Mine;
                vectores.Mineralocado  = v.Mineralocado;
                vectores.Lastrealocado = v.Lastrealocado;
            }

            /* programa aca*/



            int[,] Resultado = new int[20 + 1, 3];
            int[] VectorResultado = new int[20 + 1];
            Parallel.For(1, 3, m =>
            {
                VectorResultado = Simulacion(m, timenow);
                for (int i = 0; i < 20 + 1; i++)
                {
                    Resultado[i, m - 1] = VectorResultado[i];
                }
            }
                         )
            ;



            sr.serializa(vectores);
            sr.closeStream();
            return(ExitType.FirstExit);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Method called when a process token executes the step.
        /// </summary>
        public ExitType Execute(IStepExecutionContext context)
        {
            IState _pala0  = _propPala0.GetState(context);
            double pala0   = Convert.ToDouble(_pala0.StateValue);
            IState _pala1  = _propPala1.GetState(context);
            double pala1   = Convert.ToDouble(_pala1.StateValue);
            IState _pala2  = _propPala2.GetState(context);
            double pala2   = Convert.ToDouble(_pala2.StateValue);
            IState _pala3  = _propPala3.GetState(context);
            double pala3   = Convert.ToDouble(_pala3.StateValue);
            IState _pala4  = _propPala4.GetState(context);
            double pala4   = Convert.ToDouble(_pala4.StateValue);
            IState _pala5  = _propPala5.GetState(context);
            double pala5   = Convert.ToDouble(_pala5.StateValue);
            IState _pala6  = _propPala6.GetState(context);
            double pala6   = Convert.ToDouble(_pala6.StateValue);
            IState _pala7  = _propPala7.GetState(context);
            double pala7   = Convert.ToDouble(_pala7.StateValue);
            IState _pala8  = _propPala8.GetState(context);
            double pala8   = Convert.ToDouble(_pala8.StateValue);
            IState _pala9  = _propPala9.GetState(context);
            double pala9   = Convert.ToDouble(_pala9.StateValue);
            IState _pala10 = _propPala10.GetState(context);
            double pala10  = Convert.ToDouble(_pala10.StateValue);
            IState _pala11 = _propPala11.GetState(context);
            double pala11  = Convert.ToDouble(_pala11.StateValue);
            IState _pala12 = _propPala12.GetState(context);
            double pala12  = Convert.ToDouble(_pala12.StateValue);
            IState _pala13 = _propPala13.GetState(context);
            double pala13  = Convert.ToDouble(_pala13.StateValue);
            IState _pala14 = _propPala14.GetState(context);
            double pala14  = Convert.ToDouble(_pala14.StateValue);
            IState _pala15 = _propPala15.GetState(context);
            double pala15  = Convert.ToDouble(_pala15.StateValue);
            IState _pala16 = _propPala16.GetState(context);
            double pala16  = Convert.ToDouble(_pala16.StateValue);
            IState _pala17 = _propPala17.GetState(context);
            double pala17  = Convert.ToDouble(_pala17.StateValue);
            IState _pala18 = _propPala18.GetState(context);
            double pala18  = Convert.ToDouble(_pala18.StateValue);
            IState _pala19 = _propPala19.GetState(context);
            double pala19  = Convert.ToDouble(_pala19.StateValue);
            IState _pala20 = _propPala20.GetState(context);
            double pala20  = Convert.ToDouble(_pala20.StateValue);
            IState _pala21 = _propPala21.GetState(context);
            double pala21  = Convert.ToDouble(_pala21.StateValue);
            IState _pala22 = _propPala22.GetState(context);
            double pala22  = Convert.ToDouble(_pala22.StateValue);
            IState _pala23 = _propPala23.GetState(context);
            double pala23  = Convert.ToDouble(_pala23.StateValue);
            IState _pala24 = _propPala24.GetState(context);
            double pala24  = Convert.ToDouble(_pala24.StateValue);
            IState _pala25 = _propPala25.GetState(context);
            double pala25  = Convert.ToDouble(_pala25.StateValue);
            IState _pala26 = _propPala26.GetState(context);
            double pala26  = Convert.ToDouble(_pala26.StateValue);
            IState _pala27 = _propPala27.GetState(context);
            double pala27  = Convert.ToDouble(_pala27.StateValue);
            IState _pala28 = _propPala28.GetState(context);
            double pala28  = Convert.ToDouble(_pala28.StateValue);
            IState _pala29 = _propPala29.GetState(context);
            double pala29  = Convert.ToDouble(_pala29.StateValue);
            IState _pala30 = _propPala30.GetState(context);
            double pala30  = Convert.ToDouble(_pala30.StateValue);
            IState _pala31 = _propPala31.GetState(context);
            double pala31  = Convert.ToDouble(_pala31.StateValue);
            IState _pala32 = _propPala32.GetState(context);
            double pala32  = Convert.ToDouble(_pala32.StateValue);
            IState _pala33 = _propPala33.GetState(context);
            double pala33  = Convert.ToDouble(_pala33.StateValue);
            IState _pala34 = _propPala34.GetState(context);
            double pala34  = Convert.ToDouble(_pala34.StateValue);
            IState _pala35 = _propPala35.GetState(context);
            double pala35  = Convert.ToDouble(_pala35.StateValue);
            IState _pala36 = _propPala36.GetState(context);
            double pala36  = Convert.ToDouble(_pala36.StateValue);
            IState _pala37 = _propPala37.GetState(context);
            double pala37  = Convert.ToDouble(_pala37.StateValue);
            IState _pala38 = _propPala38.GetState(context);
            double pala38  = Convert.ToDouble(_pala38.StateValue);
            IState _pala39 = _propPala39.GetState(context);
            double pala39  = Convert.ToDouble(_pala39.StateValue);
            IState _pala40 = _propPala40.GetState(context);
            double pala40  = Convert.ToDouble(_pala40.StateValue);
            IState _pala41 = _propPala41.GetState(context);
            double pala41  = Convert.ToDouble(_pala41.StateValue);
            IState _pala42 = _propPala42.GetState(context);
            double pala42  = Convert.ToDouble(_pala42.StateValue);
            IState _pala43 = _propPala43.GetState(context);
            double pala43  = Convert.ToDouble(_pala43.StateValue);
            IState _pala44 = _propPala44.GetState(context);
            double pala44  = Convert.ToDouble(_pala44.StateValue);
            IState _pala45 = _propPala45.GetState(context);
            double pala45  = Convert.ToDouble(_pala45.StateValue);
            IState _pala46 = _propPala46.GetState(context);
            double pala46  = Convert.ToDouble(_pala46.StateValue);
            IState _pala47 = _propPala47.GetState(context);
            double pala47  = Convert.ToDouble(_pala47.StateValue);
            IState _pala48 = _propPala48.GetState(context);
            double pala48  = Convert.ToDouble(_pala48.StateValue);
            IState _pala49 = _propPala49.GetState(context);
            double pala49  = Convert.ToDouble(_pala49.StateValue);
            IState _pala50 = _propPala50.GetState(context);
            double pala50  = Convert.ToDouble(_pala50.StateValue);
            IState _pala51 = _propPala51.GetState(context);
            double pala51  = Convert.ToDouble(_pala51.StateValue);
            IState _pala52 = _propPala52.GetState(context);
            double pala52  = Convert.ToDouble(_pala52.StateValue);
            IState _pala53 = _propPala53.GetState(context);
            double pala53  = Convert.ToDouble(_pala53.StateValue);
            IState _pala54 = _propPala54.GetState(context);
            double pala54  = Convert.ToDouble(_pala54.StateValue);
            IState _pala55 = _propPala55.GetState(context);
            double pala55  = Convert.ToDouble(_pala55.StateValue);
            IState _pala56 = _propPala56.GetState(context);
            double pala56  = Convert.ToDouble(_pala56.StateValue);
            IState _pala57 = _propPala57.GetState(context);
            double pala57  = Convert.ToDouble(_pala57.StateValue);
            IState _pala58 = _propPala58.GetState(context);
            double pala58  = Convert.ToDouble(_pala58.StateValue);
            IState _pala59 = _propPala59.GetState(context);
            double pala59  = Convert.ToDouble(_pala59.StateValue);
            IState _pala60 = _propPala60.GetState(context);
            double pala60  = Convert.ToDouble(_pala60.StateValue);
            // Example of how to get the value of a step property.


            SerializarElement sr = new SerializarElement();

            if (File.Exists(sr.SerializationFile))
            {
                Vect v = sr.deserializa();
                vectores = sr.deserializa();

                vectores.MipYc    = v.MipYc;
                vectores.MipYv    = v.MipYv;
                vectores.MipTc    = v.MipTc;
                vectores.MipTv    = v.MipTv;
                vectores.PlYc     = v.PlYc;
                vectores.PlYv     = v.PlYv;
                vectores.PlTc     = v.PlTc;
                vectores.PlTv     = v.PlTv;
                vectores.PlTcmalo = v.PlTcmalo;


                //Dinamico
                vectores.Din1   = v.Din1;
                vectores.DesCam = v.DesCam;
                vectores.Fila   = v.Fila;

                //LP
                vectores.TCV           = v.TCV;
                vectores.TCC           = v.TCC;
                vectores.TCj           = v.TCj;
                vectores.TDi           = v.TDi;
                vectores.Destij        = v.Destij;
                vectores.Dj            = v.Dj;
                vectores.Uj            = v.Uj;
                vectores.Ui            = v.Ui;
                vectores.RLi           = v.RLi;
                vectores.RUi           = v.RUi;
                vectores.Mine          = v.Mine;
                vectores.Mineralocado  = v.Mineralocado;
                vectores.Lastrealocado = v.Lastrealocado;
            }

            /*
             * //tiempos
             *
             * vectores.Din1[0, 7] = pala0;
             * vectores.Din1[30, 7] = pala1;
             * vectores.Din1[60, 7] = pala2;
             * vectores.Din1[90, 7] = pala3;
             * vectores.Din1[120, 7] = pala4;
             * vectores.Din1[150, 7] = pala5;
             * vectores.Din1[180, 7] = pala6;
             * vectores.Din1[210, 7] = pala7;
             * vectores.Din1[480, 7] = pala8;
             * vectores.Din1[510, 7] = pala9;
             *
             * vectores.Din1[3, 7] = pala10;
             * vectores.Din1[33, 7] = pala11;
             * vectores.Din1[63, 7] = pala12;
             * vectores.Din1[93, 7] = pala13;
             * vectores.Din1[123, 7] = pala14;
             * vectores.Din1[153, 7] = pala15;
             * vectores.Din1[183, 7] = pala16;
             * vectores.Din1[213, 7] = pala17;
             * vectores.Din1[483, 7] = pala18;
             * vectores.Din1[513, 7] = pala19;
             *
             * vectores.Din1[7, 7] = pala20;
             * vectores.Din1[37, 7] = pala31;
             * vectores.Din1[67, 7] = pala32;
             * vectores.Din1[97, 7] = pala33;
             * vectores.Din1[127, 7] = pala34;
             * vectores.Din1[157, 7] = pala35;
             * vectores.Din1[187, 7] = pala36;
             * vectores.Din1[217, 7] = pala37;
             * vectores.Din1[487, 7] = pala38;
             * vectores.Din1[517, 7] = pala39;
             *
             * vectores.Din1[17, 7] = pala40;
             * vectores.Din1[47, 7] = pala41;
             * vectores.Din1[77, 7] = pala42;
             * vectores.Din1[107, 7] = pala43;
             * vectores.Din1[137, 7] = pala44;
             * vectores.Din1[167, 7] = pala45;
             * vectores.Din1[197, 7] = pala46;
             * vectores.Din1[227, 7] = pala47;
             * vectores.Din1[497, 7] = pala48;
             * vectores.Din1[527, 7] = pala49;
             */
            for (int x = 0; x < 30; x = x + 1)
            {
                vectores.Din1[x, 4]       = pala1;
                vectores.Din1[x + 30, 4]  = pala2;
                vectores.Din1[x + 60, 4]  = pala3;
                vectores.Din1[x + 90, 4]  = pala4;
                vectores.Din1[x + 120, 4] = pala5;
                vectores.Din1[x + 150, 4] = pala6;
                vectores.Din1[x + 180, 4] = pala7;
                vectores.Din1[x + 210, 4] = pala8;
                vectores.Din1[x + 240, 4] = pala9;
                vectores.Din1[x + 270, 4] = pala10;
                vectores.Din1[x + 300, 4] = pala11;
                vectores.Din1[x + 330, 4] = pala12;
                vectores.Din1[x + 360, 4] = pala13;
                vectores.Din1[x + 390, 4] = pala14;
                vectores.Din1[x + 420, 4] = pala15;
                vectores.Din1[x + 450, 4] = pala16;
                vectores.Din1[x + 480, 4] = pala17;
                vectores.Din1[x + 510, 4] = pala18;
                vectores.Din1[x + 540, 4] = pala19;
                vectores.Din1[x + 570, 4] = pala20;
            }
            vectores.Fila[0]  = pala21;
            vectores.Fila[1]  = pala22;
            vectores.Fila[2]  = pala23;
            vectores.Fila[3]  = pala24;
            vectores.Fila[4]  = pala25;
            vectores.Fila[5]  = pala26;
            vectores.Fila[6]  = pala27;
            vectores.Fila[7]  = pala28;
            vectores.Fila[8]  = pala29;
            vectores.Fila[9]  = pala30;
            vectores.Fila[10] = pala31;
            vectores.Fila[11] = pala32;
            vectores.Fila[12] = pala33;
            vectores.Fila[13] = pala34;
            vectores.Fila[14] = pala35;
            vectores.Fila[15] = pala36;
            vectores.Fila[16] = pala37;
            vectores.Fila[17] = pala38;
            vectores.Fila[18] = pala39;
            vectores.Fila[19] = pala40;

            for (int x = 0; x < 30; x = x + 1)
            {
                vectores.Din1[x, 5]       = pala41;
                vectores.Din1[x + 30, 5]  = pala42;
                vectores.Din1[x + 60, 5]  = pala43;
                vectores.Din1[x + 90, 5]  = pala44;
                vectores.Din1[x + 120, 5] = pala45;
                vectores.Din1[x + 150, 5] = pala46;
                vectores.Din1[x + 180, 5] = pala47;
                vectores.Din1[x + 210, 5] = pala48;
                vectores.Din1[x + 240, 5] = pala49;
                vectores.Din1[x + 270, 5] = pala50;
                vectores.Din1[x + 300, 5] = pala51;
                vectores.Din1[x + 330, 5] = pala52;
                vectores.Din1[x + 360, 5] = pala53;
                vectores.Din1[x + 390, 5] = pala54;
                vectores.Din1[x + 420, 5] = pala55;
                vectores.Din1[x + 450, 5] = pala56;
                vectores.Din1[x + 480, 5] = pala57;
                vectores.Din1[x + 510, 5] = pala58;
                vectores.Din1[x + 540, 5] = pala59;
                vectores.Din1[x + 570, 5] = pala60;
            }


            sr.serializa(vectores);
            sr.closeStream();
            return(ExitType.FirstExit);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Method called when a process token executes the step.
        /// </summary>
        public ExitType Execute(IStepExecutionContext context)
        {
            // Recupera el valor de las variables


            IState _tipo = _propTipo.GetState(context);
            int    tipo  = Convert.ToInt32(_tipo.StateValue);

            IState _fila = _propFila.GetState(context);
            int    fila  = Convert.ToInt32(_fila.StateValue) - 1;

            IState _columna = _propColumna.GetState(context);
            int    columna  = Convert.ToInt32(_columna.StateValue) - 1;

            IState _palas = _propPalas.GetState(context);
            int    palas  = Convert.ToInt32(_palas.StateValue);

            IState _camiones = _propCamiones.GetState(context);
            int    camiones  = Convert.ToInt32(_camiones.StateValue);

            IState _NV = _propNV.GetState(context);
            double NV  = Convert.ToDouble(_NV.StateValue);

            IState _le = _propLE.GetState(context);
            int    le  = Convert.ToInt32(_le.StateValue);

            /***********************************************************/

            SerializarElement sr = new SerializarElement();

            if (File.Exists(sr.SerializationFile))
            {
                Vect v = sr.deserializa();
                if (v != null)
                {
                    //MIP ######################################
                    vectores.MipYc = v.MipYc;
                    vectores.MipYv = v.MipYv;
                    vectores.MipTc = v.MipTc;
                    vectores.MipTv = v.MipTv;

                    //
                    vectores.PlYc     = v.PlYc;
                    vectores.PlYv     = v.PlYv;
                    vectores.PlTc     = v.PlTc;
                    vectores.PlTv     = v.PlTv;
                    vectores.PlTcmalo = v.PlTcmalo;

                    //Dinamico
                    vectores.Din1   = v.Din1;
                    vectores.DesCam = v.DesCam;
                    vectores.Fila   = v.Fila;

                    //LP
                    vectores.TCV    = v.TCV;
                    vectores.TCC    = v.TCC;
                    vectores.TCj    = v.TCj;
                    vectores.TDi    = v.TDi;
                    vectores.Destij = v.Destij;
                    vectores.Dj     = v.Dj;
                    vectores.Uj     = v.Uj;
                    vectores.Ui     = v.Ui;
                    vectores.RLi    = v.RLi;
                    vectores.RUi    = v.RUi;

                    vectores.Mine          = v.Mine;
                    vectores.Mineralocado  = v.Mineralocado;
                    vectores.Lastrealocado = v.Lastrealocado;
                }

                //
            }
            else
            {
                vectores.Mine          = new double[20];
                vectores.MipYc         = new double[31, 21, 13];
                vectores.MipYv         = new double[31, 21, 13];
                vectores.MipTc         = new double[31, 21, 13];
                vectores.MipTv         = new double[31, 21, 13];
                vectores.PlYc          = new double[31, 21];
                vectores.PlYv          = new double[31, 21];
                vectores.PlTc          = new double[31, 21];
                vectores.PlTv          = new double[31, 21];
                vectores.Din1          = new double[600, 8];
                vectores.DesCam        = new double[200, 8];
                vectores.Fila          = new double[20];
                vectores.TCV           = new double[30, 20];
                vectores.TCC           = new double[30, 20];
                vectores.TCj           = new double[20];
                vectores.TDi           = new double[30];
                vectores.Destij        = new double[30, 20];
                vectores.Dj            = new double[20];
                vectores.Uj            = new double[20];
                vectores.Ui            = new double[30];
                vectores.RLi           = new double[30];
                vectores.RUi           = new double[30];
                vectores.PlTcmalo      = new double[30, 20];
                vectores.Mineralocado  = new double[20];
                vectores.Lastrealocado = new double[20];

                for (int x = 0; x < 200; x++)
                {
                    vectores.DesCam[x, 0] = x + 1;
                }


                int aux  = 1;
                int aux2 = 1;
                for (int x = 0; x < 600; x++)
                {
                    vectores.Din1[x, 2] = aux;
                    aux = aux + 1;
                    vectores.Din1[x, 3] = aux2;
                    if (aux == 31)
                    {
                        aux  = 1;
                        aux2 = aux2 + 1;
                    }
                }

                vectores.TDi = new double[30] {
                    0.07, 99, 99, 0.02, 99, 99, 99, 0.01, 99, 99, 99, 99, 99, 99, 99, 99, 99, 0.02, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99
                };                                                                                                                                                                // Tiempos de descarga
                vectores.TCV = new double[, ] {
                    { 0.37, 0.37, 0.46, 0.09, 0.38, 0.37, 0.56, 0.53, 99, 99, 99, 99, 99, 99, 99, 99, 0.08, 0.08, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 0.58, 0.46, 0.68, 0.2, 0.62, 0.72, 0.27, 0.34, 99, 99, 99, 99, 99, 99, 99, 99, 0.81, 1.3, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 0.44, 0.4, 0.4, 0.35, 0.46, 0.47, 0.62, 0.74, 99, 99, 99, 99, 99, 99, 99, 99, 1.3, 0.57, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 0.26, 0.19, 0.3, 0.07, 0.39, 0.3, 99, 0.37, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }
                };                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           //Tiempo camion vacio entre i e j
                vectores.TCC = new double[, ] {
                    { 0.23, 99, 99, 0.1, 0.41, 0.45, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 0.03, 0.05, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 0.38, 99, 99, 99, 99, 99, 0.22, 0.23, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 0.33, 0.35, 0.35, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 0.22, 99, 99, 0.2, 0.47, 0.47, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 0.09, 0.18, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }
                };                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         //Tiempo camion cargado entre i e j
                vectores.PlT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, 3933.07, 1708.91, 2263.85, 3306.26, 5069.83, 3913.43, 0, 0, 0, 0, 0, 0, 0, 0, 1379.92, 1294.04, 0, 0, 32404.43 }
                };
                vectores.PlTv = new double[, ] {
                    { 0, 0, 0, 1708.91, 1310.88, 3306.26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1379.92, 1294.04, 0, 0, 9000 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 5069.83, 3913.43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8983.26 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 4117.54, 4464.61, 3933.07, 0, 952.97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13468.19 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 4117.54, 5417.58, 3933.07, 1708.91, 2263.85, 3306.26, 5069.83, 3913.43, 0, 0, 0, 0, 0, 0, 0, 0, 1379.92, 1294.04, 0, 0, 32404.43 }
                };
                vectores.PlYc = new double[, ] {
                    { 0, 0, 0, 1.41, 3.64, 4.27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.82, 0.83, 0, 0, 10.97 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 4.94, 4.17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9.11 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 5.17, 7.37, 5.13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17.68 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 5.85, 6.45, 5.06, 0.86, 3.23, 4.49, 4.59, 4.4, 0, 0, 0, 0, 0, 0, 0, 0, 0.64, 0.51, 0, 0, 36.09 }
                };
                vectores.TCj = new double[20] {
                    0.06, 0.07, 0.06, 0.15, 0.09, 0.12, 0.08, 0.09, 99, 0.09, 99, 99, 99, 99, 99, 99, 0.14, 0.13, 99, 99
                };
                vectores.Destij = new double[30, 20] {
                    { 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
                };                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       //matriz de puntos inicio llegada
                vectores.Dj = new double[20] {
                    4354, 5729, 4160, 1401.3, 1856.35, 2711.13, 5361, 4138, 0, 5361, 5361, 5361, 0, 0, 0, 0, 1131.530, 1061.11, 0, 0
                };                                                                                                                                                 // Tasa de extraccion de pala, toneladas por hora
                //vectores.Dj = new double[20] { 4117.54, 5417.58, 3933.07, 1708.91, 2263.85, 3306.26, 5069.83, 3913.43, 0, 0, 0, 0, 0, 0, 0, 0, 1379.92, 1294.04, 0, 0 }; // Tasa de extraccion de pala, toneladas por hora
                vectores.Uj = new double[20] {
                    1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0
                };                                                                                           // Factor ocupacion de la pala o chancador
                vectores.Ui = new double[30] {
                    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
                };                                                                                                                         // Factor ocupacion de la pala o chancador
                vectores.RLi = new double[30] {
                    8160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                };                                                                                                                             // minimo
                vectores.RUi = new double[30] {
                    10500, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999, 99999
                };                                                                                                                                                                                                                                                  // maximo
                vectores.PlTcmalo = new double[, ] {
                    { 0, 0, 0, 1401.3, 1856.35, 2709.171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1131.53, 1061.11, 0, 0, 8160 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 5069.83, 3913.43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8983.26 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 4117.54, 5417.58, 3933.07, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13468.19 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 4117.54, 5417.58, 3933.07, 1708.91, 2263.85, 3306.26, 5069.83, 3913.43, 0, 0, 0, 0, 0, 0, 0, 0, 1379.92, 1294.04, 0, 0, 32404.43 }
                };
            }
Exemplo n.º 11
0
        /// <summary>
        /// Method called when a process token executes the step.
        /// </summary>
        public ExitType Execute(IStepExecutionContext context)
        {
            IState _timenow = _propTimenow.GetState(context);
            double timenow  = Convert.ToDouble(_timenow.StateValue);

            SerializarElement sr = new SerializarElement();

            if (File.Exists(sr.SerializationFile))
            {
                Vect v = sr.deserializa();
                vectores = sr.deserializa();

                vectores.MipYc = v.MipYc;
                vectores.MipYv = v.MipYv;
                vectores.MipTc = v.MipTc;
                vectores.MipTv = v.MipTv;

                //Dinamico
                vectores.Din1   = v.Din1;
                vectores.DesCam = v.DesCam;
                vectores.Fila   = v.Fila;

                //LP
                vectores.TCV           = v.TCV;
                vectores.TCC           = v.TCC;
                vectores.TCj           = v.TCj;
                vectores.TDi           = v.TDi;
                vectores.Destij        = v.Destij;
                vectores.Dj            = v.Dj;
                vectores.Uj            = v.Uj;
                vectores.Ui            = v.Ui;
                vectores.RLi           = v.RLi;
                vectores.RUi           = v.RUi;
                vectores.PlYc          = v.PlYc;
                vectores.PlYv          = v.PlYv;
                vectores.PlTc          = v.PlTc;
                vectores.PlTv          = v.PlTv;
                vectores.PlTcmalo      = v.PlTcmalo;
                vectores.Mine          = v.Mine;
                vectores.Mineralocado  = v.Mineralocado;
                vectores.Lastrealocado = v.Lastrealocado;
            }

            int    i = 30;
            int    j = 20;
            double TA;

            TA = 0.0158333333; //tiempo de aculatado
            double expr;

            expr = 0; //variable auxiliar

            GRBEnv env = new GRBEnv();

            GRBModel disp = new GRBModel(env);

            GRBLinExpr L = 320; //Numero auxiliar de velocidad de descarga
            GRBLinExpr M = 110; //Numero max camiones

            double[,] Tcvij = new double[30, 20];
            double[,] Tccij = new double[30, 20];

            for (int a = 0; a < i; a = a + 1) // saca tiempo de viaje total
            {
                for (int b = 0; b < j; b = b + 1)
                {
                    Tcvij[a, b] = vectores.TCV[a, b] + vectores.TDi[a];

                    if (vectores.Destij[a, b] != 0)
                    {
                        Tccij[a, b] = vectores.TCC[a, b] + vectores.TCj[b] + TA;
                    }
                    else
                    {
                        Tccij[a, b] = 9999;
                    }
                }
            }



            for (int b = 0; b < j; b = b + 1)
            {
                expr = 0;

                for (int a = 0; a < i; a = a + 1)
                {
                    expr = expr + vectores.Destij[a, b];
                }
                if (expr == 0)
                {
                    vectores.Uj[b] = 0;
                }
            }


            GRBVar[,] Ycij = new GRBVar[30, 20]; //Camiones cargados de i a j
            GRBVar[,] Yvij = new GRBVar[30, 20]; //Camiones vacios de i a j
            GRBVar[,] Tcij = new GRBVar[30, 20]; //Throughtput cargado de i a j
            GRBVar[,] Tvij = new GRBVar[30, 20]; //Throughtput vacio de i a j

            for (int a = 0; a < i; a = a + 1)
            {
                for (int b = 0; b < j; b = b + 1)
                {
                    Ycij[a, b] = disp.AddVar(0.0, 1000, 0.0, GRB.CONTINUOUS, "Yc" + a + "_" + b);
                    Yvij[a, b] = disp.AddVar(0.0, 1000, 0.0, GRB.CONTINUOUS, "Yv" + a + "_" + b);
                    Tcij[a, b] = disp.AddVar(0.0, 100000, 0.0, GRB.CONTINUOUS, "Tc" + a + "_" + b); //tonelaje cargado pasando hacia j en toneladas
                    Tvij[a, b] = disp.AddVar(0.0, 100000, 0.0, GRB.CONTINUOUS, "Tv" + a + "_" + b); //tonelaje vacio pasando hacia j en toneladas
                }
            }

            for (int a = 0; a < i; a = a + 1)
            {
                for (int b = 0; b < j; b = b + 1)
                {
                    disp.AddConstr(Tcij[a, b] == ((Ycij[a, b] / Tccij[a, b]) * L), "tonelaje_minimo" + a);
                    disp.AddConstr(Tvij[a, b] == ((Yvij[a, b] / Tcvij[a, b]) * L), "tonelaje_maximo" + b);
                }
            }

            for (int b = 0; b < j; b = b + 1)
            {
                GRBLinExpr P = 0;

                for (int a = 0; a < i; a = a + 1)
                {
                    P = P + Tcij[a, b];
                }
                disp.AddConstr((vectores.Dj[b] * vectores.Uj[b]), GRB.LESS_EQUAL, P, "tonelaje_minimo_de_palas" + b);
            }



            for (int a = 0; a < i; a = a + 1)
            {
                GRBLinExpr P = 0;

                for (int b = 0; b < j; b = b + 1)
                {
                    P = P + Tcij[a, b];
                }
                disp.AddConstr(P, GRB.LESS_EQUAL, vectores.RUi[a] * vectores.Ui[a], "tonelaje_minimo_a_basureros" + a);
            }

            //Restriccion del chancador independiente

            for (int a = 1; a < i; a = a + 1)
            {
                GRBLinExpr P = 0;

                for (int b = 0; b < j; b = b + 1)
                {
                    P = P + Tcij[a, b];
                }
                disp.AddConstr(vectores.RLi[a] * vectores.Ui[a], GRB.LESS_EQUAL, P, "tonelajecargado2" + a);
            }

            for (int a = 0; a < i; a = a + 1)
            {
                GRBLinExpr P = 0;

                for (int b = 0; b < j; b = b + 1)
                {
                    P = P + Tcij[a, b];
                }
                disp.AddConstr(vectores.Ui[a] * (vectores.RLi[a] - (vectores.PlTcmalo[0, 3] * (1 - vectores.Uj[3]) + vectores.PlTcmalo[0, 4] * (1 - vectores.Uj[4]) + vectores.PlTcmalo[0, 5] * (1 - vectores.Uj[5]) + vectores.PlTcmalo[0, 16] * (1 - vectores.Uj[16]) + vectores.PlTcmalo[0, 17] * (1 - vectores.Uj[17]))), GRB.LESS_EQUAL, P, "tonelajecargado2" + a);
            }



            GRBLinExpr Qonda = 0;

            for (int a = 0; a < i; a = a + 1)
            {
                for (int b = 0; b < j; b = b + 1)
                {
                    Qonda = (Qonda + Ycij[a, b] + Yvij[a, b]);
                }
            }

            disp.AddConstr(Qonda, GRB.LESS_EQUAL, M, "maximocamiones");



            for (int b = 0; b < j; b = b + 1)
            {
                GRBLinExpr P1 = 0;
                GRBLinExpr P2 = 0;

                for (int a = 0; a < i; a = a + 1)
                {
                    P1 = P1 + Tcij[a, b];
                    P2 = P2 + Tvij[a, b];
                }
                disp.AddConstr(P1, GRB.EQUAL, P2, "conservaciondeflujo" + i);
            }


            for (int a = 0; a < i; a = a + 1)
            {
                GRBLinExpr P1 = 0;
                GRBLinExpr P2 = 0;

                for (int b = 0; b < j; b = b + 1)
                {
                    P1 = P1 + Tcij[a, b];
                    P2 = P2 + Tvij[a, b];
                }

                disp.AddConstr(P1, GRB.EQUAL, P2, "conservaciondeflujo2" + i);
            }


            GRBLinExpr Pobj = 0;

            for (int a = 0; a < i; a = a + 1)
            {
                for (int b = 0; b < j; b = b + 1)
                {
                    Pobj = Pobj + Ycij[a, b] + Yvij[a, b];
                }
            }

            disp.Update();

            disp.SetObjective(Pobj, GRB.MINIMIZE);

            disp.Optimize();


            double sumayc = 0;
            double sumayv = 0;
            double sumatc = 0;
            double sumatv = 0;

            for (int a = 0; a < i; a = a + 1)
            {
                double sumajyc = 0;
                double sumajyv = 0;
                double sumajtc = 0;
                double sumajtv = 0;

                for (int b = 0; b < j; b = b + 1)
                {
                    vectores.PlYc[a, b] = Convert.ToDouble(Ycij[a, b].X);
                    vectores.PlYv[a, b] = Convert.ToDouble(Yvij[a, b].X);
                    vectores.PlTc[a, b] = Convert.ToDouble(Tcij[a, b].X);
                    vectores.PlTv[a, b] = Convert.ToDouble(Tvij[a, b].X);
                    sumayc  = sumayc + vectores.PlYc[a, b];             //suma todos los flujos llenos
                    sumayv  = sumayv + vectores.PlYv[a, b];             //suma todos los flujos vacios
                    sumatc  = sumatc + vectores.PlTc[a, b];             //suma todos los camiones llenos
                    sumatv  = sumatv + vectores.PlTv[a, b];             //suma todos los camiones vacios
                    sumajyc = sumajyc + Convert.ToDouble(Ycij[a, b].X); //suma todo el flujo cargado al botadero "a"
                    sumajyv = sumajyv + Convert.ToDouble(Yvij[a, b].X); //suma todo el flujo vacio al botadero "a"
                    sumajtc = sumajtc + Convert.ToDouble(Tcij[a, b].X); //suma todos los camiones cargados yendo a botadero "a"
                    sumajtv = sumajtv + Convert.ToDouble(Tvij[a, b].X); //suma todos los camiones vacios yendo a botadero "a"
                }

                vectores.PlYc[a, 20] = sumajyc; // deja total
                vectores.PlYv[a, 20] = sumajyv; //
                vectores.PlTc[a, 20] = sumajtc; //
                vectores.PlTv[a, 20] = sumajtv; //
            }

            for (int b = 0; b < j; b = b + 1)
            {
                double sumaiyc = 0;
                double sumaiyv = 0;
                double sumaitc = 0;
                double sumaitv = 0;

                for (int a = 0; a < i; a = a + 1)
                {
                    sumaiyc = sumaiyc + Convert.ToDouble(Ycij[a, b].X);
                    sumaiyv = sumaiyv + Convert.ToDouble(Yvij[a, b].X);
                    sumaitc = sumaitc + Convert.ToDouble(Tcij[a, b].X);
                    sumaitv = sumaitv + Convert.ToDouble(Tvij[a, b].X);
                }

                vectores.PlYc[30, b] = sumaiyc;
                vectores.PlYv[30, b] = sumaiyv;
                vectores.PlTc[30, b] = sumaitc;
                vectores.PlTv[30, b] = sumaitv;
            }

            vectores.PlYc[30, 20] = sumayc;
            vectores.PlYv[30, 20] = sumayv;
            vectores.PlTc[30, 20] = sumatc;
            vectores.PlTv[30, 20] = sumatv;

            _timenow.StateValue = vectores.PlTc[0, 20];
            sr.serializa(vectores);
            sr.closeStream();

            disp.Dispose();
            env.Dispose();



            return(ExitType.FirstExit);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Method called when a process token executes the step.
        /// </summary>
        public ExitType Execute(IStepExecutionContext context)
        {
            IState _timenow = _propTimenow.GetState(context);
            double timenow  = Convert.ToDouble(_timenow.StateValue);

            // Example of how to get the value of a step property.


            SerializarElement sr = new SerializarElement();

            if (File.Exists(sr.SerializationFile))
            {
                Vect v = sr.deserializa();
                vectores = sr.deserializa();

                vectores.MipYc    = v.MipYc;
                vectores.MipYv    = v.MipYv;
                vectores.MipTc    = v.MipTc;
                vectores.MipTv    = v.MipTv;
                vectores.PlYc     = v.PlYc;
                vectores.PlYv     = v.PlYv;
                vectores.PlTc     = v.PlTc;
                vectores.PlTv     = v.PlTv;
                vectores.PlTcmalo = v.PlTcmalo;

                //Dinamico
                vectores.Din1   = v.Din1;
                vectores.DesCam = v.DesCam;
                vectores.Fila   = v.Fila;

                //LP
                vectores.TCV          = v.TCV;
                vectores.TCC          = v.TCC;
                vectores.TCj          = v.TCj;
                vectores.TDi          = v.TDi;
                vectores.Destij       = v.Destij;
                vectores.Dj           = v.Dj;
                vectores.Uj           = v.Uj;
                vectores.Ui           = v.Ui;
                vectores.RLi          = v.RLi;
                vectores.RUi          = v.RUi;
                vectores.Mine         = v.Mine;
                vectores.Mineralocado = v.Mineralocado;
            }



            int periodos = 13 - Convert.ToInt32(Math.Truncate(timenow));

            for (int b = 0; b < 21; b = b + 1)
            {
                for (int a = 0; a < 31; a = a + 1)
                {
                    vectores.PlYc[a, b] = vectores.MipYc[a, b, periodos];
                    vectores.PlYv[a, b] = vectores.MipYv[a, b, periodos];
                    vectores.PlTc[a, b] = vectores.MipTc[a, b, periodos];
                    vectores.PlTv[a, b] = vectores.MipTv[a, b, periodos];
                }
            }

            return(ExitType.FirstExit);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Method called when a process token executes the step.
        /// </summary>
        public ExitType Execute(IStepExecutionContext context)
        {
            IState _timenow = _propTimenow.GetState(context);
            double timenow  = Convert.ToDouble(_timenow.StateValue);
            IState _salida  = _propSalida.GetState(context);
            double salida   = Convert.ToDouble(_salida.StateValue);
            IState _aux     = _propAux.GetState(context);
            double aux      = Convert.ToDouble(_aux.StateValue);

            SerializarElement sr = new SerializarElement();

            if (File.Exists(sr.SerializationFile))
            {
                Vect v = sr.deserializa();
                vectores = sr.deserializa();

                vectores.MipYc = v.MipYc;
                vectores.MipYv = v.MipYv;
                vectores.MipTc = v.MipTc;
                vectores.MipTv = v.MipTv;

                //Dinamico
                vectores.Din1   = v.Din1;
                vectores.DesCam = v.DesCam;
                vectores.Fila   = v.Fila;

                //LP
                vectores.TCV           = v.TCV;
                vectores.TCC           = v.TCC;
                vectores.TCj           = v.TCj;
                vectores.TDi           = v.TDi;
                vectores.Destij        = v.Destij;
                vectores.Dj            = v.Dj;
                vectores.Uj            = v.Uj;
                vectores.Ui            = v.Ui;
                vectores.RLi           = v.RLi;
                vectores.RUi           = v.RUi;
                vectores.PlYc          = v.PlYc;
                vectores.PlYv          = v.PlYv;
                vectores.PlTc          = v.PlTc;
                vectores.PlTv          = v.PlTv;
                vectores.PlTcmalo      = v.PlTcmalo;
                vectores.Mine          = v.Mine;
                vectores.Mineralocado  = v.Mineralocado;
                vectores.Lastrealocado = v.Lastrealocado;
            }

            //i Botaderos. j Palas. k Camiones.

            double[,] Din12 = (double[, ])vectores.Din1.Clone();

            double[,] Tij = (double[, ])vectores.PlTc.Clone();//I Tonelaje por turno


            double[,] xij = new double[30, 20]; //I Tonelaje cumplido hasta el momento de activación del dinámico
            double[,] yij = new double[30, 20]; //Tonelaje requerido para alcazar R
            double[,] Rij = new double[30, 20]; //Porcentaje de cumplimienteo del tonelaje
            double[,] dij = new double[30, 20]; //Desviación del porcentaje de cumplimiento ideal en el momento de activación
            double[,] Mij = new double[30, 20]; //Demanda de camiones por ruta
            double[,] rij = new double[30, 20]; //I Matriz de tiempos de viajes

            double[] tk = new double[81];       //I Tiempo que le toma al camión k llegar al botadero/chancador al que va (si ya está en un botadero este tiempo es 0)
            double[] dk = new double[81];       //I Tiempo esperado de espera del camión k en el botadero/chancador al que va
            double[] ej = new double[30];       //I Tiempo promedio de descarga en el botadero j
            double[] Di = new double[20];       //Demanda de camiones por pala (int?)
            double[] Li = new double[20];       //I Tiempo promedio de carga en la pala i
            double[] Ni = new double[20];       //I Número de camiones en la pala i (int?)
            double[] Ei = new double[20];       //I Camiones en ruta a la pala i (int?)
            double[] Sk = new double[81];       //I Arreglo de variables binarias que indican si el camión tiene una tarea asignada
            int[]    Bk = new int[81];          //Botadero al que está llendo el camión k

            int    numcam       = 81;           //Número total de camiones
            double capacidad    = 300;          //Capacidad de los camiones
            int    numPalas     = 20;           //Palas activas?
            int    numBotaderos = 30;           //Botaderos o chancador activos?
            double R            = 0;

            //Se cálcula el porcentaje de cumplimiento de cuota
            for (int i = 0; i < numBotaderos; i++)
            {
                for (int j = 0; j < numPalas; j++)
                {
                    if (Tij[i, j] != 0)
                    {
                        Rij[i, j] = xij[i, j] / Tij[i, j];
                        R         = R + Rij[i, j];
                    }
                }
            }

            //Se calcula de déficit o superávit
            R = R / (numPalas * numBotaderos);
            for (int i = 0; i < numBotaderos; i++)
            {
                for (int j = 0; j < numPalas; j++)
                {
                    dij[i, j] = Rij[i, j] - R;
                }
            }
            //Se calcula la demanda adeudada para alcanzar R
            double mij_aux;
            int    mij;

            for (int i = 0; i < numBotaderos; i++)
            {
                for (int j = 0; j < numPalas; j++)
                {
                    yij[i, j] = R * Tij[i, j] - xij[i, j];
                    mij_aux   = yij[i, j] / capacidad;
                    mij       = Convert.ToInt32(mij_aux);
                    Mij[i, j] = mij + 1;
                }
            }
            double DTotal = 0;
            double di;

            for (int j = 0; j < numPalas; j++)
            {
                di = 0;
                for (int i = 0; i < numPalas; i++)
                {
                    di = Mij[i, j] + di;
                }

                Di[j]  = di;
                DTotal = DTotal + Di[j];
            }
            //En teoría se debería hacer un chequeo para que la demanda total de camiones no supere
            //el total disponible. De ocurrir, se deben limitar los flujos del PL (*).

            //Criterio de asignación de camiones
            //Se crea el arreglo Wik que contiene los tiempos que demora al camion k llegar a ser
            //atendido por la pala i. El tamaño de este arreglo depende de los camiones disponibles.
            double[,] Wik = new double[numPalas, numcam];//Matriz de tiempos esperados del camión k para ser atendido por la pala i

            for (int k = 0; k < numcam; k++)
            {
                if (Sk[k] != 0) //Sólo para los camiones sin tareas asignadas
                {
                    for (int i = 0; i < numPalas; i++)
                    {
                        Wik[i, k] = Li[i] * (Ni[i] + Ei[i]) - (tk[k] + dk[k] + ej[Bk[k]] + rij[Bk[k], i]);
                    }
                }
            }

            //Modelo
            GRBEnv   env   = new GRBEnv();
            GRBModel model = new GRBModel(env);

            model.ModelName = "Asignación Dinámica";

            GRBVar[,] X = new GRBVar[numPalas, numcam]; //Binaria que define si el camión k se asigna a la pala i

            for (int i = 0; i < numPalas; i++)
            {
                for (int k = 0; k < numcam; k++)
                {
                    X[i, k] = model.AddVar(0.0, 1.0, 0.0, GRB.BINARY, "X" + i + "_" + k);
                }
            }

            model.Update();

            //Restricciones

            for (int k = 0; k < numcam; k++)
            {
                GRBLinExpr suma_Xik = 0;

                for (int i = 0; i < numPalas; i++)
                {
                    suma_Xik = suma_Xik + X[i, k];
                }
                model.AddConstr(suma_Xik, GRB.LESS_EQUAL, Sk[k], "S" + k);
            }

            for (int i = 0; i < numPalas; i++)
            {
                GRBLinExpr suma_Xik = 0;

                for (int k = 0; k < numcam; k++)
                {
                    suma_Xik = suma_Xik + X[i, k];
                }
                model.AddConstr(suma_Xik, GRB.GREATER_EQUAL, Di[i], "D" + i);
            }

            model.Update();

            GRBLinExpr FO = 0;

            for (int i = 0; i < numPalas; i++)
            {
                for (int k = 0; k < numcam; k++)
                {
                    FO = FO + Wik[i, k] * X[i, k];
                }
            }
            model.SetObjective(FO, GRB.MINIMIZE);

            model.Update();

            model.Optimize();

            sr.serializa(vectores);

            sr.closeStream();
            return(ExitType.FirstExit);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Method called when a process token executes the step.
        /// </summary>
        public ExitType Execute(IStepExecutionContext context)
        {
            IState _timenow   = _propTimenow.GetState(context);
            double timenow    = Convert.ToDouble(_timenow.StateValue);
            IState _salida    = _propSalida.GetState(context);
            double salida     = Convert.ToDouble(_salida.StateValue);
            IState _aux       = _propAux.GetState(context);
            double aux        = Convert.ToDouble(_aux.StateValue);
            IState _aux2      = _propAux2.GetState(context);
            double aux2       = Convert.ToDouble(_aux2.StateValue);
            IState _numcam    = _propNumCam.GetState(context);
            double numcam     = Convert.ToDouble(_numcam.StateValue);
            IState _needtime  = _propNeedtime.GetState(context);
            double needtime   = Convert.ToDouble(_needtime.StateValue);
            IState _losttones = _propLosttones.GetState(context);
            double losttones  = Convert.ToDouble(_losttones.StateValue);
            IState _needch    = _propNeedch.GetState(context);
            double needch     = Convert.ToDouble(_needch.StateValue);
            // Example of how to get the value of a step property.


            SerializarElement sr = new SerializarElement();

            if (File.Exists(sr.SerializationFile))
            {
                Vect v = sr.deserializa();
                vectores = sr.deserializa();

                vectores.MipYc    = v.MipYc;
                vectores.MipYv    = v.MipYv;
                vectores.MipTc    = v.MipTc;
                vectores.MipTv    = v.MipTv;
                vectores.PlYc     = v.PlYc;
                vectores.PlYv     = v.PlYv;
                vectores.PlTc     = v.PlTc;
                vectores.PlTv     = v.PlTv;
                vectores.PlTcmalo = v.PlTcmalo;


                //Dinamico
                vectores.Din1   = v.Din1;
                vectores.DesCam = v.DesCam;
                vectores.Fila   = v.Fila;

                //LP
                vectores.TCV           = v.TCV;
                vectores.TCC           = v.TCC;
                vectores.TCj           = v.TCj;
                vectores.TDi           = v.TDi;
                vectores.Destij        = v.Destij;
                vectores.Dj            = v.Dj;
                vectores.Uj            = v.Uj;
                vectores.Ui            = v.Ui;
                vectores.RLi           = v.RLi;
                vectores.RUi           = v.RUi;
                vectores.Mine          = v.Mine;
                vectores.Mineralocado  = v.Mineralocado;
                vectores.Lastrealocado = v.Lastrealocado;
            }

            int    y;                              //para entrar al loop
            int    palaneedy        = 0;           //numero de la pala needy
            double caminoipalaneedy = 0;
            double min;                            //var aux para encontrar pala needy

            double[,] Din22 = new double[200, 11]; //matriz con datos para encontrar camion con menos lost_tones
            double[] need_time = new double[600];  //matriz para encontrar al camino mas needy


            for (int x = 0; x < numcam; x++)    //construye lo que falta de la matriz de los camiones (lo que depende de la pala needy)
            {
                if (vectores.DesCam[x, 3] == 1) // indicador si necesita pala
                {
                    Din22[x, 8] = 1;
                }
            }


            for (int vuelta = 0; vuelta < 20; vuelta++)
            {
                for (int x = 0; x < 30; x++)
                {
                    vectores.Din1[x + 30 * (vuelta), 1] = vectores.PlTc[30, vuelta]; //rescatar el haulage por hora de cada camino
                }
            }

            int desesperacion;
            int desesperacion2;

            desesperacion  = 0;
            desesperacion2 = 0;
            for (int x = 0; x < 600; x++) //recupera los tonelajes del PL
            {
                vectores.Din1[x, 0] = vectores.PlTc[desesperacion, desesperacion2];
                desesperacion       = desesperacion + 1;
                if (desesperacion > 29)
                {
                    desesperacion2 = desesperacion2 + 1;
                    desesperacion  = 0;
                }
            }

            for (int x = 0; x < 200; x++)
            {
                Din22[x, 0] = x + 1;                                                 //numero camion
                Din22[x, 1] = 320;                                                   //capacidad
                Din22[x, 2] = vectores.PlTc[30, 20];                                 //total rate shovels
                Din22[x, 3] = (vectores.PlYc[30, 20] + vectores.PlYv[30, 20]) * 320; //total trucks en toneladas
            }

            int newaux      = 0;
            int camionpiola = 100;

            min = 999999;//var aux para encontrar pala needy
            double min3;

            double[,] Din12 = (double[, ])vectores.Din1.Clone(); //matriz con datos para encontrar camion con menos lost_tones

            do
            {
                min3 = 0;
                min  = 999999;
                y    = 0;

                int indicemin1 = 900000000; //var aux para encontrar pala needy

                for (int x = 0; x < 600; x++)
                {
                    if (Din12[x, 0] != 0)
                    {
                        need_time[x] = Din12[x, 4] + ((Din12[x, 0] / Din12[x, 1]) * (Din12[x, 5] * 300 - Din12[x, 1]) / (Din12[x, 0]));

                        //need_time[x] = Din12[x, 4] + ((Din12[x, 0] / Din12[x, 1]) * (Din12[x, 5] * 300 - Din12[x, 1] * timenow)) / (Din12[x, 7] * 300 / (timenow));

                        if (need_time[x] < min) //encuentra el menor y lo guarda en palaneedy
                        {
                            indicemin1 = x;

                            palaneedy = Convert.ToInt32(Din12[x, 3]);

                            min = need_time[x];

                            caminoipalaneedy = Din12[x, 2];
                        }
                    }
                }

                //if (min < timenow)
                //{
                //Din12[indicemin1, 7] = Din12[indicemin1, 7] + 1;


                for (int x = 0; x < numcam; x++)     //construye lo que falta de la matriz de los camiones (lo que depende de la pala needy)

                {
                    /*
                     * sacar la fila bien
                     *
                     */

                    vectores.Ui[0] = vectores.Ui[0];

                    Din22[x, 4] = vectores.Fila[palaneedy - 1] * vectores.TCj[palaneedy - 1] + vectores.DesCam[x, 4];

                    if (Din22[x, 8] == 1)
                    {
                        Din22[x, 5] = vectores.TCV[Convert.ToInt32(vectores.DesCam[x, 2] - 1), palaneedy - 1];     //recoje tiempo de donde esta a la pala needy
                    }

                    Din22[x, 6] = vectores.PlTc[30, palaneedy - 1]; //tonelaje total asignado a palaneedy

                    if (vectores.Fila[palaneedy - 1] == 0)          //si no hay fila
                    {
                        if (Din22[x, 8] == 1)
                        {
                            Din22[x, 7] = vectores.TCV[Convert.ToInt32(vectores.DesCam[x, 2] - 1), palaneedy - 1];     //el shovel idle rate es Tij
                        }
                    }
                }


                double min2 = 90000000;
                camionpiola = 100;     //que sea mayor que la ultima linea
                double[] lost_tones = new double[200];
                newaux = 0;

                for (int x = 0; x < numcam; x++)     //calcula lost_tones para los importantes
                {
                    if (Din22[x, 8] == 1)
                    {
                        lost_tones[x] = ((Din22[x, 1] * Din22[x, 2] / Din22[x, 3]) * (Din22[x, 4] + Din22[x, 5]) + (Din22[x, 6] * Din22[x, 7]));
                        //lost_tones[x] = (Din22[x, 2] / Din22[x, 3]) * (Din22[x, 3] + Din22[x, 4]) + (Din22[x, 5] * Din22[x, 6]);

                        if (lost_tones[x] < min2)     //recupera el menor y actualiza el valor
                        {
                            min2 = lost_tones[x];

                            //camionpiola = Convert.ToInt32(Din22[x, 0]);

                            camionpiola = x + 1;
                        }
                    }

                    else

                    {
                        newaux = newaux + 1;
                    }
                }


                Din22[camionpiola - 1, 9]  = palaneedy; // asignar camino a camion
                Din22[camionpiola - 1, 8]  = 0;         //lo saca de la lista
                Din22[camionpiola - 1, 10] = caminoipalaneedy;

                for (int x = 0; x < numcam; x++)
                {
                    if (Din22[x, 8] == 1)
                    {
                        y = 1;
                    }
                }

                for (int x = 0; x < 30; x++)
                {
                    Din12[x + (palaneedy - 1) * 30, 4] = timenow;
                    Din12[x + (palaneedy - 1) * 30, 5] = Din12[x + (palaneedy - 1) * 30, 5] + 1;
                }
                newaux = indicemin1;
//                }

                /*else
                 * {
                 *  min = 959;
                 *  int palapiola = 100; //que sea mayor que la ultima linea
                 *  double min2 = 90000000;
                 *  for (int palanedy = 1; palanedy < 20; palanedy++)
                 *  {
                 *
                 *      if (vectores.PlTc[30, palanedy - 1] > 0)
                 *      {
                 *
                 *          Din22[Convert.ToInt32(aux2 - 1), 4] = vectores.Fila[palanedy - 1] * vectores.TCj[palanedy - 1] + vectores.DesCam[Convert.ToInt32(aux2 - 1), 4];
                 *
                 *          Din22[Convert.ToInt32(aux2 - 1), 5] = vectores.TCV[Convert.ToInt32(vectores.DesCam[Convert.ToInt32(aux2 - 1), 2] - 1), palanedy - 1]; //recoje tiempo de donde esta a la pala needy
                 *
                 *          Din22[Convert.ToInt32(aux2 - 1), 6] = vectores.PlTc[30, palanedy - 1]; //tonelaje total asignado a palaneedy
                 *
                 *          Din22[Convert.ToInt32(aux2 - 1), 7] = 0;
                 *
                 *          if (vectores.Fila[palanedy - 1] == 0) //si no hay fila
                 *          {
                 *              Din22[Convert.ToInt32(aux2 - 1), 7] = vectores.TCV[Convert.ToInt32(vectores.DesCam[Convert.ToInt32(aux2 - 1), 2] - 1), palanedy - 1]; //el shovel idle rate es Tij                            }
                 *          }
                 *
                 *          double lost_tones;
                 *
                 *          lost_tones = ((Din22[Convert.ToInt32(aux2 - 1), 1] * Din22[Convert.ToInt32(aux2 - 1), 2] / Din22[Convert.ToInt32(aux2 - 1), 3]) * (Din22[Convert.ToInt32(aux2 - 1), 4] + Din22[Convert.ToInt32(aux2 - 1), 5]) + (Din22[Convert.ToInt32(aux2 - 1), 6] * Din22[Convert.ToInt32(aux2 - 1), 7]));
                 *          //lost_tones[x] = (Din22[x, 2] / Din22[x, 3]) * (Din22[x, 3] + Din22[x, 4]) + (Din22[x, 5] * Din22[x, 6]);
                 *
                 *          if (lost_tones < min2) //recupera el menor y actualiza el valor
                 *          {
                 *
                 *              min2 = lost_tones;
                 *
                 *              palapiola = palanedy;
                 *
                 *          }
                 *      }
                 *  }
                 *
                 *  double min32 = 0;
                 *
                 *  for (int l = 0; l < 30; l++)
                 *  {
                 *      double last_tones = 0;
                 *      if (vectores.PlTc[l, palapiola - 1] > 0)
                 *      {
                 *          last_tones = vectores.PlTc[l, palapiola - 1] / (Din12[(palapiola - 1) * 30 + l, 7] * 300 / timenow);
                 *          if (last_tones > min32)
                 *          {
                 *
                 *              min32 = last_tones;
                 *              Din22[Convert.ToInt32(aux2 - 1), 9] = palapiola;
                 *              Din22[Convert.ToInt32(aux2 - 1), 10] = l + 1;
                 *
                 *          }
                 *      }
                 *      else
                 *      {
                 *          if (min2 == 0)
                 *          {
                 *              Din22[Convert.ToInt32(aux2 - 1), 9] = 21;
                 *          }
                 *      }
                 *
                 *
                 *  }
                 *  y = 0;
                 * }*/
            }while (y == 1);

            //for (int x = 0; x < numcam; x++) //DesCam suelta el dato como importante
            //{
            //    vectores.DesCam[x, 3] = 0;
            //}

            _salida.StateValue = Din22[Convert.ToInt32(aux2 - 1), 9];
            if (Din22[Convert.ToInt32(aux2 - 1), 9] == 4 || Din22[Convert.ToInt32(aux2 - 1), 9] == 5 || Din22[Convert.ToInt32(aux2 - 1), 9] == 6 || Din22[Convert.ToInt32(aux2 - 1), 9] == 10 || Din22[Convert.ToInt32(aux2 - 1), 9] == 17 || Din22[Convert.ToInt32(aux2 - 1), 9] == 18)
            {
                Din22[Convert.ToInt32(aux2 - 1), 10] = 1;
            }

            else if (Din22[Convert.ToInt32(aux2 - 1), 9] == 7 || Din22[Convert.ToInt32(aux2 - 1), 9] == 8 || Din22[Convert.ToInt32(aux2 - 1), 9] == 12)
            {
                Din22[Convert.ToInt32(aux2 - 1), 10] = 4;
            }

            else if (Din22[Convert.ToInt32(aux2 - 1), 9] == 1 || Din22[Convert.ToInt32(aux2 - 1), 9] == 2 || Din22[Convert.ToInt32(aux2 - 1), 9] == 3 || Din22[Convert.ToInt32(aux2 - 1), 9] == 11)
            {
                Din22[Convert.ToInt32(aux2 - 1), 10] = 8;
            }

            _aux.StateValue = Din22[Convert.ToInt32(aux2 - 1), 10];                                                                                   //
            //_aux2.StateValue = camionpiola;
            _needtime.StateValue  = min;                                                                                                              //
            _losttones.StateValue = ((Din12[33, 0] / Din12[33, 1]) * (Din12[33, 5] * 300 - Din12[33, 1] * timenow)) / (Din12[33, 7] * 300 / timenow); //(Din12[33, 7] * 300 / timenow);//
            _needch.StateValue    = ((Din12[37, 0] / Din12[37, 1]) * (Din12[37, 5] * 300 - Din12[37, 1] * timenow)) / (Din12[37, 7] * 300 / timenow); //

            sr.serializa(vectores);
            sr.closeStream();
            return(ExitType.FirstExit);
        }