My objective function is comprised of conditional variables, which is causing every re-run of my python script to have slightly different variable references. I need help re-writing my objective function so that there are no conditions in it, while still keeping the same problem/solution.
ObjectiveFunction = maximize(Σ(Ψ_[p, r] * (x_bar[p, r] + c[p, r]) for p in P for r in R))
where:
- p is a player
- r is the round
- Ψ is a dictionary ( Dict[Tuple[str, int], int] ) representing the score of player p in round r
- x_bar is a binary variable ( x_bar := (p, r) ) of whether a player is counted as scoring (part of the team) in round r
- c is a binary variable ( c := (p, r) ) representing a captain who has a doubled score in round r
I have looked at several similar questions, but have had no luck applying their answers to my problem. They are:
- If condition in Cplex objective function
- Pyomo and conditional objective function
- How can I model `if` conditionals in Gurobi Python Objective Function?
Thank you for taking the time to read this and help me. It truly means a lot!