Ejemplo n.º 1
0
//N-stages
        internal void stages()
        {
            bool[] fnodes = new bool[2 * N];         //init with trues the second half
            for (int i = 0; i < N; i++)
            {
                fnodes[N + i] = true;
            }
            GraphWithMatching graph = new GraphWithMatching(M, w, P, flatA, flatB);

            //IntBinaryHeapPriorityQueue pq=new IntBinaryHeapPriorityQueue(graph.NumberOfVertices);
            for (int i = 0; i < N; i++)
            {
                //match i-th node
                SSMTSP spa              = new SSMTSP(graph, i, fnodes /*,pq */);
                int[]  path             = spa.GetPath();
                int    theClosestVertex = path[path.Length - 1];
                int    db0              = spa.dist[theClosestVertex];
                fnodes[theClosestVertex] = false;
                //db0 gives the shortest reduced price cost path
                //fix potential
                for (int j = 0; j < N; j++)
                {
                    int m = db0 - spa.dist[j];
                    if (m > 0)
                    {
                        P[j] -= m;
                    }

                    m = db0 - spa.dist[N + j];
                    if (m > 0)
                    {
                        P[N + j] += m;
                    }
                }

                for (int j = 1; j < path.Length; j += 2)
                {
                    M[path[j] - N] = path[j - 1];
                }
            }
        }
Ejemplo n.º 2
0
Archivo: WCBM.cs Proyecto: juhan/NModel
        //N-stages
        internal void stages()
        {
            bool[] fnodes=new bool[2*N]; //init with trues the second half
            for(int i=0;i<N;i++)
            {
                fnodes[N+i]=true;
            }
            GraphWithMatching graph=new GraphWithMatching(M,w,P,flatA,flatB);
            //IntBinaryHeapPriorityQueue pq=new IntBinaryHeapPriorityQueue(graph.NumberOfVertices);
            for(int i=0;i<N;i++)
            {

            //match i-th node
                SSMTSP spa=new SSMTSP(graph,i, fnodes /*,pq */);
                int[] path=spa.GetPath();
                int theClosestVertex=path[path.Length-1];
                int db0=spa.dist[theClosestVertex];
                fnodes[theClosestVertex]=false;
                //db0 gives the shortest reduced price cost path
                //fix potential
                for(int j=0;j<N;j++)
                {
                    int m=db0-spa.dist[j];
                    if (m>0)
                        P[j]-=m;

                    m=db0-spa.dist[N+j];
                    if(m>0)
                        P[N+j]+=m;
                }

                for(int j=1;j<path.Length;j+=2)
                {
                    M[path[j]-N]=path[j-1];
                }

            }
        }
Ejemplo n.º 3
0
 internal Edges(GraphWithMatching graph,int node)
 {
     this.node=node;this.graph=graph;
 }
Ejemplo n.º 4
0
 internal Edges(GraphWithMatching graph, int node)
 {
     this.node = node; this.graph = graph;
 }