Skip to content

Commit

Permalink
Merge pull request #40 from Marika-K/master
Browse files Browse the repository at this point in the history
remove music notebook from testing
  • Loading branch information
Marika-K authored Oct 14, 2024
2 parents e173e83 + fd957bf commit f2da993
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
29 changes: 14 additions & 15 deletions fantasy_basketball/fantasy_basketball_part2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.setObjective(gp.quicksum([points_dict[i]*y[i,j] for i,j in player_pos_map]), gp.GRB.MAXIMIZE)"
"m.setObjective(gp.quicksum(points_dict[i]*y[i,j] for i,j in player_pos_map), gp.GRB.MAXIMIZE)"
]
},
{
Expand All @@ -539,10 +539,10 @@
"source": [
"# option 1 for writing the above constraints\n",
"for j in positions:\n",
" m.addConstr(gp.quicksum([y[i,j] for i, pos in player_pos_map if pos==j])>=1, name = \"pos\" + j)\n",
" m.addConstr(gp.quicksum(y[i,j] for i, pos in player_pos_map if pos==j)>=1, name = \"pos\" + j)\n",
"\n",
"# option 2, a slightly more compact way of adding the same set of constraints\n",
"m.addConstrs((gp.quicksum([y[i,j] for i, pos in player_pos_map if pos==j])>=1 for j in positions), name = \"pos\");"
"m.addConstrs((gp.quicksum(y[i,j] for i, pos in player_pos_map if pos==j)>=1 for j in positions), name = \"pos\");"
]
},
{
Expand Down Expand Up @@ -571,8 +571,8 @@
"metadata": {},
"outputs": [],
"source": [
"m.addConstr(gp.quicksum([y[i,j] for i, j in player_pos_map if (j=='PG' or j=='SG')])>=3)\n",
"m.addConstr(gp.quicksum([y[i,j] for i, j in player_pos_map if (j=='SF' or j=='PF')])>=3);"
"m.addConstr(gp.quicksum(y[i,j] for i, j in player_pos_map if (j=='PG' or j=='SG'))>=3)\n",
"m.addConstr(gp.quicksum(y[i,j] for i, j in player_pos_map if (j=='SF' or j=='PF'))>=3);"
]
},
{
Expand Down Expand Up @@ -617,7 +617,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.addConstr(gp.quicksum([y[i,j] for i,j in player_pos_map]) == 8, name=\"full_lineup\");"
"m.addConstr(gp.quicksum(y[i,j] for i,j in player_pos_map) == 8, name=\"full_lineup\");"
]
},
{
Expand Down Expand Up @@ -656,7 +656,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Gurobi Optimizer version 10.0.2 build v10.0.2rc0 (win64)\n",
"Gurobi Optimizer version 11.0.2 build v11.0.2rc0 (win64 - Windows 10.0 (19045.2))\n",
"\n",
"CPU model: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz, instruction set [SSE2|AVX|AVX2|AVX512]\n",
"Thread count: 4 physical cores, 8 logical processors, using up to 8 threads\n",
Expand All @@ -676,23 +676,22 @@
"Variable types: 0 continuous, 167 integer (167 binary)\n",
"Found heuristic solution: objective 268.7822348\n",
"\n",
"Root relaxation: objective 2.864073e+02, 74 iterations, 0.00 seconds (0.00 work units)\n",
"Root relaxation: objective 2.864073e+02, 68 iterations, 0.00 seconds (0.00 work units)\n",
"\n",
" Nodes | Current Node | Objective Bounds | Work\n",
" Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time\n",
"\n",
" 0 0 286.40727 0 2 268.78223 286.40727 6.56% - 0s\n",
"H 0 0 283.6262215 286.40727 0.98% - 0s\n",
" 0 0 285.65180 0 4 283.62622 285.65180 0.71% - 0s\n",
" 0 0 285.65180 0 2 283.62622 285.65180 0.71% - 0s\n",
" 0 0 284.56114 0 4 283.62622 284.56114 0.33% - 0s\n",
" 0 0 283.62622 0 7 283.62622 283.62622 0.00% - 0s\n",
" 0 0 285.84410 0 6 283.62622 285.84410 0.78% - 0s\n",
" 0 0 285.84410 0 2 283.62622 285.84410 0.78% - 0s\n",
" 0 0 283.62622 0 6 283.62622 283.62622 0.00% - 0s\n",
"\n",
"Cutting planes:\n",
" Gomory: 1\n",
" MIR: 1\n",
" Cover: 1\n",
" RLT: 1\n",
"\n",
"Explored 1 nodes (100 simplex iterations) in 0.04 seconds (0.00 work units)\n",
"Explored 1 nodes (82 simplex iterations) in 0.08 seconds (0.01 work units)\n",
"Thread count was 8 (of 8 available processors)\n",
"\n",
"Solution count 3: 283.626 268.782 206.26 \n",
Expand Down
10 changes: 10 additions & 0 deletions music_recommendation/music_recommendation.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-danger\">\n",
"Note: This notebook uses the python package lightfm which is not supported with Python 3.12!\n",
"To run this notebook, use Python 3.11.\n",
"</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"source": [
"#### gurobipy code\n",
"state = m.addVars(batteries, time_periods, name=\"state\") \n",
"depth_of_discharge = m.addConstrs((gp.quicksum(state[b,t] for b in batteries) >= 0.3*sum([capacity[b] for b in batteries]) for t in time_periods), name = 'depth_restriction')"
"depth_of_discharge = m.addConstrs((gp.quicksum(state[b,t] for b in batteries) >= 0.3*sum(capacity[b] for b in batteries) for t in time_periods), name = 'depth_restriction')"
]
},
{
Expand Down
1 change: 0 additions & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jupyter_client==8.6.1
jupyter_core==5.7.2
jupyterlab_widgets==3.0.10
kiwisolver==1.4.5
lightfm==1.17
lxml==5.2.1
MarkupSafe==2.1.5
matplotlib==3.8.4
Expand Down

0 comments on commit f2da993

Please sign in to comment.