Regista6 / EA-FC-Automated-SBC-Solving

EA FC 25 Automated SBC Solving using Integer Programming ⚽
MIT License
47 stars 9 forks source link

Issue with Chem #1

Open bbday opened 1 year ago

bbday commented 1 year ago

Hi, thanks for your work But i see all challanges that require ALL_PLAYERS_CHEMISTRY_POINTS look like dont work:

example First XI https://www.futbin.com/23/squad/100028424/sbc required Chemistry Points Per Player: Min 2

Regista6 commented 1 year ago

Hi, First of all thanks so much for taking the time to raise an issue. Thank You 🙏.

Here's what I did for the above sbc.

  1. Set FORMATION = "4-1-4-1".
  2. Set NUM_UNIQUE_LEAGUE = 11 and used create_unique_league_constraint and changed >= to ==.
  3. Set RARITY_2 = ["gold", "Rare"] and NUM_RARITY_2 = [11, 7] and used create_rarity_2_constraint.
  4. Set CHEMISTRY = 27 and CHEM_PER_PLAYER = 2.

Just for a sanity check, I created a dataset only with the solution given in the link. It gave me INFEASIBLE. The problem actually lies in the dataset. The Rarity for many players in the league CONMEBOL Libertadores is considered to be Rare but it is listed as Libertadores in my dataset 😢.

I set Rarity to Rare for Ezequiel Barco in the original dataset and then added an extra record for Emiliano Rigoni. Also I set COUNTRY = ["Argentina"] and NUM_COUNTRY = 11 and used create_country_constraint. These changes allow the solver to produce a solution in a reasonable time. Without that last constraint, it seems to not find a feasible solution quickly (may take an ungodly amount of time to find even a single solution; the reality of solving np-hard problems 😵). Although this is not the case with all sbc challenges.

ID Name Position SM WF Rating Color League Club Country Age Rarity Foot Attack WR Defense WR Cost
10001 Emiliano Rigoni RM 4 5 78 gold Major League Soccer Austin FC Argentina 30 Non Rare Left High Low 500
bbday commented 1 year ago

Is possible chemistry is assigned only if player are in right position (GK in GK ecc..), instead force solution that each player have right position, remove this constraint:

_# Formation constraint if input.FIX_PLAYERS == 1: formation_list = input.formation_dict[input.FORMATION] cnt = {} for pos in formation_list: cnt[pos] = formation_list.count(pos) for pos, num in cnt.items(): expr = players_grouped["Position"].get(map_idx["Position"][pos], []) model.Add(cpmodel.LinearExpr.Sum(expr) == num)

And edit create_chemistry_constraint assign chemistry point only for players in right position. Then will be possible find more solutions, cause not always are necessary player have same position of formation.

At the moment if disable input.FIX_PLAYERS, and is required chemistry cant find right solution because it count fake chemistry for players not in right position.

Regista6 commented 1 year ago

Hi, I pushed a change that fixes that. Can you try with the current master branch?. The current output includes a few players out of position.

bbday commented 1 year ago

I didnt update it, all good. Thanks