亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? twolevel.w,v

?? Lin-Kernighan heuristic for the TSP and minimum weight perfect matching
?? W,V
?? 第 1 頁 / 共 5 頁
字號:
split left symmetric and I hope it works.Still fails on lin105.Revision 1.124  96/09/13  13:06:24  netoMore debugging output.Reach case 2 when psa=psb=0, psc=psd=1.  Mabye need to enforce 4 or moregroups?Revision 1.123  96/09/13  12:13:11  netoAdded updating of sequence numbers in Case 1.  Oops.Revision 1.122  96/09/13  11:54:30  netoMore checks of the twolevel data structure.Revision 1.121  96/09/12  16:46:05  netoMore debugging output. Somewhere, sequence numbers aren't properly beingmaintained.Revision 1.120  96/09/12  15:45:50  netoEnsure that modulus returns non-negative result in the important places.Revision 1.119  96/09/12  15:38:02  netoFixed debugging stuff a bit.Revision 1.118  96/09/12  14:18:09  netoFinished the redundancy code to check two-level trees.It compiles too, and catches an error in lin105.Revision 1.117  96/09/11  17:18:51  netoStarted adding debugging code.Revision 1.116  96/09/10  16:51:35  netoFixed problem in creating the data structure.  We need to compute a new group size internally.Revision 1.115  96/09/10  15:57:58  netoNow it compiles.  (Two minor errors regarding the normalization macro.)Revision 1.114  96/09/10  15:55:03  netoFixed the parent renumbering.It TeXs to my satisfaction.  We'll see if it compiles.Revision 1.113  96/09/09  17:06:05  netoFixed some of the problem with interening in parents.Need to fix the parent sequence number updating.Revision 1.112  96/09/06  16:03:10  netoFixed problem in flipping, case 1. We might have had portion b-d contained in a-c.Still a problem in parents.  See research notes.Also, need to add a comment about avoiding a performance bug inchoosing shorter sequence of parents.Revision 1.111  96/09/05  16:05:43  netoNow it compiles cleanly.Fixed precedence problems, vestiges of the ``city'' field, accessingwrong link array, variables declared twice, suggested parentheses, etc.Revision 1.110  96/09/05  15:37:22  netoFinished coding flipping.Revision 1.109  96/09/05  14:15:41  netoFixed outbound sibling pointers in city list reversal.Revision 1.108  96/09/05  12:53:55  netoCheck for case 1 after split c-d.Revision 1.107  96/09/04  17:14:23  netoFinished coding Case 3 of flipping.Revision 1.106  96/09/03  17:06:17  netoFinished coding case 1 in flip.Revision 1.105  96/09/03  15:45:52  netoMade city numbers implicit, as per first paragraph of p. 444 ofFredman et al.Revision 1.104  1996/08/30  21:28:38  davidMore of flip.Revision 1.103  1996/08/30  20:38:17  davidUse plain sequence numbers and still protect against wraparound.Revision 1.102  1996/08/30  20:28:16  davidLots and lots and lots of coding.Revision 1.101  1996/08/23  20:55:43  davidInitial revision.}@@*A two-level tree implementation of the oriented tour ADT.This module implements the oriented tour ADT using two-level trees.These were introduced by M.~L.~Fredman, D.~S.~Johnson, L.~A.~McGeoch,and G.~Ostheimer in {\sl Data Structures for Traveling Salesmen}, Journal of Algorithms, {\bf 18}, 432--479 (1995), (andan earlier conference paper).  @@^Fredman, M.~L.@@>@@^Johnson, D.~S.@@>@@^McGeoch, L.~A.@@>@@^Ostheimer, G.@@>That paper introduces three new data structures for the oriented tourADT: splay trees, two-level trees, and segment trees.  These threeare compared with the traditional array-based representation.  Some broad conclusions are drawn:below a thousand cities, arrays are the fastest; between a thousand  and a million cities, two-leveltrees are best; above a million, splay trees appear to win out.This module implements the oriented tour ADT in terms of two-level trees.Just like the \module{ARRAY} module, only one tour is supported at atime, although it shouldn't be too hard to make this code purely object-oriented.@@ Fredman \etal.~define an oriented tour abstract data type supportingthree queries and one update operation.  The most common and effectivelocal search algorithms for the traveling salesman problem ---2-opt, 3-opt, and Lin-Kernighan--- may all be implemented in terms of this abstraction.@@^oriented tour ADT@@>The oriented tour ADT consists of the following operations(I will use the names as implemented in this module, \ie, prepended bythe word |twolevel_|.):|twolevel_next(a)| is a query that returns the city that follows $a$ in thecurrent tour.|twolevel_prev(a)| is a query that returns the city that precedes $a$ in thecurrent tour.  It must be the case that |next(prev(a))==prev(next(a))==a|.|twolevel_between(a,b,c)| is a query that returns true or false.  It answersthe question:  ``In a forward traversal starting at city $a$, do we reachcity $b$ no later than city $c$?''|twolevel_flip(a,b,c,d)| updates the tour by replacing the edges $(a,b)$ and$(c,d)$ by the edges $(b,c)$ and $(a,d)$.  It assumes that |a==next(b)| and |d==next(c)|.  The orientation of the updated touris not specified.These four operations are the ones defined by Fredman \etal.  In fact, Ihave lifted these descriptions from that paper and lightly edited themfor inclusion here.  For convenience's sake, I also define |twolevel_set(int *t)|, whichsets the current tour to be the same as the array ofintegers |t|.  That is, city |i| in the tour is city |t[i]|.Note that we don't need a ``get'' routine because the tour can be read offby successively following |next| cities until we wrap to the startagain.We also define the standard setup and clean procedures: |twolevel_setup(int n, int seg_start_size)|and|twolevel_cleanup(void)|.  The parameters to the setup procedure is the numberof cities in the instance and the starting segment size (see below).@@ The outline of this module is as follows:@@c#include <config.h>#include "lkconfig.h"@@<System headers@@>@@;@@<Module headers@@>@@;@@<Module type definitions@@>@@;@@<Module variables@@>@@;@@<Module prototypes@@>@@;@@<Subroutines@@>@@;const char *twolevel_rcs_id="$Id: twolevel.w,v 1.144 1997/09/27 18:04:13 neto Exp neto $";@@ We will be using many routines from external libraries.  The interfacesto those routines are described in the following headers.@@<System headers@@>=#include <stdio.h>#include <stdlib.h>#include <stddef.h>@@ The exported interface is contained in the \file{twolevel.h} header file,which has the following form.@@(twolevel.h@@>=extern const char *twolevel_rcs_id;@@<Exported subroutines@@>@@;@@ To ensure consistency between the interface and the implementation,we include our own header.@@<Module headers@@>=#include "twolevel.h"@@*Two-level trees.A two-level tree on $n$ cities is much like a B+tree of degree $\sqrt{n}$.That is, the tour is stored as a linked list of cities.  They are clustered into into $\sqrt{n}$ segments of $\sqrt{n}$ cities each.Each segment is represented at the root level by aparent node. The roughly $\sqrt{n}$ parentnodes are themselves organized in a doubly linked list.To facilitate ordering comparisons, the parent nodes are given consecutivesequence numbers, and city nodes are given consecutive sequence numberswithin the context of their own segment.To facilitate quick reversals of large portions of the tour, each parent node has an associated reversal bit, indicating whether the citiesin the associated segment should are traversed from left to right or fromright to left.When the parent's reversal bit is off, succesive cities in the tourare found by following |next| pointers, encountering increasingsequence numbers within a segment. When the parent's reversal bit is on, succesive cities in the tourare found by following |prev| pointers, encountering decreasingsequence numbers within a segment. @@ The diagram of a two-level tree that Fredman \etal.\ provide include an explicitly stored city number inthe city nodes.  However, they say ---at the top of page 444--- thatthe city nodes are stored in an array and that therefore looking upthe city node from the city number can be done in constant time.  I take this to mean that they also save space by not explicitly storing the city number in the city node.  This should also speed thingsup by making more effective use of the cache and the communicationbandwidth betweenlevels of the memory hierarchy.@@ Here are the type definitions for a parent node, |parent_node_t|,and for a city node, |city_node_t|.  Parents point to the head and tailof their associated, segments.  Each city node points to its parent.In both kinds of nodes, sibling pointers are held in the |link| array;macros |next| and |prev| are just a shorthand for the next and previoussiblings, respectively.  Similarly, |head| and |tail| are abbreviationsfor access into the |city_link| array.(Here's a gotcha under AIX.  I used to use \CWEB/'s @@@@d facility tomake these preprocessor definitions.  But that puts the definitionsat the start of the \CEE/ file, before the includes.  But the |prev|macro conflicts with a \file{stdio.h} structure definition.  So I makethese definitions after the standard includes.  There is still a possibilitythat a macro, \eg\ |putchar|, might want to use the |prev| field in the \file{stdio} structure.  However, until I come across this problem, I'll stick to thecurrent solution.  I suppose I could use a |union| type to alias |prev| to |link[LINK_PREV]|, but that would make everything far uglier.)@@^system dependencies@@>@@<Module type definitions@@>=#define LINK_PREV 0#define LINK_NEXT 1#define prev link[LINK_PREV]#define next link[LINK_NEXT]#define CITY_LINK_HEAD 0#define CITY_LINK_TAIL 1#define head city_link[CITY_LINK_HEAD]#define tail city_link[CITY_LINK_TAIL]typedef struct parent_node_s {	int seq;	/* Sequence number.  Fredman \etal.\ call this |ID| */	int reverse;	/* Either 0 (forward), or 1 (reverse) */	struct parent_node_s *link[2];	struct city_node_s *city_link[2];} parent_node_t;typedef struct city_node_s {	struct parent_node_s *parent;	int seq;	/* Sequence number.  Fredman \etal.\ call this |ID| */	struct city_node_s *link[2];} city_node_t;@@ The city nodes and parent nodes will reside in statically allocatedarrays.  These are |city_node| and |parent_node|, respectively.%% We'll also need a mapping  from city numbers to city nodes.  This is done%% by the array |city_to_node|.  @@<Module variables@@>=static parent_node_t *parent_node=NULL;static city_node_t *city_node=NULL;@@ These variables get allocated in the setup routine.  We will be addingto this code later, so we separate it out in a new named section.@@<Subroutines@@>=voidtwolevel_setup(const int num_vertices, const int start_seg_size) {	@@<Set up the two-level data structure@@>@@;}@@ We also need a symmetrical tear down routine.@@<Subroutines@@>=void twolevel_cleanup(void) {	@@<Clean up the two-level data structure@@>@@;}@@ We must export these routines.@@<Exported subroutines@@>=void twolevel_setup(const int num_vertices, const int start_seg_size);void twolevel_cleanup(void);@@  We allocate these arrays using the |new_arr_of| macro from the \module{MEMORY} module.@@<Set up the two-level data structure@@>=city_node = new_arr_of(city_node_t,num_vertices);@@ We need the interface to the \module{MEMORY} module.    We'll also later dosanity checks using the macros from the \module{ERROR} module.@@<Module headers@@>=#include "error.h"#include "memory.h"@@ We use the |free_mem| macro to deallocate these arrays.@@<Clean up the two-level data structure@@>=free_mem(city_node);@@ There are at least two possible descriptions of the two-leveltree data structure.To derive goodworst-case time bounds, segment sizes are kept between $\sqrt{n}/2$ and$2\sqrt{n}$ cities via explicit balancing.   Under these conditions, the queries take constant time, and the |flip|update takes $O(\sqrt{n})$ time.However, the balancing required to achieve that worst-case timefor flips can be quite time consuming.  For practical purposes, Fredman \etal.~describe a variantwhere each segment starts out with roughly |groupsize| elements.Furthermore, explicit balancing is dispensed with in favour of implicit balancing with lower overhead .In the practical variant, queries remain constant time, but flips may degenerate to linear time.  However, Fredman \etal.~citethe conventional wisdom that data structures stay balanced in practice,so they expect this bad behaviour to be rare.We'll see later what implicit balancing entails, but for now wedeclare the |groupsize| variable.It will also be convenient to know the number of groups, |num_groups|.@@<Module variables@@>=static int groupsize, num_groups;@@ I'll leave the setting of |groupsize| to the main module; it's passedas a parameter to the setup routine.  However, Fredman \etal.'s experimentswere run with |groupsize==100| on instances of $10^3$ to $10^5$ cities,and |groupsize==200| on instances of $10^6$ cities.  For these million-cityinstances, this larger group size made each |flip| 27\% faster on average;performance was stable up to a group size of 800.Given an initial segment size of |groupsize|, there should be$\lfloor$|num_vertices/ groupsize|$\rfloor$ parent nodes.  @@<Set up the two-level data structure@@>=groupsize = start_seg_size;num_groups = num_vertices/groupsize;parent_node = new_arr_of(parent_node_t,num_groups);@@ While we're at it, let's  write down how we deallocate the |parent_node| array.@@<Clean up the two-level data structure@@>=free_mem(parent_node);@@ It will also be convenient to remember the number of cities; we'llstore it in the variable |n|.@@<Module variables@@>=static int n=0;@@ We set it at setup time. @@<Set up the two-level data structure@@>=n = num_vertices;@@ For defensiveness' sake, we'll put a garbage value into it at cleanup time.@@<Clean up the two-level data structure@@>=n = 0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产色综合久久不卡蜜臀| 日韩一区二区三区免费观看| 99麻豆久久久国产精品免费优播| 亚洲成人av福利| 国产精品三级av在线播放| 日韩一级在线观看| 91九色02白丝porn| www.一区二区| 国产麻豆精品一区二区| 午夜精品福利视频网站| 亚洲欧美日韩电影| 国产精品素人视频| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美三片在线视频观看| 91视频www| 成人app下载| 高清在线不卡av| 激情六月婷婷久久| 蜜桃91丨九色丨蝌蚪91桃色| 亚洲国产成人va在线观看天堂| 18欧美乱大交hd1984| 中文字幕不卡在线观看| 久久精子c满五个校花| 精品国产一区二区三区四区四| 777亚洲妇女| 欧美疯狂性受xxxxx喷水图片| 色天使色偷偷av一区二区| 国产成人精品免费看| 国产美女视频91| 激情久久五月天| 韩国视频一区二区| 久热成人在线视频| 裸体一区二区三区| 日韩精品一二三四| 日本成人在线网站| 日韩va亚洲va欧美va久久| 日韩精品久久理论片| 日日摸夜夜添夜夜添亚洲女人| 色88888久久久久久影院野外| 成人免费观看男女羞羞视频| 成年人网站91| 91香蕉国产在线观看软件| 色香蕉成人二区免费| 色中色一区二区| 在线观看区一区二| 欧美日韩不卡在线| 正在播放一区二区| 欧美一级久久久| 欧美人妇做爰xxxⅹ性高电影 | 91网站视频在线观看| 成人av网站在线观看免费| 成人黄色小视频在线观看| 国产成人精品免费一区二区| 成人av中文字幕| av在线不卡电影| 色噜噜偷拍精品综合在线| 欧美日韩午夜影院| 日韩视频免费观看高清在线视频| 精品国产伦一区二区三区免费 | 日韩精品久久久久久| 美日韩黄色大片| 国产成人h网站| 国产精品久久久久国产精品日日| 亚洲私人影院在线观看| 亚洲综合免费观看高清在线观看| 日韩影院精彩在线| 久久精品72免费观看| 盗摄精品av一区二区三区| 欧美中文字幕久久| 精品电影一区二区三区 | 国产精品日韩精品欧美在线| 亚洲人成精品久久久久| 轻轻草成人在线| 国产成a人无v码亚洲福利| 97成人超碰视| 日韩精品中文字幕一区二区三区| 久久久国产一区二区三区四区小说| 亚洲视频在线一区二区| 免费成人在线观看视频| 99视频精品在线| 欧美精品久久久久久久久老牛影院 | 久久成人久久爱| 福利91精品一区二区三区| 欧美三片在线视频观看| 久久精品综合网| 五月婷婷色综合| 成人免费视频一区二区| 51精品久久久久久久蜜臀| 欧美国产精品专区| 蜜桃久久精品一区二区| 91视频一区二区三区| 日韩美女一区二区三区| 一区二区欧美国产| 高清国产一区二区三区| 欧美日韩www| 亚洲视频在线一区| 国产精品 欧美精品| 欧美精品色一区二区三区| 17c精品麻豆一区二区免费| 美日韩一区二区三区| 91成人免费在线| 中文字幕不卡在线播放| 精品系列免费在线观看| 欧美日韩一区小说| 日韩美女视频一区| 国产乱码精品一区二区三| 欧美精品丝袜久久久中文字幕| **欧美大码日韩| 国产成人综合亚洲91猫咪| 欧美一区二区三区四区在线观看| 亚洲精品大片www| 99国产麻豆精品| 中文字幕第一区二区| 国产一区二区三区免费播放| 日韩一区二区影院| 日日摸夜夜添夜夜添国产精品| 91久久奴性调教| 一区二区在线观看免费| 94-欧美-setu| 国产精品美女一区二区在线观看| 国产一区二区三区在线观看免费视频| 欧美日韩在线不卡| 亚洲综合在线观看视频| 色婷婷久久久综合中文字幕| 亚洲欧洲性图库| 91视频www| 一区二区三区美女| 色综合久久99| 一区二区三区在线观看欧美| 91女神在线视频| 亚洲青青青在线视频| 99久久精品一区| 亚洲卡通欧美制服中文| 91同城在线观看| 一区二区高清免费观看影视大全| 91在线观看高清| 伊人色综合久久天天人手人婷| 91美女片黄在线观看| 亚洲男人的天堂在线观看| 色综合天天综合狠狠| 亚洲少妇30p| 欧美性高清videossexo| 午夜激情一区二区三区| 日韩一级成人av| 国产麻豆精品视频| 国产精品麻豆一区二区| 色综合色综合色综合| 亚洲综合色在线| 制服丝袜亚洲网站| 久久精品国产一区二区| 久久男人中文字幕资源站| 成人亚洲一区二区一| 亚洲欧洲av在线| 在线观看中文字幕不卡| 欧美bbbbb| 欧美激情艳妇裸体舞| 91香蕉国产在线观看软件| 亚洲成av人片| 精品国产伦一区二区三区免费| 国产成人午夜精品5599| 亚洲人成7777| 欧美一区二区三区免费在线看| 激情综合色综合久久综合| 国产日韩一级二级三级| 色婷婷精品大在线视频| 美女视频免费一区| 国产精品天干天干在观线| 91福利小视频| 国产乱子伦视频一区二区三区| 一区免费观看视频| 91精品国模一区二区三区| 国产精品一卡二| 亚洲一区二区三区视频在线| 日韩精品在线网站| 99国产精品久久久久久久久久 | 99精品视频一区二区三区| 亚洲大型综合色站| 久久久久久久久99精品| 日本丶国产丶欧美色综合| 国模套图日韩精品一区二区| 亚洲精品日韩一| 久久久久久久久久美女| 欧美日韩综合在线| 成人av手机在线观看| 视频一区视频二区在线观看| 国产精品日韩成人| 日韩一级片在线观看| 色天天综合色天天久久| 国产伦精品一区二区三区免费| 亚洲一二三级电影| 中日韩av电影| 日韩免费观看2025年上映的电影| 色综合夜色一区| 激情六月婷婷久久| 午夜国产精品一区| 国产精品欧美极品| 欧美成人一区二区| 欧美日本一区二区在线观看| 成人黄色电影在线| 韩日欧美一区二区三区|