Last active
May 17, 2017 14:26
-
-
Save EthanRosenthal/f25db6c43c9f7deba39b3edd5b4574d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"from pulp import *\n", | |
"\n", | |
"# Initialize the problem that we are trying to solve\n", | |
"prob = LpProblem('Seating Arrangements', LpMaximize)\n", | |
"\n", | |
"# We'll have 12 tables.\n", | |
"tables = range(1, 13)\n", | |
"\n", | |
"# Define our problem variables\n", | |
"guest_table_ind = {}\n", | |
"for guest in guests:\n", | |
" for table in tables:\n", | |
" var_name = 'guest_{}_table_{}'.format(guest, table)\n", | |
" var = LpVariable(var_name,\n", | |
" lowBound=0, \n", | |
" upBound=1, \n", | |
" cat='Binary')\n", | |
" guest_table_ind[(guest, table)] = var" | |
] | |
} | |
], | |
"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