コード例 #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];
                }
            }
        }
コード例 #2
0
ファイル: WCBM.cs プロジェクト: 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];
                }

            }
        }
コード例 #3
0
ファイル: MatchingFSM.cs プロジェクト: juhan/NModel
 internal Edges(GraphWithMatching graph,int node)
 {
     this.node=node;this.graph=graph;
 }
コード例 #4
0
ファイル: MatchingFSM.cs プロジェクト: philscrace2/NModel
 internal Edges(GraphWithMatching graph, int node)
 {
     this.node = node; this.graph = graph;
 }