Skip to content

Instantly share code, notes, and snippets.

@EthanRosenthal
Last active May 17, 2017 14:15
Show Gist options
  • Save EthanRosenthal/0dab13fc7abf38c909f1b83619e2bf02 to your computer and use it in GitHub Desktop.
Save EthanRosenthal/0dab13fc7abf38c909f1b83619e2bf02 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Status: Optimal\n"
]
}
],
"source": [
"opts = ['--log', 'glpk.log']\n",
"status = prob.solve(GLPK_CMD(msg=3, options=opts))\n",
"print(\"Status: {}\".format(LpStatus[status]))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>table_number</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Ruben Thomas</th>\n",
" <td>9</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Anita Parker</th>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Kirk Jackson</th>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Diedra Scherman</th>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Jessie Castrejon</th>\n",
" <td>7</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" table_number\n",
"Ruben Thomas 9\n",
"Anita Parker 2\n",
"Kirk Jackson 12\n",
"Diedra Scherman 8\n",
"Jessie Castrejon 7"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"seating = {}\n",
"for (guest, table), val in guest_table_ind.items():\n",
" if val.varValue == 1:\n",
" seating[guest] = table\n",
"seating = pd.DataFrame.from_dict(seating, \n",
" orient='index')\n",
"seating.columns = ['table_number']\n",
"seating.head()"
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [conda root]",
"language": "python",
"name": "conda-root-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment