此题遗传算法求解tsp问题。。。

此题求解_百度知道
baidu.hiphotos://e.hiphotos.hiphotos://e://e.com/zhidao/wh%3D450%2C600/sign=/zhidao/wh%3D600%2C800/sign=3e6f7adbc874b3f7b068097//zhidao/pic/item/908fa0ec08fa513daa4ffa0d3f6d55fbb3fbd978.baidu.jpg" target="_blank" title="点击查看大图" class="ikqb_img_alink"><img class="ikqb_img" src="http.jpg" esrc="http&<img class="ikqb_img" src="http.jpg" esrc="http&<a href="http
提问者评价
你的回答完美的解决了我的问题,谢谢!
来自:作业帮
其他类似问题
为您推荐:
其他3条回答
04×0.04平方厘米113.5=56.52平方厘米56.52×3÷9=186×6×3.14=113
已经想好了,采纳秒回
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁&&&&&&&&&很多童鞋对虚拟语气的用法了解过后,但在虚拟语气的一些专项练习题中却总是犯一些错误。我们为大家整理出来一些虚拟语气的专项练习题和解析。希望对大家有所帮助。
  专项练习一:
  1.I enjoyed the movie very much. I wish I _____ the book from which it was made.
  A. have read         B. had read
  C. should have read     D. are reading
  2.You are late. If you _____ a few minutes earlier, you _____ him.
  A. would meet     B. would have met
  C. will meet      D. would meet
  3.The two students talked as if they _____ friends for years.
  A. should be      B. would be
  C. have been      D. had been
  4.It is important that I _____ with Mr. Williams immediately.
  A. speak       B. spoke
  C. will speak     D. to speak
  5.He looked as if he _____ ill for a long time.
  A. was      B. Were C. has been   D. had been
  6.If the doctor had come earlier, the poor child would not _____.
  A. have laid there for two hours        B. have been lied there for two hours
  C. have lied there for two hours       D. have lain there for two hours
  7.I wish that I _____ with you last night.
  A. went      B. could go
  C. have gone   D. could have gone
  8.Let&s say you could go there again, how _____ feel?
  A. will you     B. should you
  C. would you     D. do you
  9.I can&t stand him. He always talks as though he _____ everything.
  A. knew            B. knows
  C. has known         D. had known
  10._____ the fog, we should have reached our school.
  A. Because of   B. In spite of
  C. In case of   D. But for
  11.If you had told me in advance, I _____ him at the airport.
  A. would meet       B. would had met
  C. would have met     D. would have meet
  12.Mike can take his car apart and put it back together again. I certainly wish he_____ me how.
  A. teaches          B. will teach
  C. has taught        D. would teach
  13.I would have told him the answer, had it been possible, but I _____ so busy then.
  A. had been       B. were
  C. was          D. would be
  14.He&s working hard for fear that he _____.
  A. should fall behind    B. fell behind
  C. may fall behind      D. would fallen behind
  15.If it _____ another ten minutes, the game would have been called off.
  A. had rained     B. would have rained
  C. have seen      D. rained
  16.He suggested that they _____ use a trick instead of fighting.
  A. should        B. would
  C. do          D. had
  17.My father did not go to New Y the doctor suggested that he _____ there.
  A. not went      B. won&t go
  C. not go       D. not to go
  18.I would have gone to the meeting if I _____ time.
  A. had had      B. have had
  C. had        D. would have had
  19.Would you rather I _____ buying a new bike?
  A. decided against   B. will decide against
  C. have decided     D. shall decide against
  20.You look so tired tonight. It is time you _____.
  A. go to sleep       B. went to sleep
  C. go to bed        D. went to bed
  21.&Why didn&t you buy a new car?
  &I would have bought one if I _____ enough money.
  A. had        B. have had
  C. would have    D. had had
  22.If she could sew, _____.
  A. she make a dress       B. she would have made a shirt
  C. she will make a shirt    D. she would had made a coat
  23._____ today, he would get there by Friday.
  A. Would he leave     B. Was he leaving
  C. Were he to leave    D. If he leaves
  24.His doctor suggested that he _____ a short trip abroad.
  A. will take     B. would take
  C. take        D. took
  25.The Bakers arrived last night. If they&d only let us know earlier,_____ at the station.
  A. we&d meet them       B. we&ll meet them
  C. we&d have met them     D. we&ve met them
  26.If I _____ you, I _____ more attention to English idioms and phrases.
  A. shall pay         B. will pay
  C. would pay      D. would pay
  27.We might have failed if you _____ us a helping hand.
  A. have not given     B. would not give
  C. had not given      D. did not give
  28.The law requires that everyone _____ his car checked at least once a year.
  A. has             B. had
  C. have            D. will have
  29.It is strange that he _____ so.
  A. would say      B. would speak
  C. should say     D. will speak
  30.Had I known her name, _____
  A. or does she know mine?      B. and where does she live?
  C. she would be beautiful.      D. I would have invited her to lunch.
  31.He has just arrived, but he talks as if he _____ all about that.
  A. know       B. knows
  C. known      D. knew
  32.If I _____ the money, I would have bought a much bigger car.
  A. possessed          B. owned
  C. had             D. had had
  33.He was otherwise, he _____ to the meeting.
  A. would come        B. came
  C. would have come     D. will come
  34.The librarian insists that John _____ no more books from the library before he returns all the books he has borrowed.
  A. will take           B. took
  C. take             D. takes
  35.I left very early last night, but I wish I _____ so early.
  A. didn&t leave       B. hadn&t left
  C. haven&t left       D. couldn&t leave
  36.I do not have a job. I would find one but I _____ no time.
  A. had             B. didn&t have
  C. had had           D. have
  37.I wish that you _____ such a bad headache because I&m sure that you would have enjoyed the concert.
  A. hadn&t      B. didn&t have had
  C. hadn&t had    D. hadn&t have
  38.He insisted that we all _____ in his office at one o&clock.
  A. be          B. to be
  C. would be       D. shall be
  39.Helen couldn&t go to France after all. That&s too bad. I&m sure she would have enjoyed it if _____.
  A. she&s gone        B. she&ll go
  C. she&d gone        D. she&d go
  专项练习二:
  1.His doctor suggested that he ______ a short leave of absence.
  A.will take   B.would take   C.take   D.took
  2.The job would require that ______ at 7 o'clock every morning.
  A.he will be at the factory   B.he be at the factory
  C.he was at the factory     D.he has been at the factory
  3.Your advice that she ______ till next week is reasonable.
  A.will wait   B.is going to wait   C.waits  D.wait
  4.The housemaster was strict.He requested that we ______ television on week nights.
  A.not watch               B.must not to watch
  C.not be watching            D.have not watched
  5.It is necessary that a worker ______ his work on time.
  A.accomplishes           B.can accomplish
  C.accomplish            D.has accomplished
  6.It is important that he ______ his decision before Friday.
  A.will make   B.makes   C.make   D.must make
  7.You look so tired. It's time you ______ .
  A.go to sleep    B.went to sleep
  C.go to bed     D.went to bed
  8.I'd rather you ______ anything about it for the time being.
  A.do   B.didn't do   C.don't   D.didn't
  9.But for water,it ______ impossible to live in the desert.
  A.is   B.was   C.were   D.wouldn't be
  10. ______ it______ for your help,I couldn't have made any progress.
  A.Hnot been           B.Snot been
  C.Dnot been           D.Nbe
  11.Long ______ the Party!
  A.lives   B.live    C.will live   D.should live
  12.Mary insisted that Tom ______ her the ring back.
  A.gives   B.give   C.given   D.have given
  13.My suggestion was that the meeting ______ off till next week.
  A.to put                 B.be put
  C.should put               D.be putting
  14.Mother suggested that I ______ my homework first before watching TV.
  A.did     B.do    C.shall do  D.have done
  15.He insisted that nothing ______ till he arrived.
  A.must be started                  B.ought to be started
  C.could be started                 D.should be started
  16.Tom suggests that Ann ______ the house.
  A.can sell   B.sells    C.sell    D.sold
  17.It's better that he ______ it from you.
  A.'ll hear    B.hears   C.should hear   D.heard
  18.It was necessary that he ______ about what had happened.
  A.be told    B.was told   C.should tell    D.tell
  19.It's astonishing that she ______ sad at news that it has nothing to do with her.
  A.felt   B.should feel   C.'ll feel    D.would feel
  20.It was strange that we ______ short of water in the country where it was always raining.
  A.are    B.be    C.should be    D.both B and C
  21.It is strange that she ______ marry such an ugly man.
  A.would   B.should    C.shall   D.must
  22.It's not right that the meeting ______ off till tomorrow.
  A.must be put   B.must put   C.will be put   D.be put
  23.It was impossible that he ______ the train, for he had started out very early.
  A.could have missed              B.must have missed
  C.should have missed              D.should miss
  24.It's a pity that he ______ such a good chance.
  A.should miss B.should have missed C.has missed D.all the above
  25.He tried to find some excuse for the debt, but I insisted that he ______ it off at once.
  A.must pay   B.ought to pay   C.paid   D.pay
  26.Mr. Ford insisted that he ______ right, though the others didn't think so.
  A.should do   B.should have done   C.had done   D.did
  27.His pale face suggested that he ______ the sad news.
  A.should be told     B.should have been told
  C.was told         D.had been told
  28.He suggested that we ______ here at once.
  A.should leave   B.must leave    C.left    D.ought to leave
  29.My order is that everyone ______ their own work in time.
  A.must complete   B.completed     C.completes    D.complete
  30.We've made the decision that we ______ at the school gate at 7 tomorrow morning.
  A.will gather       B.are about to gather
  C.would gather      D.should gather
  31.----I'll be waiting for you at home.
  ---- ______ I were busy and couldn't come?
  A.What if    B.What when   C. How if   D.How when
  32.After he was praised for what he had done, he said,&I ______ even better under harder conditions. &
  A.would do   B.would have done   C.did   D.had done
  33.It has been raining for a day, but even though it ______ , we ______ there by tomorrow.
  A.hadn't rained, couldn't get     B.hadn't rained, can't get
  C.didn't rain, couldn't get      D.didn't rain, can't get
  34.We could not have succeeded ______ your help.
  A.but for                      B.without
  C.if it had not been for              D.all the above
  35.I dare say he is not your true friend, because a true friend ______ differently when you were in trouble.
  A.acted    B.had acted C.would act   D.would have acted
  专项练习1:
  1&5 BBDAD       6&10 DDCAD          11&15 CDCAA     16&20 ACAAD
  21&25 DBCCC      26&30 DCCCD          31&35 DDCCB      36&39 DCAC
  解析:
  1.wish后面用虚拟语气,表示与过去事实相反用过去完成时。
  2.条件句表示与过去事实相反,主句用过去将来完成时,从句用过去完成时。
  3.as if后面如果表示真实情况就不用虚拟。
  4.It is important that是主语从句的虚拟语气,从句用sb. should do的形式。
  5.as if后面是真实情况,不虚拟。
  6.lain是lie的过去分词,表示&躺&。
  7.could have done表示&本来可以&。
  8.与将来相反的虚拟语气,主句用过去将来时。
  9.as if表示不可能发生的事情时用虚拟语气。
  10.but for表示&要不是&&的话&,通常与虚拟语气搭配使用。
  11.in advance表示&事先&,表示与过去事实相反的虚拟语气。
  12.wish的宾语从句表示发生在将来的愿望用过去将来时。
  13.but的并列句表示真实情况,不用虚拟语气。
  14.for fear that后面的状语从句用sb. should do的形式。
  15.表示与过去事实相反,主句用过去将来完成时,从句用过去完成时。
  16.suggest后面的宾语从句用sb. should do的形式。
  17.suggest后面的从句用sb. should do的形式,should可以省略。
  18.表示与过去事实相反,从句用过去完成时。
  19.would rather的宾语从句用sb. did的形式。
  20.It is time后面的定语从句用sb. did的形式。
  21.第一个had是过去完成时,第二个had表示&有&。
  22.would have done是过去将来完成时,表示与过去相反的虚拟语气。
  23.这是虚拟语气的倒装形式,把if去掉,助动词提前。
  24.suggest后面的从句用sb. should do的形式,should可以省略。
  25.表示与过去事实相反,主句用过去将来完成时。
  26.在虚拟语气中,不管什么人称,be动词都要用were的形式。
  27.表示与过去事实相反,从句用过去完成时。
  28.require后面的从句用sb. should do的形式,should可以省略。
  29.It is strange that是主语从句的虚拟语气,从句用sb. should do的形式。
  30.had I known是与过去相反的虚拟语气的倒装形式。
  31.as if表示不可能发生的事情时用虚拟语气。
  32.第一个had是过去完成时,第二个had表示&有&。
  33.otherwise经常可以搭配虚拟语气,表示与过去事实相反。
  34.当insist表示&坚持认为&时不用虚拟形式。
  35.wish后面用虚拟语气,表示与过去事实相反用过去完成时。
  36.but的并列句表示真实情况,不用虚拟语气。
  37.wish后面用虚拟语气,表示与过去事实相反用过去完成时。
  38.当insist表示&坚持要求&时从句用虚拟形式。
  39.表示与过去事实相反,从句用过去完成时。
  专项练习2: 参考答案:
  1.C  2.B  3.D   4.A  5.C
  6.C  7.D  8.B   9.D  10.A
  11.B 12.B  13.B  14.B
  15. D insist作&要求别人做某事&解,其宾语从句用should型虚拟语气。
  16. C 这种should型虚拟语气,有时可将should省略,因此,C项的sell不能有人称变化。
  17.C 本句话有&要求&的意思,故选C。
  18. A C、D为主动,在此不妥。
  19. B 选B表示了说话人带有一种十分惊讶的感情,选A项与she的人称不相一致,是错的。参见本章语法说明。
  21.B should带有感情色彩。
  22.D 本句带有要求之意,故从句谓语用should型虚拟语气。D项中的should被省略。
  23.C 本句带有惊讶之意,故从句须用should型虚拟语气。但由于是过去的事情所产生的惊讶,所以用should+不定式完成式。
  24.D 如选A,这表达了说话人对将来的事所发出的感叹,选B则是对已经过去的事情的感叹。选C则是一个直陈语气,即说话人对此并不一定感到十分惋惜,而是对此事的陈述。
  25.D insist在作&坚持要求别人做某事&时,需要用should型虚拟语气,should也可以省略。
  26.C insist在作&坚持自己的观点、看法等&解时,不需要用虚拟语气,所以A、B两项用在此处不当。D项时态不准确,故也应排除。
  27.D suggest作建议解时,后接了should型虚拟语气,但在本句中作&表明&解,这时不用虚拟语气,A、B两项都应排除,C项时态不当。
  28.A 在本句中suggest作&建议&解,故选A。
  29.D &建议&、&命令&、&要求&等动词的名词形式做主语时,其表语从句也须用should型虚拟语气,本句中的should被省略。
  30.D &建议&、&命令&、&要求&等动词的名词形式做主语时,后接同位语从句时也须should型虚拟语气。
  31.A What if&?常用于省略疑问句,既可以用于虚拟语气,也可用于直陈语气。本句不省略的形式为What would you do if。
  32.B 本句的under引出一个非真实的条件,当然也可以是真实条件。根据上下文,应理解为与过去事实相反,故其谓语动词用would have done。
  33.B even though=even if意为&即使&。它同if一样可以引出一个真实的让步从句,也可以引出一个非真实的让步从句。根据上文,even though是一个非真实的与过去事实相反的让步从句。而主句we can't get there却是一个真实的情况。
  35.D 从全句的意思分析,a true friend-differently实际上是指一种假设,而when引导的从句又告诉我们,这是一个与过去事实相反的假设,故用would have acted。
语法不用“afraid"
之一般将来时基本用法详解
必背单词(1)
:同义词辨析
之短语动词
258元外教一对一试听课
新一代年轻英语学习方式!
扫描二维码关注线话&#xe621; 上传我的文档
&#xe602; 下载
&#xe60c; 收藏
该文档贡献者很忙,什么也没留下。
&#xe602; 下载此文档
正在努力加载中...
线性代数课后习题答案全)习题详解
下载积分:1800
内容提示:线性代数课后习题答案全)习题详解
文档格式:DOCX|
浏览次数:16608|
上传日期: 01:17:20|
文档星级:&#xe60b;&#xe60b;&#xe60b;&#xe60b;&#xe60b;
该用户还上传了这些文档
线性代数课后习题答案全)习题详解
官方公共微信求解此题!_noip吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:15,370贴子:
求解此题!收藏
From Admin ☆建造城市
背景 Background
清北学堂杯NOIP模拟赛第一道
描述 Description
某城镇城市由n个村落{S1, S2, …, Sn }组成,且已建造n-1条道路证所有村落之间均有通路。市政府最近正在规划建立一座大型超市,其选址应尽可能缩短村民到该超市的距离。
这里,联接于村落S_i与村落S_j之间通路所经过道路的数目,即它们之间的距离,记作&Si,Sj&。
图1. 城镇实例:dist(A, C) = 2, dist(A, D) = 3, dist(D, E) = 2
另外,鉴于各村落中居住人口的规模差异很大,因此在评估距离时还应顾及这一因素。于是,若用将村落Si 的人口规模记作|Si|,则选址于村落Sj的代价可表示为: cost(Sj)= ∑dist(Si,Sj)*|Si|
输入格式 Input Format
共2n 行:第一行为一个正整数n,表示村落的数目;第2 至n+1 行:依次为各村落的人口规模|Si|, 1&= i &= n;第n+2 至2n 行:每行为以空格分隔的两个正整数i 和j,表示村落Si与村落Sj之间建有一座道路。
输出格式 Output Format
只有一行:为正整数m,表示选址于村落Sm 代价最小。若这样的村落有多个,输出其中编号最小者。
样例输入 Sample Input [复制数据]
样例输出 Sample Output [复制数据]
时间限制 Time Limitation
各个测试点1s
60% 数据 n&=100000100% 数据 n&=&=|Si|&=10000;1&=i&=n
算出把树中的节点i弃掉后所有子树总人数最大值的最小值f[i]即可、答案就是f[i]最小且标号最小的那个、证明: 假设我们已经找到这样一个点、那么以这个节点为根建树、假设有更优解、那么一定在其中一个子树里、i)若在最大的子树里、那么就和假设矛盾了、ii)若不在最大的子树里、那么它所增加的代价一定比减少的大、
(因为肯定是大的子树加的代价多啊)所以、这么做是正确的、然后我们树形dp一下就可以了(实际上这根本算不上dp)注意! __int64! 常数!
中国移动4G用户跃3亿!新春感恩大聚惠! 快来参加!
下面那个是题解,没看懂!什么是“子树总人数最大值的最小值f[i]”谁能举个例子?!
这个可以o(n)算出所有城市的代价..
肯定要On 的,但是我求算法!
怎么做?!
那题解什么意思啊?!
这个题解我也看不懂- -2次treedp即可..以任意节点为根,遍历树,f[i]记录每个节点的子树的节点数.然后在dp一次.然后从节点u 转移到 节点v..相当于节点v的子树到建造地点深度小了1,而非v的子树则增加了1.这样可以实现O(1)的转移.然后就行了
曾经的RO伙伴!
先自底向上搞一遍再自顶向下搞一遍~然后暴力搞一个最好的出来就行了
为何要从上再从下搞一次? 怎么搞? 说明白点OK?! 谢谢!
自底向上就是先求以该节点为根的子树的代价和人口和然后再自顶向下求在该节点修建super market的代价。这个需要用到前面求出来的数据加加减减。然后把第二次求出来的找最优。
其实不需要的。。。我后来想了个On 的算法,先计算所有点的人口和 S 然后先随便选一个点建树,假设目前考虑的最优解是 root ,能否更新是 考察 每一个子树人口后 s[i] ,if s[i]&=(s / 2) then dfs(s[i]); 去等条件是要那个新节点号数比root下 On
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或

我要回帖

更多关于 蚁群算法求解tsp问题 的文章

 

随机推荐