Ejemplo n.º 1
0
        private void ParseWeightType(string text)
        {
            switch (text)
            {
            case "EUC_2D":
                weightType = EdgeWeightType.Euc2D;
                coordType  = CoordType.Twod;
                break;

            case "EUC_3D":
                weightType = EdgeWeightType.Euc3D;
                coordType  = CoordType.Threed;
                break;

            case "GEO":
                weightType = EdgeWeightType.Geo;
                coordType  = CoordType.Twod;
                break;

            case "EXPLICIT":
                weightType = EdgeWeightType.Explicit;
                break;

            case "ATT":
                weightType = EdgeWeightType.Att;
                break;

            case "CEIL_2D":
                weightType = EdgeWeightType.Ceil2D;
                break;

            default:
                throw new GtspException("Unknown edge weight type: " + text);
            }
        }
Ejemplo n.º 2
0
        public TSP(List <double[]> nodeCoords, int size, EdgeWeightType edgeWeightType)
        {
            distMatrix = new double[size, size];
            switch (edgeWeightType)
            {
            case EdgeWeightType.EUC_2D:
                CreateDistMatrix(nodeCoords, EUC_2D);
                break;

            case EdgeWeightType.MAX_2D:
                CreateDistMatrix(nodeCoords, MAX_2D);
                break;

            case EdgeWeightType.MAN_2D:
                CreateDistMatrix(nodeCoords, MAN_2D);
                break;

            case EdgeWeightType.CEIL_2D:
                CreateDistMatrix(nodeCoords, CEIL_2D);
                break;
            }
        }
Ejemplo n.º 3
0
        //Fitness degerlerini dosya tipine gore hesaplayan fonksiyon
        //fitness fonksiyonumuz uzaklik hesabi oldugundan problemin tipi fitness fonksiyonumuzu da belirliyor.
        public void CalculateFitnessFunction(TspFile tspFile, EdgeWeightType edgeWeightType)
        {
            switch (edgeWeightType)
            {
            case EdgeWeightType.EUC_2D:
                tspFile.EuclidDistance();
                break;

            case EdgeWeightType.MAX_2D:
                tspFile.MaximumDistance();
                break;

            case EdgeWeightType.MAN_2D:
                tspFile.ManhattanDistance();
                break;

            case EdgeWeightType.CEIL_2D:
                tspFile.CeilDistance();
                break;

            default:
                break;
            }
        }