CN110559664A - game hero outgoing recommendation method and system based on multi-objective optimization - Google Patents
game hero outgoing recommendation method and system based on multi-objective optimization Download PDFInfo
- Publication number
- CN110559664A CN110559664A CN201910888844.7A CN201910888844A CN110559664A CN 110559664 A CN110559664 A CN 110559664A CN 201910888844 A CN201910888844 A CN 201910888844A CN 110559664 A CN110559664 A CN 110559664A
- Authority
- CN
- China
- Prior art keywords
- value
- equipment
- individual
- game
- attribute table
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 31
- 238000005457 optimization Methods 0.000 title claims abstract description 29
- 230000007123 defense Effects 0.000 claims abstract description 75
- 238000004364 calculation method Methods 0.000 claims description 23
- 230000000717 retained effect Effects 0.000 claims description 19
- 230000035772 mutation Effects 0.000 claims description 18
- 238000010586 diagram Methods 0.000 description 5
- 230000002068 genetic effect Effects 0.000 description 4
- 235000002020 sage Nutrition 0.000 description 3
- 235000017276 Salvia Nutrition 0.000 description 2
- 241001072909 Salvia Species 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 2
- 241000282461 Canis lupus Species 0.000 description 1
- 208000032544 Cicatrix Diseases 0.000 description 1
- 208000027418 Wounds and injury Diseases 0.000 description 1
- 230000002860 competitive effect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 208000014674 injury Diseases 0.000 description 1
- KRTSDMXIXPKRQR-AATRIKPKSA-N monocrotophos Chemical compound CNC(=O)\C=C(/C)OP(=O)(OC)OC KRTSDMXIXPKRQR-AATRIKPKSA-N 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 231100000241 scar Toxicity 0.000 description 1
- 230000037387 scars Effects 0.000 description 1
- 239000011800 void material Substances 0.000 description 1
Classifications
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/60—Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/80—Special adaptations for executing a specific game genre or game mode
- A63F13/822—Strategy games; Role-playing games
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
本发明公开一种基于多目标优化的游戏英雄出装推荐方法及系统,涉及手机游戏及优化算法技术领域,包括根据获取的游戏英雄属性表和装备属性表生成包括M个个体的迭代种群,该个体表征游戏英雄出装推荐方案;根据已构建的多目标适应度函数计算迭代种群中每个个体的适应度值,该多目标适应度函数用于计算游戏英雄的攻击值与防御值的和;判断当前迭代次数是否小于预设迭代总数,若是则将适应度值最大的个体确定为游戏英雄的出装推荐方案,若否则对迭代种群中的个体进行交叉变异选择操作以更新迭代种群,并返回计算个体适应度值的步骤,直到迭代结束。应用本发明,能够为用户提供最优游戏英雄出装推荐方案,使游戏英雄的攻击能力和防御能力最大化。
The invention discloses a game hero outfit recommendation method and system based on multi-objective optimization, and relates to the technical field of mobile games and optimization algorithms, including generating an iterative population including M individuals according to the acquired game hero attribute table and equipment attribute table. Individual characterizes the game hero outfit recommendation scheme; calculates the fitness value of each individual in the iterative population according to the constructed multi-objective fitness function, which is used to calculate the sum of the attack value and defense value of the game hero; Determine whether the current number of iterations is less than the total number of preset iterations. If so, determine the individual with the largest fitness value as the recommended outfit for the game hero. Otherwise, perform cross-mutation selection operations on the individuals in the iterative population to update the iterative population, and return Steps to calculate individual fitness values until the end of the iteration. The application of the present invention can provide users with an optimal outfit recommendation scheme for game heroes, maximizing the attack and defense capabilities of game heroes.
Description
技术领域technical field
本发明涉及手机游戏及优化算法技术领域,特别是涉及一种基于多目标优化的游戏英雄出装推荐方法及系统。The invention relates to the technical field of mobile games and optimization algorithms, in particular to a multi-objective optimization-based game hero outfit recommendation method and system.
背景技术Background technique
dota手游一直受广大游戏玩家喜爱。例如腾讯旗下天美工作室推出的类dota手游-《王者荣耀》,此游戏玩法以竞技对战为主,。在该游戏中一共有53种三级装备(顶级装备),各个装备的属性不同,各个不同的属性的游戏英雄在游戏中的出装也不同。游戏内,每个游戏英雄可以购买6种装备,所有装备搭配共有22,957,480种。目前游戏内系统给每位游戏英雄都提供了3中出装推荐,但是针对不同的游戏阵容,这三种出装推荐并不能满足玩家的需求。Dota mobile games have always been loved by gamers. For example, the dota-like mobile game "Glory of the King" launched by Tianmei Studio under Tencent, the gameplay of this game is mainly competitive. There are 53 kinds of third-level equipment (top equipment) in the game. The attributes of each equipment are different, and the outfits of game heroes with different attributes are also different in the game. In the game, each game hero can purchase 6 types of equipment, and there are a total of 22,957,480 types of equipment combinations. At present, the in-game system provides 3 outfit recommendations for each game hero, but for different game lineups, these three outfit recommendations cannot meet the needs of players.
发明内容Contents of the invention
本发明的目的是提供一种基于多目标优化的游戏英雄出装推荐方法及系统,使得游戏英雄的攻击能力和防御能力最大化。The purpose of the present invention is to provide a game hero outfit recommendation method and system based on multi-objective optimization, so as to maximize the attack and defense capabilities of the game hero.
为实现上述目的,本发明提供了如下方案:To achieve the above object, the present invention provides the following scheme:
一种基于多目标优化的游戏英雄出装推荐方法,包括:A game hero outfit recommendation method based on multi-objective optimization, including:
获取游戏英雄属性表和装备属性表;所述游戏英雄属性表和所述装备属性表均为表格形式;所述游戏英雄属性表的第一列为游戏英雄类别,所述游戏英雄属性表的第二列为游戏英雄的物理攻击值,所述游戏英雄属性表的第三列为游戏英雄的法术攻击值,所述游戏英雄属性表的第四列为游戏英雄的物理防御值,所述游戏英雄属性表的第五列为游戏英雄的法术防御值;所述装备属性表的第一列为装备编号,所述装备属性表的第二列为装备名称,所述装备属性表的第三列为装备的物理攻击值,所述装备属性表的第四列为装备的法术攻击值,所述装备属性表的第五列为装备的物理防御值,所述装备属性表的第六列为装备的法术防御值;Obtain a game hero attribute table and an equipment attribute table; both the game hero attribute table and the equipment attribute table are in tabular form; the first column of the game hero attribute table is the game hero category, and the first row of the game hero attribute table is The second column is the physical attack value of the game hero, the third column of the game hero attribute table is the magic attack value of the game hero, the fourth column of the game hero attribute table is the physical defense value of the game hero, and the game hero attribute table is listed as the physical defense value of the game hero. The fifth column of the attribute table is the spell defense value of the game hero; the first column of the equipment attribute table is the equipment number, the second column of the equipment attribute table is the equipment name, and the third column of the equipment attribute table is The physical attack value of the equipment, the fourth column of the equipment attribute table is the magic attack value of the equipment, the fifth column of the equipment attribute table is the physical defense value of the equipment, and the sixth column of the equipment attribute table is the equipment's magic defense value;
根据所述游戏英雄属性表和所述装备属性表生成迭代种群;所述迭代种群包括M个表征游戏英雄出装推荐方案的个体,且所有所述个体代表的游戏英雄均为同一类别;每个所述个体均包括6套互不相同的装备,且每个所述个体的结构形式均为6行5列的数组形式;其中,所述个体的一行表示一个装备的编号和属性,所述个体的每行均包括5个元素,分别为装备编号、装备的物理攻击值、装备的法术攻击值、装备的物理防御值以及装备的法术防御值;Generate an iterative population according to the game hero attribute table and the equipment attribute table; the iterative population includes M individuals who characterize the game hero outfit recommendation scheme, and the game heroes represented by all of the individuals are of the same category; each Each of the individuals includes 6 sets of different equipment, and the structure of each individual is in the form of an array of 6 rows and 5 columns; wherein, a row of the individual represents the number and attribute of an equipment, and the individual Each row of contains 5 elements, which are the equipment number, the physical attack value of the equipment, the magic attack value of the equipment, the physical defense value of the equipment, and the magic defense value of the equipment;
根据已构建的多目标适应度函数,计算所述迭代种群中每个个体的适应度值,并记录当前迭代次数;所述多目标适应度函数用于计算游戏英雄的攻击值与防御值的和;Calculate the fitness value of each individual in the iterative population according to the constructed multi-objective fitness function, and record the current number of iterations; the multi-objective fitness function is used to calculate the sum of the attack value and defense value of the game hero ;
判断所述当前迭代次数是否小于预设迭代总数,得到第一判断结果;Judging whether the current number of iterations is less than the total number of preset iterations to obtain a first judgment result;
若所述第一判断结果表示所述当前迭代次数不小于所述预设迭代总数,则将适应度值最大的个体确定为游戏英雄的出装推荐方案;If the first judgment result indicates that the current number of iterations is not less than the total number of preset iterations, then the individual with the largest fitness value is determined as the outfit recommendation plan for the game hero;
若所述第一判断结果表示所述当前迭代次数小于所述预设迭代总数,则将所述当前迭代次数加1,然后对所述当前迭代次数对应的迭代种群中的个体进行交叉变异操作生成新个体,并根据所述多目标适应度函数计算每个所述新个体的适应度值;所述新个体的总数为M个;If the first judgment result indicates that the current number of iterations is less than the total number of preset iterations, then add 1 to the current number of iterations, and then perform a crossover mutation operation on the individuals in the iterative population corresponding to the current number of iterations to generate new individuals, and calculate the fitness value of each of the new individuals according to the multi-objective fitness function; the total number of the new individuals is M;
将所有所述新个体加入所述当前迭代次数对应的迭代种群中以更新迭代种群,并根据更新后的迭代种群中每个个体的适应度值对更新后的迭代种群中的个体进行排序,选择前M个个体作为下一代的迭代种群,然后返回根据已构建的多目标适应度函数,计算所述迭代种群中每个个体的适应度值,并记录当前迭代次数的步骤。Add all the new individuals to the iterative population corresponding to the current iteration number to update the iterative population, and sort the individuals in the updated iterative population according to the fitness value of each individual in the updated iterative population, select The first M individuals are used as the iterative population of the next generation, and then return to the step of calculating the fitness value of each individual in the iterative population according to the constructed multi-objective fitness function, and recording the current iteration number.
可选的,所述游戏英雄出装推荐方法还包括:Optionally, the method for recommending game hero outfits also includes:
保留不小于所述预设迭代总数的所述当前迭代次数所对应的迭代种群;Reserving the iteration population corresponding to the current number of iterations not less than the preset total number of iterations;
计算保留下来的迭代种群中的每个个体的第一目标值和第二目标值;所述第一目标值为游戏英雄的攻击值,所述第二目标值为游戏英雄的防御值;Calculating the first target value and the second target value of each individual in the iterative population retained; the first target value is the attack value of the game hero, and the second target value is the defense value of the game hero;
计算保留下来的迭代种群中的每个个体的第三目标值;所述第三目标值为所述第一目标值与所述第二目标值的比值;Calculate the third target value of each individual in the retained iterative population; the third target value is the ratio of the first target value to the second target value;
以每个个体的第三目标值为排序标准,降序排列保留下来的迭代种群中的个体。The individuals in the retained iterative population are sorted in descending order based on the third target value of each individual as the sorting standard.
可选的,所述第一目标值的计算公式为所述第二目标值的计算公式为Xm表示第m个个体,i表示第m个个体的行数;w1、w2、w3、w4分别表示第m个个体代表的游戏英雄的物理攻击值、法术攻击值、物理防御值以及法术防御值。Optionally, the formula for calculating the first target value is The calculation formula of the second target value is X m represents the mth individual, i represents the number of rows of the m-th individual; w 1 , w 2 , w 3 , and w 4 represent the physical attack value, magic attack value, physical defense value, and magic defense value of the game hero represented by the m-th individual, respectively.
可选的,所述多目标适应度函数为F(Xm)=f1(Xm)+f2(Xm)。Optionally, the multi-objective fitness function is F(X m )=f 1 (X m )+f 2 (X m ).
可选的,所述根据所述游戏英雄属性表和所述装备属性表生成迭代种群,具体包括:Optionally, the generating iterative population according to the game hero attribute table and the equipment attribute table specifically includes:
根据所述游戏英雄属性表和所述装备属性表,采用编码方式,生成一个个体并随机初始化,得到包括M个个体的迭代种群。According to the game hero attribute table and the equipment attribute table, an individual is generated and initialized randomly by means of encoding, and an iterative population including M individuals is obtained.
可选的,所述将所有所述新个体加入所述当前迭代次数对应的迭代种群中以更新迭代种群,并根据更新后的迭代种群中每个个体的适应度值对更新后的迭代种群中的个体进行排序,选择前M个个体作为下一代的迭代种群,具体包括:Optionally, adding all the new individuals to the iterative population corresponding to the current number of iterations to update the iterative population, and updating the updated iterative population according to the fitness value of each individual in the updated iterative population Individuals are sorted, and the top M individuals are selected as the iterative population of the next generation, including:
将所有所述新个体加入所述当前迭代次数对应的迭代种群中,得到更新后的迭代种群;更新后的迭代种群的个体数为2M个;All the new individuals are added to the iterative population corresponding to the current number of iterations to obtain an updated iterative population; the number of individuals in the updated iterative population is 2M;
根据更新后的迭代种群中每个个体的适应度值,采用Pareto支配算法,对更新后的迭代种群中的个体进行支配选择;According to the fitness value of each individual in the updated iterative population, the Pareto dominance algorithm is used to select the individual in the updated iterative population;
对经过支配选择的个体进行排序,选择前M个个体作为下一代的迭代种群。Sort the individuals that have been selected by dominance, and select the top M individuals as the iterative population of the next generation.
一种基于多目标优化的游戏英雄出装推荐系统,包括:A game hero outfit recommendation system based on multi-objective optimization, including:
信息获取模块,用于获取游戏英雄属性表和装备属性表;所述游戏英雄属性表和所述装备属性表均为表格形式;所述游戏英雄属性表的第一列为游戏英雄类别,所述游戏英雄属性表的第二列为游戏英雄的物理攻击值,所述游戏英雄属性表的第三列为游戏英雄的法术攻击值,所述游戏英雄属性表的第四列为游戏英雄的物理防御值,所述游戏英雄属性表的第五列为游戏英雄的法术防御值;所述装备属性表的第一列为装备编号,所述装备属性表的第二列为装备名称,所述装备属性表的第三列为装备的物理攻击值,所述装备属性表的第四列为装备的法术攻击值,所述装备属性表的第五列为装备的物理防御值,所述装备属性表的第六列为装备的法术防御值;An information acquisition module, configured to obtain a game hero attribute table and an equipment attribute table; both the game hero attribute table and the equipment attribute table are in the form of tables; the first column of the game hero attribute table is a game hero category, and the The second column of the game hero attribute table is the physical attack value of the game hero, the third column of the game hero attribute table is the game hero's magic attack value, and the fourth column of the game hero attribute table is the game hero's physical defense value, the fifth column of the game hero attribute table is the spell defense value of the game hero; the first column of the equipment attribute table is the equipment number, the second column of the equipment attribute table is the equipment name, and the equipment attribute The third column of the table is the physical attack value of the equipment, the fourth column of the equipment attribute table is the magic attack value of the equipment, the fifth column of the equipment attribute table is the physical defense value of the equipment, and the The sixth column is the spell defense value of the equipment;
迭代种群生成模块,用于根据所述游戏英雄属性表和所述装备属性表生成迭代种群;所述迭代种群包括M个表征游戏英雄出装推荐方案的个体,且所有所述个体代表的游戏英雄均为同一类别;每个所述个体均包括6套互不相同的装备,且每个所述个体的结构形式均为6行5列的数组形式;其中,所述个体的一行表示一个装备的编号和属性,所述个体的每行均包括5个元素,分别为装备编号、装备的物理攻击值、装备的法术攻击值、装备的物理防御值以及装备的法术防御值;The iterative population generation module is used to generate an iterative population according to the game hero attribute table and the equipment attribute table; the iterative population includes M individuals who characterize the game hero outfit recommendation scheme, and the game heroes represented by all the individuals They are all of the same category; each of the individuals includes 6 sets of equipment that are different from each other, and the structure of each of the individuals is in the form of an array of 6 rows and 5 columns; wherein, a row of the individual represents a piece of equipment Number and attributes, each row of the individual includes 5 elements, which are respectively the equipment number, the physical attack value of the equipment, the magic attack value of the equipment, the physical defense value of the equipment, and the magic defense value of the equipment;
适应度值计算模块,用于根据已构建的多目标适应度函数,计算所述迭代种群中每个个体的适应度值,并记录当前迭代次数;所述多目标适应度函数用于计算游戏英雄的攻击值与防御值的和;The fitness value calculation module is used to calculate the fitness value of each individual in the iterative population according to the constructed multi-objective fitness function, and record the current number of iterations; the multi-objective fitness function is used to calculate the game hero The sum of attack value and defense value;
判断模块,用于判断所述当前迭代次数是否小于预设迭代总数,得到第一判断结果;A judging module, configured to judge whether the current number of iterations is less than the total number of preset iterations to obtain a first judgment result;
游戏英雄出装推荐方案确定模块,用于当所述第一判断结果表示所述当前迭代次数不小于所述预设迭代总数时,将适应度值最大的个体确定为游戏英雄的出装推荐方案;The game hero outfit recommendation scheme determination module is used to determine the individual with the largest fitness value as the game hero outfit recommendation scheme when the first judgment result indicates that the current iteration number is not less than the preset iteration total number ;
交叉变异操作模块,用于当所述第一判断结果表示所述当前迭代次数小于所述预设迭代总数时,将所述当前迭代次数加1,然后对所述当前迭代次数对应的迭代种群中的个体进行交叉变异操作生成新个体,并根据所述多目标适应度函数计算每个所述新个体的适应度值;所述新个体的总数为M个;A cross mutation operation module, configured to add 1 to the current number of iterations when the first judgment result indicates that the current number of iterations is less than the total number of preset iterations, and then add 1 to the iteration population corresponding to the current number of iterations The individual of the individual carries out the cross mutation operation to generate new individual, and calculates the fitness value of each described new individual according to described multi-objective fitness function; The total number of described new individual is M;
迭代种群更新模块,用于将所有所述新个体加入所述当前迭代次数对应的迭代种群中以更新迭代种群,并根据更新后的迭代种群中每个个体的适应度值对更新后的迭代种群中的个体进行排序,选择前M个个体作为下一代的迭代种群,然后返回所述适应度值计算模块。The iterative population update module is used to add all the new individuals to the iterative population corresponding to the current number of iterations to update the iterative population, and update the updated iterative population according to the fitness value of each individual in the updated iterative population The individuals in are sorted, and the top M individuals are selected as the iterative population of the next generation, and then returned to the fitness value calculation module.
可选的,所述游戏英雄出装推荐系统还包括:Optionally, the game hero outfit recommendation system also includes:
保留模块,用于保留不小于所述预设迭代总数的所述当前迭代次数所对应的迭代种群;A retaining module, configured to retain the iterative population corresponding to the current number of iterations that is not less than the preset total number of iterations;
第一目标值和第二目标值计算模块,用于计算保留下来的迭代种群中的每个个体的第一目标值和第二目标值;所述第一目标值为游戏英雄的攻击值,所述第二目标值为游戏英雄的防御值;The first target value and the second target value calculation module are used to calculate the first target value and the second target value of each individual in the iterative population retained; the first target value is the attack value of the game hero, so The second target value is the defense value of the game hero;
第三目标值计算模块,用于计算保留下来的迭代种群中的每个个体的第三目标值;所述第三目标值为所述第一目标值与所述第二目标值的比值;The third target value calculation module is used to calculate the third target value of each individual in the retained iterative population; the third target value is the ratio of the first target value to the second target value;
降序排列模块,用于以每个个体的第三目标值为排序标准,降序排列保留下来的迭代种群中的个体。The descending order module is used to arrange the individuals in the retained iterative population in descending order by using the third target value of each individual as a sorting standard.
可选的,所述迭代种群生成模块,具体包括:Optionally, the iterative population generation module specifically includes:
迭代种群生成单元,用于根据所述游戏英雄属性表和所述装备属性表,采用编码方式,生成一个个体并随机初始化,得到包括M个个体的迭代种群。The iterative population generation unit is used to generate an individual and randomly initialize it according to the game hero attribute table and the equipment attribute table in a coding manner, so as to obtain an iterative population including M individuals.
可选的,所述迭代种群更新模块,具体包括:Optionally, the iterative population update module specifically includes:
更新单元,用于将所有所述新个体加入所述当前迭代次数对应的迭代种群中,得到更新后的迭代种群;更新后的迭代种群的个体数为2M个;An update unit, configured to add all the new individuals to the iterative population corresponding to the current number of iterations to obtain an updated iterative population; the number of individuals in the updated iterative population is 2M;
支配选择单元,用于根据更新后的迭代种群中每个个体的适应度值,采用Pareto支配算法,对更新后的迭代种群中的个体进行支配选择;The dominant selection unit is used to perform dominant selection on the individuals in the updated iterative population by using the Pareto dominance algorithm according to the fitness value of each individual in the updated iterative population;
个体选择单元,用于对经过支配选择的个体进行排序,选择前M个个体作为下一代的迭代种群,并跳转至所述适应度值计算模块。The individual selection unit is used to sort the individuals selected by the dominant, select the first M individuals as the iterative population of the next generation, and jump to the fitness value calculation module.
根据本发明提供的具体实施例,本发明公开了以下技术效果:According to the specific embodiments provided by the invention, the invention discloses the following technical effects:
本发明提供了一种基于多目标优化的游戏英雄出装推荐方法及系统,采用多目标优化算法,建立以游戏英雄的攻击能力和防御能力最大化的目标,并结合遗传算法进行迭代优化,得到最优游戏英雄出装推荐方案,满足用户需求,使得游戏英雄的攻击能力和防御能力的最大化。The present invention provides a game hero outfit recommendation method and system based on multi-objective optimization. The multi-objective optimization algorithm is used to establish the goal of maximizing the attack ability and defense ability of game heroes, and combined with genetic algorithm for iterative optimization, the obtained The optimal game hero outfit recommendation scheme meets user needs and maximizes the attack and defense capabilities of game heroes.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required in the embodiments. Obviously, the accompanying drawings in the following description are only some of the present invention. Embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without paying creative labor.
图1为本发明实施例基于多目标优化的游戏英雄出装推荐方法的流程示意图;FIG. 1 is a schematic flow diagram of a game hero outfit recommendation method based on multi-objective optimization according to an embodiment of the present invention;
图2为本发明实施例基于多目标优化的游戏英雄出装推荐系统的结构示意图;FIG. 2 is a schematic structural diagram of a game hero outfit recommendation system based on multi-objective optimization according to an embodiment of the present invention;
图3为本发明实施例基于多目标优化的《王者荣耀》游戏英雄出装推荐方法的流程示意图;FIG. 3 is a schematic flowchart of a method for recommending outfits for heroes in the game "Honor of Kings" based on multi-objective optimization according to an embodiment of the present invention;
图4为本发明实施例个体解结构示意图;Fig. 4 is a schematic structural diagram of an individual solution according to an embodiment of the present invention;
图5为本发明实施例遗传算法交叉操作示意图;5 is a schematic diagram of a genetic algorithm crossover operation according to an embodiment of the present invention;
图6为本发明实施例遗传算法变异操作示意图。Fig. 6 is a schematic diagram of a mutation operation of a genetic algorithm according to an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本发明的目的是提供一种基于多目标优化的游戏英雄出装推荐方法及系统,使得游戏英雄的攻击能力和防御能力最大化。The purpose of the present invention is to provide a game hero outfit recommendation method and system based on multi-objective optimization, so as to maximize the attack and defense capabilities of the game hero.
为使本发明的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本发明作进一步详细的说明。In order to make the above objects, features and advantages of the present invention more comprehensible, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
实施例一Embodiment one
如图1所示,本实施例提供的基于多目标优化的游戏英雄出装推荐方法,包括以下步骤。As shown in FIG. 1 , the multi-objective optimization-based outfit recommendation method for game heroes provided in this embodiment includes the following steps.
步骤101:获取游戏英雄属性表和装备属性表;所述游戏英雄属性表和所述装备属性表均为表格形式;所述游戏英雄属性表的第一列为游戏英雄类别,所述游戏英雄属性表的第二列为游戏英雄的物理攻击值,所述游戏英雄属性表的第三列为游戏英雄的法术攻击值,所述游戏英雄属性表的第四列为游戏英雄的物理防御值,所述游戏英雄属性表的第五列为游戏英雄的法术防御值;所述装备属性表的第一列为装备编号,所述装备属性表的第二列为装备名称,所述装备属性表的第三列为装备的物理攻击值,所述装备属性表的第四列为装备的法术攻击值,所述装备属性表的第五列为装备的物理防御值,所述装备属性表的第六列为装备的法术防御值。Step 101: Obtain a game hero attribute table and an equipment attribute table; both the game hero attribute table and the equipment attribute table are in the form of tables; the first column of the game hero attribute table is the game hero category, and the game hero attribute The second column of the table is the physical attack value of the game hero, the third column of the game hero attribute table is the magic attack value of the game hero, and the fourth column of the game hero attribute table is the physical defense value of the game hero. The fifth column of the game hero attribute table is the spell defense value of the game hero; the first column of the equipment attribute table is the equipment number, the second column of the equipment attribute table is the equipment name, and the first column of the equipment attribute table is the equipment name. The third column is the physical attack value of the equipment, the fourth column of the equipment attribute table is the magic attack value of the equipment, the fifth column of the equipment attribute table is the physical defense value of the equipment, and the sixth column of the equipment attribute table It is the spell defense value of the equipment.
步骤101的具体过程为:目前游戏内共有93个游戏英雄,53种三级装备(顶级装备),为了充分发挥各装备的最大性能,本实施例只保留了游戏英雄和装备的4个属性,分别是物理攻击、法术攻击、物理防御和法术防御。装备的其余属性都转化成物理攻击、法术攻击、物理防御和法术防御,转换后的装备属性如表1,游戏英雄属性如表2。The specific process of step 101 is: currently there are 93 game heroes and 53 kinds of third-level equipment (top equipment) in the game. In order to give full play to the maximum performance of each equipment, this embodiment only retains 4 attributes of game heroes and equipment. They are physical attack, magic attack, physical defense and magic defense. The remaining attributes of the equipment are converted into physical attack, magic attack, physical defense and magic defense. The converted equipment attributes are shown in Table 1, and the game hero attributes are shown in Table 2.
表1转换后的装备属性Table 1 Equipment attributes after conversion
表2游戏英雄属性Table 2 Game hero attributes
步骤102:根据所述游戏英雄属性表和所述装备属性表生成迭代种群;所述迭代种群包括M个表征游戏英雄出装推荐方案的个体,且所有所述个体代表的游戏英雄均为同一类别;每个所述个体均包括6套互不相同的装备,且每个所述个体的结构形式均为6行5列的数组形式;其中,所述个体的一行表示一个装备的编号和属性,所述个体的每行均包括5个元素,分别为装备编号、装备的物理攻击值,装备的法术攻击值、装备的物理防御值以及装备的法术防御值。Step 102: Generate an iterative population according to the game hero attribute table and the equipment attribute table; the iterative population includes M individuals representing the game hero outfit recommendation scheme, and the game heroes represented by all the individuals are of the same category ; Each individual includes 6 sets of equipment that are different from each other, and the structure of each individual is an array of 6 rows and 5 columns; wherein, one row of the individual represents the serial number and attribute of an equipment, Each row of the individual includes 5 elements, which are the equipment number, the physical attack value of the equipment, the magic attack value of the equipment, the physical defense value of the equipment, and the magic defense value of the equipment.
步骤102具体包括:Step 102 specifically includes:
根据所述游戏英雄属性表和所述装备属性表,采用编码方式,生成一个个体,然后随机初始化,得到包括M个个体的迭代种群。According to the game hero attribute table and the equipment attribute table, an individual is generated by encoding, and then randomly initialized to obtain an iterative population including M individuals.
游戏内每个游戏英雄可以购买6个装备,由于装备的主动或被动技能都是唯一的,同一个装备出现多次是浪费的。故本实施例中采用长度为6的符号编码,表1中已经为53个装备编号,一个有效的编码为编号从1-53中的非重复数字组合,例如2-17-18-44-36-45(出装推荐方案为抵抗之靴、暗影战斧、破军、冰痕之握、反伤刺甲、贤者的庇护)为一个有效编码,2-2-2-2-2-2(出装推荐方案为抵抗之靴、抵抗之靴、抵抗之靴、抵抗之靴、抵抗之靴、抵抗之靴)为一个无效编码。一个个体的结构形式采用6*5的二维数组形式,为Xm表示第m个个体;其中,Xm的第一列表示装备编号,其余列依次表示表1中的物理攻击、法术攻击、物理防御、法术防御值,即Xm的每一行均为装备的详情。Each game hero in the game can purchase 6 pieces of equipment. Since the active or passive skills of the equipment are unique, it is wasteful for the same equipment to appear multiple times. Therefore, in this embodiment, a symbol code with a length of 6 is used. There are already 53 equipment numbers in Table 1, and an effective code is a combination of non-repeated numbers from 1-53, such as 2-17-18-44-36 -45 (recommended outfits are Boots of Resistance, Shadow Battleaxe, Armor Breaker, Grip of Ice Scars, Anti-Injury Stab Armor, and Sage's Protection) is an effective code, 2-2-2-2-2-2 (The outfit recommendation is Boots of Resistance, Boots of Resistance, Boots of Resistance, Boots of Resistance, Boots of Resistance, Boots of Resistance) is an invalid code. The structural form of an individual adopts the form of a 6*5 two-dimensional array, which is X m represents the mth individual; among them, the first column of X m represents the equipment number, and the remaining columns represent the physical attack, magic attack, physical defense, and magic defense value in Table 1 in turn, that is, each row of X m is the equipment for details.
然后使用上述的个体编码方式,随机初始化生成种群大小为M的迭代种群。Then use the above-mentioned individual encoding method to randomly initialize and generate an iterative population with a population size of M.
步骤103:根据已构建的多目标适应度函数,计算所述迭代种群中每个个体的适应度值,并记录当前迭代次数;所述多目标适应度函数用于计算游戏英雄的攻击值与防御值的和。Step 103: Calculate the fitness value of each individual in the iterative population according to the constructed multi-objective fitness function, and record the current number of iterations; the multi-objective fitness function is used to calculate the attack value and defense of the game hero sum of values.
游戏内游戏英雄可以根据己方和友方阵容选择不同的装备,从两方面考虑,一是游戏英雄的攻击值,二是游戏英雄的防御值。本发明通过多目标优化算法,最大化游戏英雄的攻击值和防御值。The game heroes in the game can choose different equipment according to their own and friendly lineups. There are two considerations, one is the attack value of the game hero, and the other is the defense value of the game hero. The invention maximizes the attack value and defense value of game heroes through a multi-objective optimization algorithm.
步骤104:判断所述当前迭代次数是否小于预设迭代总数,得到第一判断结果;若所述第一判断结果表示所述当前迭代次数不小于所述预设迭代总数,则执行步骤105;若所述第一判断结果表示所述当前迭代次数小于所述预设迭代总数,则执行步骤106。Step 104: Judging whether the current number of iterations is less than the preset total number of iterations, and obtaining a first judgment result; if the first judgment result indicates that the current number of iterations is not less than the preset total number of iterations, then perform step 105; if If the first judgment result indicates that the current number of iterations is less than the preset total number of iterations, step 106 is executed.
步骤105:将适应度值最大的个体确定为游戏英雄的出装推荐方案。Step 105: Determine the individual with the largest fitness value as the recommended outfit for the game hero.
步骤106:将所述当前迭代次数加1,然后对所述当前迭代次数对应的迭代种群中的个体进行交叉变异操作生成新个体,并根据所述多目标适应度函数计算每个所述新个体的适应度值;所述新个体的总数为M个。Step 106: Add 1 to the current number of iterations, then perform a cross mutation operation on the individuals in the iterative population corresponding to the current number of iterations to generate new individuals, and calculate each of the new individuals according to the multi-objective fitness function The fitness value of ; the total number of new individuals is M.
步骤107:将所有所述新个体加入所述当前迭代次数对应的迭代种群中以更新迭代种群,并根据更新后的迭代种群中每个个体的适应度值对更新后的迭代种群中的个体进行排序,选择前M个个体作为下一代的迭代种群,然后返回步骤103。Step 107: Add all the new individuals to the iterative population corresponding to the current iteration number to update the iterative population, and perform an individual in the updated iterative population according to the fitness value of each individual in the updated iterative population Sorting, select the first M individuals as the iterative population of the next generation, and then return to step 103.
步骤107具体包括:Step 107 specifically includes:
将所有所述新个体加入所述当前迭代次数对应的迭代种群中,得到更新后的迭代种群;更新后的迭代种群的个体数为2M个。All the new individuals are added to the iterative population corresponding to the current iteration number to obtain an updated iterative population; the number of individuals in the updated iterative population is 2M.
根据更新后的迭代种群中每个个体的适应度值,采用Pareto支配算法,对更新后的迭代种群中的个体进行支配选择。According to the fitness value of each individual in the updated iterative population, the Pareto dominance algorithm is used to select the individual in the updated iterative population.
对经过支配选择的个体进行排序,选择前M个个体作为下一代的迭代种群,然后返回步骤103。Sort the individuals that have been selected by dominance, select the top M individuals as the iterative population of the next generation, and then return to step 103 .
为了更明确由本实施例推荐的出装特点,本实施例在结合游戏英雄属性和装备属性的特点基础上,对进化结束后大小为M个个体的迭代种群进行再处理,以便为玩家提供更多游戏英雄的出装推荐方案。In order to clarify the characteristics of the outfits recommended by this embodiment, this embodiment, on the basis of combining the characteristics of game hero attributes and equipment attributes, reprocesses the iterative population of M individuals after evolution, so as to provide players with more Outfit recommendations for game heroes.
所述游戏英雄出装推荐方法还包括:The game hero outfit recommendation method also includes:
保留不小于所述预设迭代总数的所述当前迭代次数所对应的迭代种群。An iteration population corresponding to the current number of iterations not less than the preset total number of iterations is retained.
计算保留下来的迭代种群中的每个个体的第一目标值和第二目标值;所述第一目标值为游戏英雄的攻击值,所述第二目标值为游戏英雄的防御值。所述第一目标值的计算公式为所述第二目标值的计算公式为Xm表示第m个个体,i表示第m个个体的行数;w1、w2、w3、w4分别表示第m个个体代表的游戏英雄的物理攻击值、法术攻击值、物理防御值以及法术防御值。Calculate the first target value and the second target value of each individual in the retained iterative population; the first target value is the attack value of the game hero, and the second target value is the defense value of the game hero. The calculation formula of the first target value is The calculation formula of the second target value is X m represents the mth individual, i represents the number of rows of the m-th individual; w 1 , w 2 , w 3 , and w 4 represent the physical attack value, magic attack value, physical defense value, and magic defense value of the game hero represented by the m-th individual, respectively.
计算保留下来的迭代种群中的每个个体的第三目标值;所述第三目标值为所述第一目标值与所述第二目标值的比值。其中,比值越大表示攻击属性越高,比值越小表示防御属性越好。Calculate a third target value of each individual in the retained iterative population; the third target value is a ratio of the first target value to the second target value. Among them, the larger the ratio, the higher the attack attribute, and the smaller the ratio, the better the defense attribute.
以每个个体的第三目标值为排序标准,降序排列保留下来的迭代种群中的个体,玩家可以根据降序排列的个体自由选择游戏英雄的出装装备。Based on the third target value of each individual as the sorting standard, the individuals in the retained iterative population are arranged in descending order, and players can freely choose the outfits and equipment of game heroes according to the individuals arranged in descending order.
步骤103的多目标适应度函数为F(Xm)=f1(Xm)+f2(Xm)。The multi-objective fitness function in step 103 is F(X m )=f 1 (X m )+f 2 (X m ).
实施例二Embodiment two
如图2所示,本实施例提供了一种基于多目标优化的游戏英雄出装推荐系统,包括:As shown in Figure 2, this embodiment provides a game hero outfit recommendation system based on multi-objective optimization, including:
信息获取模块201,用于获取游戏英雄属性表和装备属性表;所述游戏英雄属性表和所述装备属性表均为表格形式;所述游戏英雄属性表的第一列为游戏英雄类别,所述游戏英雄属性表的第二列为游戏英雄的物理攻击值,所述游戏英雄属性表的第三列为游戏英雄的法术攻击值,所述游戏英雄属性表的第四列为游戏英雄的物理防御值,所述游戏英雄属性表的第五列为游戏英雄的法术防御值;所述装备属性表的第一列为装备编号,所述装备属性表的第二列为装备名称,所述装备属性表的第三列为装备的物理攻击值,所述装备属性表的第四列为装备的法术攻击值,所述装备属性表的第五列为装备的物理防御值,所述装备属性表的第六列为装备的法术防御值。The information acquisition module 201 is used to obtain the game hero attribute table and the equipment attribute table; the game hero attribute table and the equipment attribute table are both in the form of tables; the first column of the game hero attribute table is the game hero category, so The second column of the game hero attribute table is the physical attack value of the game hero, the third column of the game hero attribute table is the magic attack value of the game hero, and the fourth column of the game hero attribute table is the physical attack value of the game hero. Defense value, the fifth column of the game hero attribute table is the spell defense value of the game hero; the first column of the equipment attribute table is the equipment number, the second column of the equipment attribute table is the equipment name, and the equipment The third column of the attribute table is the physical attack value of the equipment, the fourth column of the equipment attribute table is the magic attack value of the equipment, the fifth column of the equipment attribute table is the physical defense value of the equipment, and the equipment attribute table The sixth column of is the spell defense value of the equipment.
迭代种群生成模块202,用于根据所述游戏英雄属性表和所述装备属性表生成迭代种群;所述迭代种群包括M个表征游戏英雄出装推荐方案的个体,且所有所述个体代表的游戏英雄均为同一类别;每个所述个体均包括6套互不相同的装备,且每个所述个体的结构形式均为6行5列的数组形式;其中,所述个体的一行表示一个装备的编号和属性,所述个体的每行均包括5个元素,分别为装备编号、装备的物理攻击值,装备的法术攻击值、装备的物理防御值以及装备的法术防御值。The iterative population generation module 202 is used to generate an iterative population according to the game hero attribute table and the equipment attribute table; the iterative population includes M individuals who characterize the game hero outfit recommendation scheme, and the game represented by all the individuals The heroes are all of the same category; each individual includes 6 sets of different equipment, and the structure of each individual is an array of 6 rows and 5 columns; wherein, a row of the individual represents a piece of equipment Each line of the individual includes 5 elements, which are the equipment number, the physical attack value of the equipment, the magic attack value of the equipment, the physical defense value of the equipment, and the magic defense value of the equipment.
适应度值计算模块203,用于根据已构建的多目标适应度函数,计算所述迭代种群中每个个体的适应度值,并记录当前迭代次数;所述多目标适应度函数用于计算游戏英雄的攻击值与防御值的和。The fitness value calculation module 203 is used to calculate the fitness value of each individual in the iterative population according to the constructed multi-objective fitness function, and record the current number of iterations; the multi-objective fitness function is used to calculate the game The sum of the hero's attack value and defense value.
判断模块204,用于判断所述当前迭代次数是否小于预设迭代总数,得到第一判断结果。A judging module 204, configured to judge whether the current number of iterations is less than the preset total number of iterations, and obtain a first judgment result.
游戏英雄出装推荐方案确定模块205,用于当所述第一判断结果表示所述当前迭代次数不小于所述预设迭代总数时,将适应度值最大的个体确定为游戏英雄的出装推荐方案。The game hero outfit recommendation scheme determination module 205 is used to determine the individual with the largest fitness value as the game hero outfit recommendation when the first judgment result indicates that the current iteration number is not less than the preset iteration total number Program.
交叉变异操作模块206,用于当所述第一判断结果表示所述当前迭代次数小于所述预设迭代总数时,将所述当前迭代次数加1,然后对所述当前迭代次数对应的迭代种群中的个体进行交叉变异操作生成新个体,并根据所述多目标适应度函数计算每个所述新个体的适应度值;所述新个体的总数为M个。Cross mutation operation module 206, used to add 1 to the current number of iterations when the first judgment result indicates that the current number of iterations is less than the total number of preset iterations, and then perform an iteration population corresponding to the current number of iterations The individuals in are subjected to a cross mutation operation to generate new individuals, and the fitness value of each new individual is calculated according to the multi-objective fitness function; the total number of the new individuals is M.
迭代种群更新模块207,用于将所有所述新个体加入所述当前迭代次数对应的迭代种群中以更新迭代种群,并根据更新后的迭代种群中每个个体的适应度值对更新后的迭代种群中的个体进行排序,选择前M个个体作为下一代的迭代种群,然后返回所述适应度值计算模块203。The iterative population update module 207 is used to add all the new individuals to the iterative population corresponding to the current number of iterations to update the iterative population, and to update the updated iterative population according to the fitness value of each individual in the updated iterative population The individuals in the population are sorted, the top M individuals are selected as the iterative population of the next generation, and then the fitness value calculation module 203 is returned.
为了更明确由本实施例推荐的出装特点,本实施例在结合游戏英雄属性和装备属性的特点基础上,对进化结束后大小为M个个体的迭代种群进行再处理,以便为玩家提供更多的出装选择方案,故本实施例提供的所述游戏英雄出装推荐系统还包括:In order to clarify the characteristics of the outfits recommended by this embodiment, this embodiment, on the basis of combining the characteristics of game hero attributes and equipment attributes, reprocesses the iterative population of M individuals after evolution, so as to provide players with more Therefore, the game hero outfit recommendation system provided in this embodiment also includes:
保留模块,用于保留不小于所述预设迭代总数的所述当前迭代次数所对应的迭代种群。A retaining module, configured to retain the iteration population corresponding to the current number of iterations not less than the preset total number of iterations.
第一目标值和第二目标值计算模块,用于计算保留下来的迭代种群中的每个个体的第一目标值和第二目标值;所述第一目标值为游戏英雄的攻击值,所述第二目标值为游戏英雄的防御值。The first target value and the second target value calculation module are used to calculate the first target value and the second target value of each individual in the iterative population retained; the first target value is the attack value of the game hero, so The second target value is the defense value of the game hero.
第三目标值计算模块,用于计算保留下来的迭代种群中的每个个体的第三目标值;所述第三目标值为所述第一目标值与所述第二目标值的比值。比值越大表示攻击属性越高,比值越小表示防御属性越好。A third target value calculation module, configured to calculate a third target value of each individual in the retained iterative population; the third target value is a ratio of the first target value to the second target value. The larger the ratio, the higher the attack attribute, and the smaller the ratio, the better the defense attribute.
降序排列模块,用于以每个个体的第三目标值为排序标准,降序排列保留下来的迭代种群中的个体。The descending order module is used to arrange the individuals in the retained iterative population in descending order by using the third target value of each individual as a sorting criterion.
其中,所述第一目标值的计算公式为所述第二目标值的计算公式为Xm表示第m个个体,i表示第m个个体的行数;w1、w2、w3、w4分别表示第m个个体代表的游戏英雄的物理攻击值、法术攻击值、物理防御值以及法术防御值。Wherein, the calculation formula of the first target value is The calculation formula of the second target value is X m represents the mth individual, i represents the number of rows of the m-th individual; w 1 , w 2 , w 3 , and w 4 represent the physical attack value, magic attack value, physical defense value, and magic defense value of the game hero represented by the m-th individual, respectively.
所述适应度值计算模块203中的多目标适应度函数为F(Xm)=f1(Xm)+f2(Xm)。The multi-objective fitness function in the fitness value calculation module 203 is F(X m )=f 1 (X m )+f 2 (X m ).
所述迭代种群生成模块201,具体包括:The iterative population generation module 201 specifically includes:
迭代种群生成单元,用于根据所述游戏英雄属性表和所述装备属性表,采用编码方式,生成一个个体并随机初始化,得到包括M个个体的迭代种群。The iterative population generation unit is used to generate an individual and randomly initialize it according to the game hero attribute table and the equipment attribute table in a coding manner, so as to obtain an iterative population including M individuals.
所述迭代种群更新模块207,具体包括:The iterative population update module 207 specifically includes:
更新单元,用于将所有所述新个体加入所述当前迭代次数对应的迭代种群中,得到更新后的迭代种群;更新后的迭代种群的个体数为2M个。The update unit is configured to add all the new individuals to the iterative population corresponding to the current iteration number to obtain an updated iterative population; the number of individuals in the updated iterative population is 2M.
支配选择单元,用于根据更新后的迭代种群中每个个体的适应度值,采用Pareto支配算法,对更新后的迭代种群中的个体进行支配选择。The dominant selection unit is configured to perform dominant selection on the individuals in the updated iterative population by using the Pareto dominance algorithm according to the fitness value of each individual in the updated iterative population.
个体选择单元,用于对经过支配选择的个体进行排序,选择前M个个体作为下一代的迭代种群,并跳转至所述适应度值计算模块203。The individual selection unit is used to sort the individuals selected by dominance, select the top M individuals as the iterative population of the next generation, and jump to the fitness value calculation module 203 .
实施例三Embodiment three
如图3所示,本实施例提供的一种基于多目标优化的《王者荣耀》游戏英雄出装推荐方法,包括以下步骤:As shown in Figure 3, a method for recommending outfits for heroes in the game "Glory of the King" based on multi-objective optimization provided by this embodiment includes the following steps:
步骤1,转换英雄和装备属性;其转换过程与实施例一中的步骤101相同,在此不再重复叙述。Step 1, convert hero and equipment attributes; the conversion process is the same as step 101 in Embodiment 1, and will not be repeated here.
步骤2,随机初始化种群;根据《王者荣耀》游戏内每个游戏英雄只能购买6件装备以及各装备的主动或被动技能的唯一性,一个个体的有效编码应为长度为6的非重复的符号编码,考虑到装备属性,本实施例采用实施例一步骤102中的编码形式,随机生成100个长度为6的且范围在1-53之间的符号编码,得到初始种群。例如,初始种群中,个体1为1-45-34-25-50-3,个体2为3-43-51-40-4-37,个体99为49-34-45-6-39-5,个体100为23-43-50-3-53-5,则对应的解结构如图4所示。Step 2, randomly initialize the population; according to the fact that each game hero in the game "Glory of the King" can only purchase 6 pieces of equipment and the uniqueness of the active or passive skills of each equipment, the effective code of an individual should be a non-repeating length of 6 Symbol encoding, considering the equipment attributes, this embodiment adopts the encoding form in step 102 of the first embodiment, and randomly generates 100 symbol encodings with a length of 6 and a range of 1-53 to obtain an initial population. For example, in the initial population, individual 1 is 1-45-34-25-50-3, individual 2 is 3-43-51-40-4-37, and individual 99 is 49-34-45-6-39-5 , the individual 100 is 23-43-50-3-53-5, and the corresponding solution structure is shown in FIG. 4 .
步骤3,交叉、变异产生子代;采用遗传算法对初始种群中的个体进行交叉变异操作生成M个新个体。Step 3, crossover and mutation to generate offspring; use genetic algorithm to perform crossover mutation operation on the individuals in the initial population to generate M new individuals.
在初始种群中,个体1,个体2,个体99,和个体100分别代表的出装推荐方案为(1)影忍之足-贤者的庇护-贤者之书-虚无法杖-贪婪之噬-冷静之靴、(2)冷静之靴-极寒风暴-救赎之翼-秘法之靴-血魔之怒、(99)近卫荣耀-贤者之书-贤者的庇护-疾步之靴-霸者重装-急速战靴和(100)炽热支配者-极寒风暴-贪婪之噬-冷静之靴-奔狼纹章-急速战靴。设定当前选定的游戏英雄为法师类英雄,则游戏英雄的属性为W=(0.1,0.8,0.05,0.05)。将个体带入已构建的多目标适应度函数中计算出各个个体的适应度值(目标值)。个体1,个体2,个体99和个体100计算得适应度值分别为(1.019,0.207)、(0.463,0.262)、(0.57,0.26)和(0.324,0.25)。接下来,随机选取初始种群中的两个将个体进行交叉和变异,直到产生100个新个体,计算新个体的适应度值。In the initial population, the outfit recommendations represented by Individual 1, Individual 2, Individual 99, and Individual 100 are (1) Foot of Shadow Ninja - Sanctuary of the Sage - Book of the Sage - Wand of Void - Devour of Greed - Boots of Calmness, (2) Boots of Calmness - Extreme Cold Storm - Wings of Redemption - Boots of Mystery - Wrath of the Gorefiend, (99) Glory of the Guards - Book of Sages - Protection of Sages - Boots of Quick Walk - Overlord Heavy Equipment - Boots of Rapidity and (100) Blazing Dominator - Extreme Cold Storm - Bite of Greed - Boots of Calm - Emblem of the Wolf - Boots of Rapidity. If the currently selected game hero is set as a mage hero, then the attribute of the game hero is W=(0.1, 0.8, 0.05, 0.05). Bring the individual into the constructed multi-objective fitness function to calculate the fitness value (target value) of each individual. The calculated fitness values of individual 1, individual 2, individual 99 and individual 100 are (1.019, 0.207), (0.463, 0.262), (0.57, 0.26) and (0.324, 0.25), respectively. Next, randomly select two individuals in the initial population to crossover and mutate until 100 new individuals are generated, and calculate the fitness value of the new individual.
交叉操作是两个个体在某一个或几个位置发生数据交错或交换位置的操作,变异操作为随机选取个体的某一行数据用表1中的某个数据替换。The crossover operation is an operation in which two individuals have data interleaving or exchanging positions at one or several positions. The mutation operation is to randomly select a row of data from an individual and replace it with some data in Table 1.
假设选取个体1和个体99作为父代个体,采用单点交叉方法,则交叉结果如图5。Assuming that individual 1 and individual 99 are selected as parent individuals, and the single-point crossover method is adopted, the crossover result is shown in Figure 5.
本实施例中,自然情况下个体有一定概率发生变异,规则为随机选取某一位置用表1中原个体中未出现的数据进行替换;若交叉产生的子代中出现了重复的装备编号,则该个体一定变异,其操作过程如图6所示。In this example, the individual has a certain probability of mutation under natural circumstances, and the rule is to randomly select a certain position and replace it with the data that did not appear in the original individual in Table 1; The individual must mutate, and its operation process is shown in Figure 6.
在交叉和变异中,交叉位置和变异位置都是随机产生的,交叉概率为100%,变异概率为5%。In crossover and mutation, both the crossover position and the mutation position are randomly generated, the crossover probability is 100%, and the mutation probability is 5%.
步骤4,合并种群,计算个体的适应度值;将新个体加入初始种群中,得到合并种群,该合并种群的个体数为200。Step 4, merging populations and calculating the fitness value of individuals; adding new individuals to the initial population to obtain a merged population, the number of individuals in the merged population is 200.
步骤5,Pareto算法排序,排序前100的个体作为下一代的初始种群;在交叉变异操作后,两个优秀的个体有极大的概率产生两个优秀的新个体。变异操作目的是使个体跳出局部最优。新个体也许会比父代个体差,将新个体带入到已构建的多目标适应度函数中计算其适应度值后加入到初始种群中,利用Pareto支配选择排序后,非优秀个体将舍弃,仅保留前100个优秀个体作为下一代的初始种群,重复迭代输出最后一代的初始种群。Step 5, Pareto algorithm sorting, the top 100 individuals are used as the initial population of the next generation; after the cross-mutation operation, two excellent individuals have a great probability to produce two excellent new individuals. The purpose of the mutation operation is to make the individual jump out of the local optimum. The new individual may be worse than the parent individual, and the new individual is brought into the constructed multi-objective fitness function to calculate its fitness value and then added to the initial population. After using Pareto to dominate the selection and sorting, the non-excellent individuals will be discarded. Only the top 100 outstanding individuals are kept as the initial population of the next generation, and the initial population of the last generation is repeatedly iteratively output.
步骤6,判断是否满足终止条件;终止条件为当前迭代次数是否为预设迭代总数。若是执行步骤7,若否则返回步骤3。Step 6, judging whether the termination condition is satisfied; the termination condition is whether the current number of iterations is the total number of preset iterations. If yes, go to step 7, otherwise return to step 3.
步骤7,计算比值并排序;在最后的输出初始种群中,计算每个个体的第一目标值f1和第二目标值f2,然后对每个个体计算出第一目标值f1和第二目标值f2的比值,比值越大表示该出装推荐方案攻击能力较高,比值越小表示该出装推荐方案防御能力越强。Step 7, calculate the ratio and sort; in the final output initial population, calculate the first target value f 1 and the second target value f 2 of each individual, and then calculate the first target value f 1 and the second target value f 2 for each individual The ratio of the two target values f 2 , the larger the ratio, the higher the attack capability of the outfit recommendation scheme, and the smaller the ratio, the stronger the defense capability of the outfit recommendation scheme.
步骤8,结束。表3是本实施例优化的法师类英雄出装推荐方案的部分数据。Step 8, end. Table 3 is part of the data of the outfit recommendation scheme for mage heroes optimized in this embodiment.
表3:法师类英雄出装推荐Table 3: Outfit recommendations for mage heroes
本发明在结合游戏英雄属性和装备属性的特点基础上,能为玩家推荐更多的出装选择方案。Based on the combination of the characteristics of game hero attributes and equipment attributes, the present invention can recommend more outfit options for players.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的系统而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other. As for the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for relevant details, please refer to the description of the method part.
本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处。综上所述,本说明书内容不应理解为对本发明的限制。In this paper, specific examples have been used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; meanwhile, for those of ordinary skill in the art, according to the present invention Thoughts, there will be changes in specific implementation methods and application ranges. In summary, the contents of this specification should not be construed as limiting the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910888844.7A CN110559664B (en) | 2019-09-19 | 2019-09-19 | Game hero outgoing recommendation method and system based on multi-objective optimization |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910888844.7A CN110559664B (en) | 2019-09-19 | 2019-09-19 | Game hero outgoing recommendation method and system based on multi-objective optimization |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110559664A true CN110559664A (en) | 2019-12-13 |
CN110559664B CN110559664B (en) | 2023-04-07 |
Family
ID=68781348
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910888844.7A Active CN110559664B (en) | 2019-09-19 | 2019-09-19 | Game hero outgoing recommendation method and system based on multi-objective optimization |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110559664B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111143685A (en) * | 2019-12-30 | 2020-05-12 | 第四范式(北京)技术有限公司 | Recommendation system construction method and device |
WO2021129530A1 (en) * | 2019-12-26 | 2021-07-01 | 百果园技术(新加坡)有限公司 | Virtual item display method and apparatus, computer device and storage medium |
CN113398593A (en) * | 2021-07-16 | 2021-09-17 | 网易(杭州)网络有限公司 | Multi-agent hierarchical control method and device, storage medium and electronic equipment |
CN113457152A (en) * | 2021-07-22 | 2021-10-01 | 腾讯科技(深圳)有限公司 | Game formation generation method, device, equipment and storage medium |
CN114011076A (en) * | 2021-11-16 | 2022-02-08 | 网易(杭州)网络有限公司 | Data processing method of combined prop, electronic equipment and storage medium |
CN115212576A (en) * | 2022-09-20 | 2022-10-21 | 腾讯科技(深圳)有限公司 | Game data processing method, device, equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001000737A (en) * | 1999-06-18 | 2001-01-09 | Square Co Ltd | Game device, game control method, and recording medium |
US20030149675A1 (en) * | 2001-06-26 | 2003-08-07 | Intuitive Intelligence, Inc. | Processing device with intuitive learning capability |
CN101968827A (en) * | 2009-07-27 | 2011-02-09 | 索尼电脑娱乐美国公司 | Real time context display of classified game proposal generated by subscriber |
CN105447126A (en) * | 2015-11-17 | 2016-03-30 | 苏州蜗牛数字科技股份有限公司 | Game prop personalized recommendation method |
-
2019
- 2019-09-19 CN CN201910888844.7A patent/CN110559664B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001000737A (en) * | 1999-06-18 | 2001-01-09 | Square Co Ltd | Game device, game control method, and recording medium |
US20030149675A1 (en) * | 2001-06-26 | 2003-08-07 | Intuitive Intelligence, Inc. | Processing device with intuitive learning capability |
CN101968827A (en) * | 2009-07-27 | 2011-02-09 | 索尼电脑娱乐美国公司 | Real time context display of classified game proposal generated by subscriber |
CN105447126A (en) * | 2015-11-17 | 2016-03-30 | 苏州蜗牛数字科技股份有限公司 | Game prop personalized recommendation method |
Non-Patent Citations (2)
Title |
---|
JUANZOU等: "An adaptation reference-point-based multiobjective evolutionary algorithm", 《INFORMATION SCIENCES》 * |
唐俊等: "基于多示例多标记学习的手机游戏道具推荐", 《计算机科学与探索》 * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021129530A1 (en) * | 2019-12-26 | 2021-07-01 | 百果园技术(新加坡)有限公司 | Virtual item display method and apparatus, computer device and storage medium |
CN111143685A (en) * | 2019-12-30 | 2020-05-12 | 第四范式(北京)技术有限公司 | Recommendation system construction method and device |
CN111143685B (en) * | 2019-12-30 | 2024-01-26 | 第四范式(北京)技术有限公司 | Commodity recommendation method and device |
CN113398593A (en) * | 2021-07-16 | 2021-09-17 | 网易(杭州)网络有限公司 | Multi-agent hierarchical control method and device, storage medium and electronic equipment |
CN113457152A (en) * | 2021-07-22 | 2021-10-01 | 腾讯科技(深圳)有限公司 | Game formation generation method, device, equipment and storage medium |
CN113457152B (en) * | 2021-07-22 | 2023-11-03 | 腾讯科技(深圳)有限公司 | Game array generating method, device, equipment and storage medium |
CN114011076A (en) * | 2021-11-16 | 2022-02-08 | 网易(杭州)网络有限公司 | Data processing method of combined prop, electronic equipment and storage medium |
CN115212576A (en) * | 2022-09-20 | 2022-10-21 | 腾讯科技(深圳)有限公司 | Game data processing method, device, equipment and storage medium |
CN115212576B (en) * | 2022-09-20 | 2022-12-02 | 腾讯科技(深圳)有限公司 | Game data processing method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN110559664B (en) | 2023-04-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110559664A (en) | game hero outgoing recommendation method and system based on multi-objective optimization | |
Thawonmas et al. | Visualization of Online‐Game Players Based on Their Action Behaviors | |
CN107837532B (en) | User matching method, device, server and storage medium | |
US20090075709A1 (en) | System and method of customizing a weapon in the online first person shooter game | |
JP6351671B2 (en) | Program, system, and method for adjusting neural network structure and parameters using neuro evolution | |
Chen et al. | Which heroes to pick? Learning to draft in MOBA games with neural networks and tree search | |
Berghman et al. | Efficient solutions for Mastermind using genetic algorithms | |
CN112717412B (en) | Data processing method, related device, equipment and storage medium | |
CN109966743A (en) | A kind of prediction technique, model generating method and the device of game winning rate | |
CN110772794B (en) | Intelligent game processing method, device, equipment and storage medium | |
CN110941769A (en) | Target account determination method and device and electronic device | |
CN113893547A (en) | A data processing method, system and storage medium based on fitness function | |
CN113946604A (en) | Staged go teaching method and device, electronic equipment and storage medium | |
Burney et al. | A generic approach for team selection in multi–player games using genetic algorithm | |
Wardaszko et al. | Analysis of matchmaking optimization systems potential in mobile eSports | |
Bukhori et al. | Using genetic algorithm to solve puzzle games: A review | |
CN109568967A (en) | A kind of game interaction method, apparatus and terminal | |
CN107694094A (en) | A kind of bridge gambling party sample generating method | |
Hong et al. | Applying genetic algorithms to game search trees | |
Risi et al. | Automatically categorizing procedurally generated content for collecting games | |
CN113398593B (en) | Multi-agent hierarchical control method and device, storage medium and electronic equipment | |
Patrascu et al. | Artefacts: Minecraft meets collaborative interactive evolution | |
CN115463420A (en) | Method, device, electronic device and storage medium for determining prompt information | |
US20120142423A1 (en) | System and Method for Game State Reduction | |
Du et al. | Automatic level generation for tower defense games |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB03 | Change of inventor or designer information |
Inventor after: Zou Juan Inventor after: Liu Jing Inventor after: Pei Tingrui Inventor after: Zheng Jinhua Inventor after: Jiang Weiwei Inventor after: Yang Xiao Inventor after: Zhang Hai Inventor after: Yang Shengxiang Inventor before: Zou Juan Inventor before: Yang Qite Inventor before: Pei Tingrui Inventor before: Zheng Jinhua Inventor before: Jiang Weiwei Inventor before: Yang Xiao Inventor before: Zhang Hai Inventor before: Yang Shengxiang |
|
CB03 | Change of inventor or designer information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |