Hi there,

I’m trying to edit one of the constraints in the code_for_Github.jl file as developed here

https://github.com/dscotthunter/Fantasy-Hockey-IP-Code

The program generates lineups of sports players to submit in daily fantasy sports contests. The contests have certain rules for how lineups are constructed, and I’d like to change how one of these rules was programmed in the code.

The constraint in question was originally written for a contest in which the 8 skaters in a lineup had to play for exactly three different teams. It was written as follows:

```
# exactly 3 different teams for the 8 skaters constraint
@defVar(m, used_team[i=1:num_teams], Bin)
@addConstraint(m, constr[i=1:num_teams], used_team[i] <= sum{skaters_teams[t, i]*skaters_lineup[t], t=1:num_skaters})
@addConstraint(m, constr[i=1:num_teams], sum{skaters_teams[t, i]*skaters_lineup[t], t=1:num_skaters} <= 6*used_team[i])
@addConstraint(m, sum{used_team[i], i=1:num_teams} == 3)
```

For the contests I play in, each lineup can have up to a maximum of four players who play for the same team. Each lineup consists of 8 skaters and a goalie.

I initially wrote the following line:

```
@addConstraint(m, sum{skaters_teams[i]*skaters_lineup[i], i=1:num_skaters} + sum{goalie_teams[i]*goalies_lineup[i], i=1:num_goalies} <= 4)
```

but realized this limits each lineup to having players from no more than four teams, as opposed to preventing lineups from having more than four players that play for the same team.

So, instead of summing the total number of teams in each lineup, how do I get the program to count unique instances of each team in a given lineup, and limit this to a maximum of four?

Any help would be much appreciated, and let me know if I can provide more information.

Thank you.