Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Chem #1

Open
bbday opened this issue Mar 22, 2023 · 4 comments
Open

Issue with Chem #1

bbday opened this issue Mar 22, 2023 · 4 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@bbday
Copy link

bbday commented Mar 22, 2023

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
Copy link
Owner

Regista6 commented Mar 23, 2023

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

@Regista6 Regista6 self-assigned this Mar 23, 2023
@Regista6 Regista6 added bug Something isn't working question Further information is requested labels Mar 23, 2023
@bbday
Copy link
Author

bbday commented Apr 20, 2023

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(cp_model.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
Copy link
Owner

Regista6 commented Apr 20, 2023

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
Copy link
Author

bbday commented Apr 21, 2023

I didnt update it, all good.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants