Open bwatkin79 opened 6 years ago
It's not in there, if you want it you'll have to add it yourself. But from my understanding of it, it won't be feasible in most cases.
I have made several attempts to create the constraint, but I'm still new to programming and only found out about Julia when I discovered the MIT project these programs were built for. It seems the way objects are created is a lot different than Python or something. This is what I have so far:
#HITTERS in batting order based on slots 1-5 constraint @addConstraint(m, order[b=1:num_players],1 <= players[b:Batting_Order_Confirmed_]) @addConstraint(m, order[b=1:num_players], players[b:Batting_Order_Confirmed_] <= 5)
Another attempt:
#HITTERS in batting order slots 1-5 constraint @addConstraint(m, 1 <= players[i,:Batting_Order_Confirmed_], i=1:num_players}) @addConstraint(m, players[i,:Batting_Order_Confirmed_], i=1:num_players} <= 5)
I'm not sure if I'm even close to getting it right. I think the constraint needs to use :Batting_OrderConfirmed but it gave me an error saying it was undefined at one point. On the second example, it says "i" is undefined. I've been adding this into the baseball_formulations.jl file with the other constraints. Can someone please help?
jnederlo - Would making these changes accomplish what I'm trying to do? Assume we use the 1-6 batters. I'm new to Julia, but it seems like this would work if the way I'm reading the program is right. Definitely possible I'm not though.
In baseball_formulations.jl -
line 52 #number of stacks per team (this is 9)
line 53 num_stacks = 6;
In data_cleaning.jl -
line 402 #STACK players_stacks stores information on which team each player is on
line 403 num_stacks = 6; #number of stacks
line 409 for j=1:num_stacks
line 410 if players[1,:Batting_Order_Confirmed_] == j
line 411 stack_ind = circshift(collect(1:6),stack_order-j)[1:stack_order[1]]; #index of the stacks
line 425 for j=1:num_stacks
line 426 if players[i,:Batting_Order_Confirmed_] == j
line 427 stack_ind = circshift(collect(1:6),num_stacks-j)[1:num_stacks]; #index of the stacks
I made these changes and the program ran without any errors. What do you think?
I'm not sure, I'm not very familiar with circshift, it's possible what you've done worked, I would manually check with your outputs. But as I mention above, the much simpler way to me seems to just filter your inputs altogether, i.e. filter the data before you send it into julia.
line 30 #only keep 4th order and earlier batters, cuz they make more points
On line 30 of the baseball_formulations program, you mention the batting order constraint, but I did not see the actual constraint in any of the programs. If the constraint is there, please tell me where. I'd like to adjust it. Otherwise, can you please provide the constraint that is missing?