Esempio n. 1
0
        /// Education process
        ///
        public void Change_education(country temp)
        {
            matrix3d temptemp = new matrix3d(temp.pop.size_first, temp.pop.size_second, temp.pop.size_third);

            for (int i = 0; i < temp.pop.size_first; i++)
            {
                for (int k = 0; k < temp.pop.size_third; k++)
                {
                    for (int j = 0; j < temp.pop.size_second; j++)
                    {
                        for (int l = 0; l < temp.pop.size_second; l++)
                        {
                            temptemp.self[i, j, k] += temp.ch_educ.self[l, j] * temp.pop.self[i, l, k];
                        }
                    }
                }
            }
            for (int i = 0; i < temp.pop.size_first; i++)
            {
                for (int j = 0; j < temp.pop.size_second; j++)
                {
                    for (int k = 0; k < temp.pop.size_third; k++)
                    {
                        temp.pop.self[i, j, k] = temptemp.self[i, j, k];
                    }
                }
            }
        }
Esempio n. 2
0
 public country(string name, double power, double tech, double env, double ed_c, double ed_t, int amt_cult)
 {
     this.enviroment   = env;
     this.name_country = name;
     this.power        = power;
     this.technology   = tech;
     //this.educ_cult = ed_c;
     this.educ_tech = ed_t;
     this.amt_cult  = amt_cult;
     //this.population = new matrix( amt_age, amt_ed);
     this.pop = new matrix3d(this.amt_age, this.amt_ed, this.amt_cult);
 }
Esempio n. 3
0
        /// Arrival migrant process
        ///
        public void Arrival_immigrant(country count, matrix3d temp)
        {
            matrix3d temptemp = new matrix3d(count.pop.size_first, count.pop.size_second, count.pop.size_third);

            for (int i = 0; i < count.pop.size_third; i++)
            {
                for (int j = 0; j < count.pop.size_second; j++)
                {
                    for (int k = 0; k < count.pop.size_first; k++)
                    {
                        for (int l = 0; l < count.pop.size_first; l++)
                        {
                            temptemp.self[k, j, i] += count.ch_age.self[k, l] * count.pop.self[l, j, i];
                        }
                    }
                }
            }
            for (int i = 0; i < count.pop.size_third; i++)
            {
                temptemp.self[0, 0, i] = temptemp.self[0, 0, i] + temptemp.self[0, 1, i] + temptemp.self[0, 2, i];
                temptemp.self[0, 1, i] = 0.0f;
                temptemp.self[0, 2, i] = 0.0f;
            }


            for (int k = 0; k < temptemp.size_third; k++)
            {
                for (int j = 0; j < temptemp.size_second; j++)
                {
                    for (int i = 0; i < temptemp.size_first; i++)
                    {
                        count.pop.self[i, j, k] = temptemp.self[i, j, k];
                    }
                }
            }


            for (int i = 0; i < count.pop.size_first; i++)
            {
                for (int j = 0; j < count.pop.size_second; j++)
                {
                    for (int k = 0; k < count.pop.size_third; k++)
                    {
                        count.pop.self[i, j, k] += temp.self[i, j, k];
                    }
                }
            }
        }
Esempio n. 4
0
        /// Main process
        ///
        private void button1_Click(object sender, EventArgs e)
        {
            Graph_calc(Gomer, graph);
            defeintion_coeff_matrix(Gomer);
            List <matrix3d> temp = new List <matrix3d>();

            for (int l = 0; l < Gomer.Count; l++)
            {
                input = new matrix3d(100, 3, Gomer.Count);
                for (int k = 0; k < Gomer.Count; k++)
                {
                    if (k == l)
                    {
                        continue;
                    }
                    for (int i = 0; i < Gomer[l].pop.size_first; i++)
                    {
                        for (int j = 0; j < Gomer[l].pop.size_second; j++)
                        {
                            for (int m = 0; m < Gomer[l].pop.size_third; m++)
                            {
                                input.self[i, j, m] = graph.self[l, k] * Gomer[l].pop.self[i, j, m] * coeff(i, j);
                                if (input.self[i, j, m] > Gomer[l].pop.self[i, j, m])
                                {
                                    input.self[i, j, m]        = Gomer[l].pop.self[i, j, m];
                                    Gomer[l].pop.self[i, j, m] = 0;
                                }
                                else
                                {
                                    Gomer[l].pop.self[i, j, m] = Gomer[l].pop.self[i, j, m] - input.self[i, j, m];
                                }
                            }
                        }
                    }
                }
                temp.Add(input);
            }
            for (int l = 0; l < Gomer.Count; l++)
            {
                Arrival_immigrant(Gomer[l], temp[l]);
            }
        }
Esempio n. 5
0
        public matrix3d transform(int c)
        {
            matrix3d dh = new matrix3d(this.size_first, this.size_second, this.size_third);

            for (int i = 0; i < dh.size_first; i++)
            {
                for (int j = 0; j < dh.size_second; j++)
                {
                    for (int k = 0; k < dh.size_third; k++)
                    {
                        dh.self[i, j, k] = this.self[i, j, k];
                    }
                }
            }

            if (c >= this.size_third)
            {
                matrix3d er = new matrix3d(this.size_first, this.size_second, c);
                for (int i = 0; i < this.size_first; i++)
                {
                    for (int j = 0; j < this.size_second; i++)
                    {
                        for (int k = 0; k < c; k++)
                        {
                            if (k >= er.size_third)
                            {
                                er.self[i, j, k] = dh.self[i, j, k];
                            }
                        }
                    }
                }
                return(er);
            }
            else
            {
                return(dh);
            }
        }