Dueckrewrite规则

rewrite规则  时间:2021-01-12  阅读:()
Acompletealgorithmtosolvethegraph-coloringproblemHubertoAyaneguiandAlbertoChavez-AragonFacultaddeCienciasBasicas,IngenieriayTecnologia,UniversidadAutonomadeTlaxcala,CalzadadeApizaquitos/n,Apizaco,Tlaxcala,Mexico{hayanegui,albertochz}@gmail.
comAbstract.
TheGraphk-ColorabilityProblem(GCP)isawellknownNP-hardproblemwhichconsistinfindingthekminimumnumberofcolorstopainttheverticesofagraphinsuchawaythatanytwoverticesjoinedbyanedgehavealwaysdifferentcolors.
Manyyearsago,SimulatedAnnealing(SA)wasusedforgraphcoloringtaskobtaininggoodresults;howeverSAisnotacompletealgorithmanditnotalwaysgetstheoptimalsolution.
InthispaperGCPistransformedintotheSatisfiabilityProblemandthenitissolvedusingaalgorithmthatusestheThresholdAcceptingalgorithm(avariantofSA)andtheDavis&Putnamalgorithm.
Thenewalgorithmisacompleteoneandsoitgetsbetterqualitythattheclassicalsimulatedannealingalgorithm.
Keywords:graphcoloring,simulatedannealing,thresholdaccepting,davis&putnam.
1IntroductionLetG=(V,E)beagraphwhereVisasetofverticesandEisasetofedges.
Ak-coloringofGisapartitionofVintoksets{V1,…,Vk},suchthatnotwoverticesinthesamesetareadjacent,i.
e.
,ifv,wbelongtoVi,1ik,then(v,w)notbelongtoE.
Thesets{V1,…,Vk}arereferredtoascolors.
Thechromaticnumber,x(G),isdefinedastheminimumkforwhichGisk-colorable.
TheGraphk-ColorabilityProblem(GCP)canbestatedasfollows.
GivenagraphG,findx(G)andthecorrespondingcoloring.
GCPisaNP-hardproblem[1].
GCPisveryimportantbecauseithasmanyapplications;someofthemareplanningandschedulingproblems[2][3],timetabling[4],mapcoloring[5]andmanyothers.
SinceGCPisaNP-hardproblem,untilnowtherearenotknowndeterministicmethodsthatcansolveditinapolynomialtime[1].
Sonon-deterministicalgorithmshavebeenbuilttosolveit;oneofthemisSimulatedAnnealing(SA)[6]thathasbeenusedonGCPwithgoodresults[7][8].
However,SAisnotacompletealgorithmanditnotalwaysgetstheoptimalsolution.
TheapproachusedinthispaperistotransformGCPintoaSatisfiabilityProblem(orSATproblem)[12]andthenusethealgorithmproposedinthispaper.
WeproposetouseiterativelytheThresholdAccepting(TA)algorithm(avariantofSimulatedAnnealing)[9]andthenaDavisandPutnamalgorithm[10].
2SimulatedannealingandthresholdacceptingSimulatedannealing(SA)[6]isastochasticcomputationaltechniquederivedfromstatisticalmechanicstofindnearglobal-minimum-costsolutionstolargeoptimizationproblems.
Inmanyinstances,findingtheglobalminimumvalueofanobjectivefunctionwithmanydegreesoffreedomsubjecttoconflictingconstraintsisanNP-completeproblem,sincetheobjectivefunctionwilltendtohavemanylocalminimums.
Aprocedureforsolvingoptimizationproblemsofthistypeshouldsamplethesearchspaceinsuchawaythatithasahighprobabilityoffindingtheoptimaloranear-optimalsolutioninareasonabletime.
Overthepastdecade,SAhasproventobeapowerfultechniquethatmeetsthesecriteriaforawiderangeofproblems.
SAexploitsananalogybetweenthewayametalcoolandfreezesintoaminimumenergycrystallinestructure(theannealingprocess)andthesearchforaminimuminamoregeneralsystem.
SAmakesarandomsearchwhichnotonlyacceptschangesthatincreaseitscostfunctionf,butalsosomethatdecreaseit.
Forthisreason,SAusesacontrolparameterc,whichbyanalogywiththeoriginalapplicationisknownasthe"SystemTemperature",cstartsouthighandgraduallydecreases.
AdeterioratingrandommovefromsolutionSitoSjisacceptedwithaprobabilityexp-(f(Sj)-f(Si))/c.
Ifthismoveisnotdeteriorating(thenewsolutionSjisbetterthanthepreviousoneSi)thenitisacceptedandanewrandommoveisproposedagain.
Whenthetemperatureishigh,abadmovecanbeaccepted.
Asctendstozero,SAbecomesmoredemandingthroughacceptjustbettermoves.
Thealgorithmforminimizationisshownbelow:ProcedureSIMULATEDANNEALINGBeginINITIALIZE(Si=initial_solution,c=initial_temperature)k=0RepeatRepeatSj=PERTURBATION(Si)IfCOST(Sj)random[0,1)ThenSi=SjUntilstochasticequilibriumk=k+1c=COOLING(c)UntilthermalequilibriumEndTheINITIALIZEfunctionstartstheinitialsolutionSiandtheinitialtemperaturec.
ThePERTURBATIONfunctionmakesarandomperturbationfromSitogenerateaneighborhoodsolutionSj.
TheCOSTfunctiongetsthecostfromasolution.
TheINC_COSTfunctiongetsthedifferenceincostbetweenSjandSi.
Finally,theCOOLINGfunctiondecreasestheactualtemperatureparameterc.
AvariantofSimulatedAnnealing(SA)istheThresholdAcceptingmethod(TA).
ItwasdesignedbyDueck&Scheuer[9]inordertogetamoreefficientalgorithmthanSimulatedAnnealing.
Theprincipaldifference,betweenSAandTA,isthemechanismofacceptingthesolutionrandomlychosenfromthesetofneighborsofthecurrentsolution.
WhileSAusesaprobabilisticmodel(seeequation(1)),TAusesastaticmodel:ifthedifferencebetweenthecostvaluesofthechosensolutionSjandthecurrentoneSiissmallerthanathresholdT(ortemperature),TAacceptsmovingtothechosensolution.
Otherwiseitstaysatthecurrentsolution.
Again,thethresholdparameterTisapositivecontrolparameterwhichdecreaseswithincreasingnumberofiterationsandconvergestovaluenearto0.
Henceforth,ineveryiterationsomesolutiondeteriorationareallowed;thisdeteriorationdependsonthecurrentthresholdT(seeequation(2));inthiswayonlyimprovingsolutionswithalmostnonedeteriorationsolutionareacceptedattheendoftheprocess.
p(S1,S2)=exp(min{f(S1)-f(S2),0}/c)(1)COST(Sj)ThiscouldbebecauseTAdoesnotcomputetheprobabilisticfunction(1)anddoesnotexpendalotoftimemakingrandomdecisions.
TheThresholdAcceptingalgorithmforminimizationisthefollowing:ProcedureTHRESHOLDACCEPTINGBeginINITIALIZE(Si=initial_solution,T=initial_thresholdortemperature)k=0RepeatRepeatSj=PERTURBATION(Si)E=COST(Sj)–COST(Si)IfESALAusesSimulated-annealingapproachwithtwomainloops:internalloopnamedMetropolisCycleandexternalloopcalledTemperatureCycle.
Numberofiterationsininternalandexternalloopusuallyaretunedexperimentally[6],[9].
However,recentlyananalyticalmethodusingaMarkovmodelwasproposedtotuneTAsolvingSATproblems.
ExternalloopexecutedfromainitialtemperatureTiuntilafinaltemperatureTfandtheinternalloopbuildsaMarkovchainoflengthLkwhichdependsonthetemperaturevalueTk(krepresentsthesequenceindexinTemperaturecycle).
AstrongrelationexistsbetweenTkandLkinawaythat:IfTk,Lk0andifTk0,Lk.
(3)DuetoTAisappliedthroughaneighborhoodstructure,V,(PERTURBATIONfunctionmakesarandomperturbationfromSitogenerateaneighborhoodsolutionSj),themaximumnumberofdifferentsolutionsthatcanberejectedfromSiisthesizeofitsneighborhoods,|VSi|.
ThenthemaximumlengthofaMarkovchaininaTAalgorithmisthenumberofsamplesthatmustbetakeninordertoevaluateanexpectedfractionofdifferentsolutionsfromVSiatthefinaltemperatureTf,thisis:Lf=C|VSi|.
(4)whereCvariesfrom1C4.
6(explorationfrom63%until99%),LfisthelengthoftheMarkovchainatTf.
From(3),LkmustbeincrementedinasimilarbutinversewaythatTkisdecremented.
ThenforthegeometricreductioncoolingfunctionusedbyKirkpartick[6],andDueckandScheuer[9],Tk+1=Tk.
(5)theincrementalMarkovchainfunctionmustbe:Lk+1=Lk.
(6)where=exp((lnLf–lnLi)/n).
(7)Here,LiisthelengthoftheMarkovchainatTi,usuallyLi=1,andnisthenumberoftemperaturestepsfromTitoTfthrough(5).
Now,themaximumandminimumcostincrementproducedthroughtheneighborhoodstructureare:ZVmax=Max{COST(Sj)–COST(Si)}.
(8)ZVmin=Min{COST(Sj)–COST(Si)}.
(9)forallSjVSi,andforallSiSThenTiandTfmustbecalculatedas:Ti=ZVmax.
(10)TfZVmin.
(11)ThiswayofdeterminingtheinitialtemperatureenableTAtoacceptanypossibletransitionatthebeginningoftheprocess,sinceTiissetasthemaximumdeteriorationincostthatmaybeproducedthroughtheneighborhoodstructure.
Similarly,TfenablesTAtohavecontroloftheclimbingprobabilityuntilthealgorithmperformsagreedylocalsearch.
3Davis&PutnamMethodSatisfiablityProblem[12](orSAT)isveryimportantincomplexitytheory.
Letbeapropositionalformulalikeformula(12):F=F1&F2&…&Fn(12)whereeveryFiisadisjunction.
EveryFiisadisjunctionofpropositionalformulassuchasX1vX2v.
.
vXr.
EveryFiisaclauseandeveryXjisaliteral.
Everyliteralcantakeatruthvalue(0orfalse,1ortruth).
InSatisfiabilityproblemasetofvaluesfortheliteralsshouldbefound,insuchawaythattheevaluationof(12)betrue;otherwiseif(12)isnottrue,wesaythatFisunsatisfiable.
Besideswesaythat(12)isinConjunctiveNormalFormorCNF.
TheDavis&Putnammethodiswidelyregardedasoneofthebestdeterministicmethodsfordecidingthesatisfiability[12]ofasetofpropositionalclauses[10].
Itisalsoacompleteresolutionmethod.
Thisprocedurecallsitselfafterrewritingtheinputformulaaccordingtoanumberofrulesforgeneratingasmallerformulawiththesametruthvalue.
TherulesusedfortheDavis&Putnammethodare:Rule1:iftheinputformulahasnoclauses,thenitissatisfiableRule2:ifithasaclausewithnoliterals,itisunsatisfiableRule3:ifithasaclausewithexactlyoneliteral,thenmaketheliteraltrueandrewritetheformulaaccordinglyRule4:ifsomevariableappearonlypositivelyornegatively,thenpickonesuchvariableandassignavaluetoittomaketheliteraltrue,andrewritetheformulaaccordinglyIfnonerulecouldbeapplied,onepicksupanarbitraryvariableasabranchingpointandtwonewformulasarederivedbyassigning0and1tothisvariable.
Ifoneofthecallsreturnswiththepositiveanswertheinputissatisfiable;otherwise,itisunsatisfiable.
TheDavis&Putnamalgorithmisshownbelow:FunctionDAVIS-PUTNAM(Informula:clauseslist)BeginREDUCE(formula,vreduce)IfformulaisemptyThenReturnvreduceElseIfformulahasaclausewithnoliteralsThenReturnfailElseChoosealiteralVfromformulavaluation=DAVIS-PUTNAM(SUBSTITUTION(true,V,formula))Ifvaluation!
=failThenReturnADD(V=true,vreduce,valuation)valuation=DAVIS-PUTNAM(SUBSTITUTION(false,V,formula))Ifvaluation!
=failThenReturnADD(V=false,vreduce,valuation)ReturnfailEndifEndDAVIS-PUTNAMFunctionSUBSTITUTION(TF,V,formula)BeginForEachoneclauseCInformulaDoIf[CcontainVandTF=true]or[Ccontain~VandTF=false]ThendeleteCfromformulaElseIf[CcontainVandTF=false]or[Ccontain~VandTF=true]ThendeleteVfromCEndifEndforReturnformulaEnd_SUBSTITUTIONFunctionREDUCE(InOut:formula,vreduce)Beginvreduce=emptyWhileexistsclauseCInformulawithexactlyoneliteralLIfLispositivevariableVThenformula=SUBSTITUTION(true,V,formula)vreduce=CONS(V=true,vreduce)ElseIfLisnegativevariableVThenformula=SUBSTITUTION(false,V,formula)vreduce=CONS(V=false,vreduce)EndifEndwhileReturn(formula)End_REDUCETheDAVIS-PUTNAMfunctionisthemainfunctionanditselectsrandomlyaliteraltosetatrueagroupofvaluesinordertocreateunitaryclauses.
Ifthattruesetvaluesisnotthecorrectsolutionthecomplementsetoftruevaluesistried.
Ifthenewassignmentisneitherasatisfiablesolution,thentheformulaisunsatisfiable.
ThefunctionSUBTITUTIONmakesthepropagationofoneliteraloveralltheclausesinformula,deletingclauseswhereoccursthepositiveliteralLanditsvalueis1(true).
Thereforetheclauseswhere~Loccurscandeletethatliteral.
TheREDUCEfunctioncarriesoutthesearchofunitaryclauses,sothatitcanbepossiblepropagatethroughthefunctionSUBSTITUTION.
4GraphColoringthroughAcceptingandDavis&PutnamInformallycoloringagraphwithkcolorsorGraphk-ColorabilityProblem(GCP)isstatedasfollows:IsitpossibletoassignoneofkcolorstoeachnodeofagraphG=(V,E),suchthatnotwoadjacentnodesbeassignedthesamecolorIfanswerispositivewesaythatthegraphisk-colorableandkisthechromaticnumberx(G).
ItispossibletotransformGraphk-ColorabilityProblem(GCP)intoSatisfiabilityproblem(SAT);thatmeansthatforagivengraphG=(V,E)andanumberk,itispossibletoderiveaCNFformulaFsuchthatFissatisfiableonlyinthecasethatGisk-colorable.
TheformulationofGCPasSATismadeassigningXBooleanvariablesasfollow:1)TakeeverynodeandassignaBooleanvariableXijforeverynodeiandcolorj;thedisjunctionofallthesevariables.
Inthiswayeverynodewillhaveatleastonecolor.
Therefore,inthecaseoffigure1,wehavetheclauses:Node1:X11vX12vX13vX14Node2:X21vX22vX23vX24Node3:X31vX32vX33vX34Node4:X41vX42vX43vX442)Toavoidthefactthatanodehasmorethatonecolor,addtheformulaXij~Xik3)Inordertobesurethattwonodes(Vi,Vj)connectedwithanarchavedifferentcolors,addaclausesuchthatifVihascolork,Vjshouldnotbecolorwiththiscolor.
ThisclauseiswritingasXik~Xjk.
4)Inordertoknowwhichnodesareconnectedwithanedge,anadjacentmatrixAofthegraphisneeded;itselementsare:1ifiisconnectedwithjAij=0otherwiseFig.
1.
GraphcoloringexampleThereductionofagraphtotheConjunctiveNormalForm(CNF)generatessomanyclausesevenforsmallgraphs.
Forexample,forafullgraphwith7nodes(42edges),308clauseswith98literalscanbegenerated.
IfweuseDavis&Putnamalgorithmtocoloragraph,wecouldstartcoloringwithRcolors(thegraph'sdegreeorfromanumbergiven).
Ifitisnotpossibletocolorit,thenwecanincreaseRandtryagain.
Duetofindalargechromaticnumberx(G)isaveryhardtaskforacompletemethodasDavis&Putnam(itdemandsmanyresources),weneedanincompletemethodtohelpinthistask.
ForthisreasonwehavechosentheThresholdAcceptingmethod.
TAwillsearchthechromaticnumber,butasitisknownTAnotalwaysgettheoptimalsolution.
Bythisreason,thenumberfoundbyTAissendtoaDavis&Putnamprocedure,andthisonewillgettheoptimalsolution.
Thecompleteprocessisshowninthefigure2.
Fig.
2.
DescriptionofthecoloringprocessAnygraphcanbecoloredwithGmax+1colors,whereGmaxrepresentsthegraphdegree.
Forthisreason,TAwilltrycoloringwithGmaxcolors.
IfTAgetsasuccess,thenTAwilltrytocolorwithGmax-1,andsoon.
WhenTAfinishes,itsendstotheoutputtheminimumkofcolorsfounded.
Inothercase,whenTAcannotcolorwithGmaxcolors,thenitwillsendk=Gmax+1toDavis&Putnamprocedure.
Fig.
3.
BinarypartitionsDavis&Putnamwillattempttodecreasethevalueofkthroughbinarypartitions.
Thefirstattempt,Davis&Putnamwillchoosethenumberofcolorsgivenby(1+k)/2.
Ifthecoloringisright,itwillcolorwith(1+(1+k)/2)/2colors,i.
e.
,thelefthalf.
Otherwise,thealgorithmwillcolorwith((1+k)/2+k)/2colors,therighthalf.
ThisprocesscontinuesuntilDavis&Putnamcannotdecreasek.
So,thechromaticnumberwasfound.
Thissituationisshowninfigure2.
Thefigure3showsanexamplewhereTAfoundthenumbernineasitsbettersolutionanditissendtoDavis&Putnamprocedure.
WhenDavis&PutnamtakesthelastTAsolution,usingbinarypartitionsandotherrulestheoptimalsolutioniswaited.
Forexampleinthecaseofthefigure3,ifDavis&Putnamcannotcolorwithfivecolors,itmovestootheralternative,tryingwithsevencolors.
Finally,inthelastpartition,i.
e.
(7+9)/2,cannotcolorthegraphandsotheresultisachromaticnumberequaltonine.
5ConclusionInthispaperwepresentedanalgorithmbasedonThresholdAcceptingandDavis&Putnam,tosolvetheGraphk-ColorabilityProblem.
BecausethisproblemisanNP-hardproblemthereisnotaknowndeterministicefficient(polinomial)method.
Non-deterministicmethodsareingeneralmoreefficientbutanoptimalsolutionisnotguarantee.
Thismethodisanewalternativethatpromisestobemoreefficientthatthepreviousones.
Themaincontributionsofthispaperareenumeratedbelow.
1)Weproposedawaytotransformthegraphk-colorabilityproblemintoasatisfiabilityproblem.
2)InordertosolvetheformerproblemweproposedanewapproachwhichmakesuseofthethresholdacceptingandDavis&Putnamalgorithms.
3)Theresultingalgorithmiscompleteandusingitwecangetbetterresultsthatthewell-knownsimulatedannealingalgorithm.
References1.
Garey,M.
R.
andJohnson,D.
S.
,ComputersandInteractability:AGuidetotheTheoryofNP-Completeness,Freeman,SanFrancisco,1979.
2.
Stecke,K.
,DesignPlanning,SchedulingandControlProblemsofFlexibleManufacturing,AnnalsofOperationsResearch,Vol.
3,1985,pp.
3-12.
3.
Leighton,F.
T.
,AGraphColoringAlgorithmforLargeSchedulingProblems,J.
Res.
Nat.
Bur.
Standard,Vol.
84,No.
6,1979,pp.
489-506.
4.
Wood,D.
C.
,ATechniqueforColoringaGraphApplicabletoLargeScaleTimetableProblems,ComputerJournal,Vol.
12,1969,pp.
317-322.
5.
Brelez,D.
,NewMethodstoColorVerticesofaGraph,Comm.
ACM,Vol.
22,1979,pp.
251-256.
6.
Kirkpatrick,S,Gelatt,C.
D.
,Vecchi,M.
P.
,OptimizationbySimulatedAnnealing,Science,No.
220,1983,pp.
671-680.
7.
Chams,M.
,A.
HertzandD.
deWerra,SomeExperimentswithSimulatedAnnealingforColoringGraphs,EuropeanJournalofOperationalResearch,Vol.
32,1987,pp.
260-266.
8.
Johnson,D.
S.
,Aragon,C.
R.
,McGeoch,L.
A.
,Schevon,C.
,OptimizationbySimulatedAnnealing:AnExperimentalEvaluation;PartII:GraphColoringandNumberPartitioning,Oper.
Res.
,No.
39,1991,pp.
378-406.
9.
DueckGunter,ScheuerTobias,ThresholdAccepting:AGeneralPurposeOptimizationAlgorithmAppearingSuperiortoSimulatedAnnealing.
JournalofComputationalPhysics,No.
90,1990,pp.
161-175.
10.
M.
DavisandH.
Putnam,AComputingProcedureforQuantificationTheory.
JournaloftheAssociationforComputingMachinery,Vol.
7,No.
1,1960,pp.
201-215.
12.
ScienceandTechnologyCenterinDiscreteMathematicsandTheoreticalComputerScience,"SatisfiabilityProblem:TheoryandApplications",DimacsSeriesinDiscreteMathematicsandTheoreticalComputerScience,Editors:JunGu,PanosPardalos,Ding-Zhu.

wordpress高级跨屏企业主题 wordpress绿色企业自适应主题

wordpress高级跨屏企业主题,通用响应式跨平台站点开发,自适应PC端+各移动端屏幕设备,高级可视化自定义设置模块+高效的企业站搜索优化。wordpress绿色企业自适应主题采用标准的HTML5+CSS3语言开发,兼容当下的各种主流浏览器: IE 6+(以及类似360、遨游等基于IE内核的)、Firefox、Google Chrome、Safari、Opera等;同时支持移动终端的常用浏览器应...

PIGYun中秋特惠:香港/韩国VPS月付14元起

PIGYun发布了九月份及中秋节特惠活动,提供8折优惠码,本月商家主推中国香港和韩国机房,优惠后最低韩国每月14元/中国香港每月19元起。这是一家成立于2019年的国人商家,提供中国香港、韩国和美国等地区机房VPS主机,基于KVM架构,采用SSD硬盘,CN2+BGP线路(美国为CUVIP-AS9929、GIA等)。下面列出两款主机配置信息。机房:中国香港CPU:1core内存:1GB硬盘:10GB...

丽萨主机:美国CN2 GIA精品网/KVM/9折,美国原生IP,最低27元/月

丽萨主机怎么样?丽萨主机,团队于2017年成立。成立之初主要做的是 CDN 和域名等相关业务。最近开辟新领域,新增了独立服务器出租、VPS 等业务,为了保证业务质量从一开始就选择了中美之间的 CN2 GIA 国际精品网络,三网回程 CN2 GIA,电信去程 CN2 GIA + BGP 直连智能路由,联通移动去程直连,原生IP。适合对网络要求较高的用户,同时价格也比较亲民。点击进入:丽萨主机官方网站...

rewrite规则为你推荐
美国主机租用美国服务器多少钱一年?服务器租赁服务器租赁怎么回事的?域名备案域名怎么进行备案?网站空间购买企业网站空间购买的网站空间具体需要多大的合适?深圳网站空间菜鸟问:网站空间如何选择,与空间的基本知识?什么是虚拟主机虚拟主机是什么?深圳虚拟主机深圳鼎峰网络科技 虚拟主机空间怎么样jsp虚拟主机jsp中文网的虚拟主机有人用过没?觉得怎么样?新加坡虚拟主机香港云主机和虚拟主机相比较那个好?广西虚拟主机南宁有实力的网络公司推荐下?
国内ip代理 青岛虚拟主机 申请域名 绍兴服务器租用 广东vps 国外vps租用 网站域名备案 免费二级域名申请 l5639 域名优惠码 新世界电讯 godaddy 权嘉云 网站卫士 爱奇艺vip免费试用7天 服务器监测 独享主机 中国linux godaddy空间 apnic 更多