3
$\begingroup$

According to https://www.heroescounters.com/teampicker a Hero has a synergy value with another hero, Heroes of the Storm have 60+ heroes each one with a synergy value for example:

HeroID  Synergy.With.HeroID      Synergy.Points
1               2                       97
1               3                       95
1               4                       94
45              1                       2
45              2                       11 

A Team in heroes of the storm have 5 heroes, and the full synergy of a team is calculated by the formula:

Team_total_synergy = Synergy_Points(Hero1 with Hero2) + 
mean(Synergy_Points(Hero3 + Hero1) + Synergy_Points(Hero3 + Hero2)) + 

mean(Synergy_Points(Hero4 + Hero1) + Synergy_Points(Hero4 + Hero2) + Synergy_Points(Hero4 + Hero3)  

[And so on... till Hero5]

Explaining the formula: Each Synergy Value after the synergy of Hero 1 and Hero 2 is calculated by the Mean of that Hero with the rest of the team, When Hero5 is added up i got the synergy of the team summing all the values.

My Answer is, How can I find the Team with the greatest possible synergy given that formula, and how can I write the code to find it given the possibility there are 64 Heroes(approximately) without brute-forcing all all 64^5 combinations of heroes.

$\endgroup$
4
  • $\begingroup$ Looks like a reverse traveling sales man problem... $\endgroup$ – JdeHaan Jun 9 '17 at 14:22
  • 1
    $\begingroup$ it's only 2^30 combinations, that is doable in an hour. $\endgroup$ – ratchet freak Jun 9 '17 at 14:22
  • $\begingroup$ You actually have $\binom{64}{5}$ combinations of heroes (unless you can have twice the same hero). Can you specify the formula ? Is it $\sum_{i,j,i \neq j} synergy_{i,j}$ ? Or do you calculate is differently for different hero numbers ? $\endgroup$ – user5751924 Jun 9 '17 at 14:24
  • $\begingroup$ You can't have twitch the same hero and hero synergy is calculated the same way for all possibilities(just picking the Points Value from Dataset), the formula you gave is correct. $\endgroup$ – Caio Vasconcelos Jun 9 '17 at 17:36
2
$\begingroup$

I suggest you solve it with integer programming (you can download gusek for free for not too complicated computations).

Define a graph $G=(V,E)$, where $V$ is the set of heroes, and $E$ a link between two heroes, with their synergy value $s_{i,j}$ for $(i,j) \in E$.

Define, for $i \in V$, $X_i$ the boolean variable equal to 1 iff you take hero $i$

Define additional real positive variables $Y_{i,j}$ for the cost, which are equal to 1 in the final solution iff heroes $i$ and $j$ are selected.

You want to solve

$\max \sum_{(i,j) \in E} Y_{i,j}s_{i,j}$

such that $\sum_{i \in V}X_i = 5$

$\forall (i,j) \in E, Y_{i,j} \leq X_i $

$\forall (i,j) \in E, Y_{i,j} \leq X_j $

other formulations are possible. I like this one, since it only has $|V|$ boolean variables

If that does not work (too much computation time), try to modify some already existing algorithms to find cliques, such as the one from Tarjan and Trojanowski.

Sidenote, you are lucky that the number of heroes is limited by 5. Otherwise, it would be a maximum clique problem, which is NP-complete.

$\endgroup$
2
  • $\begingroup$ Sounds Great! Can you suggest me an integer programming framework to implement this on python or R? $\endgroup$ – Caio Vasconcelos Jun 9 '17 at 17:40
  • $\begingroup$ @CiaoVasconselos I think glpk (open source) and cplex or gurobi (licenced) both have interfaces with python, for R I am not sure. I don't use them though. $\endgroup$ – user5751924 Jun 10 '17 at 0:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.