Skip to content

Commit

Permalink
Better code
Browse files Browse the repository at this point in the history
  • Loading branch information
pobonomo committed Jul 7, 2023
1 parent b63d40d commit c0b69ba
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions notebooks/price-optimization/Compare Models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,9 @@
" start = time()\n",
" m.optimize()\n",
" data[(\"Optimization\", \"time\")] = time() - start\n",
" if m.Status in (gp.GRB.INFEASIBLE, gp.GRB.INF_OR_UNBD):\n",
" data[(\"Optimization\", \"value\")] = float('nan')\n",
" data[(\"Optimization\", \"viol\")] = float('nan')\n",
" data[(\"Optimization\", \"error\")] = float('nan')\n",
" else:\n",
" data[(\"Optimization\", \"value\")] = m.ObjVal\n",
" data[(\"Optimization\", \"viol\")] = m.MaxVio\n",
" data[(\"Optimization\", \"error\")] = pred_constr.get_error().max()\n",
" data[(\"Optimization\", \"value\")] = m.ObjVal\n",
" data[(\"Optimization\", \"viol\")] = m.MaxVio\n",
" data[(\"Optimization\", \"error\")] = pred_constr.get_error().max()\n",
" except:\n",
" data[(\"Optimization\", \"value\")] = float('nan')\n",
" data[(\"Optimization\", \"viol\")] = float('nan')\n",
Expand Down

0 comments on commit c0b69ba

Please sign in to comment.