Skip to content

Instantly share code, notes, and snippets.

@francoisstamant
Last active September 5, 2022 19:54
Show Gist options
  • Save francoisstamant/a16fcb6f5d048e7e713a6e253e55d79f to your computer and use it in GitHub Desktop.
Save francoisstamant/a16fcb6f5d048e7e713a6e253e55d79f to your computer and use it in GitHub Desktop.
from gurobipy import *
#Initialize the problem
my_list = ['work','errands','gym', 'yoga', 'gaming', 'netflix', 'beer_friends', 'restaurant', 'golf', 'piano']
#Weekly values
cost_dollars = [1, 1, 1, 15, 5, 1, 15, 15, 30, 1]
pleasure = [4, 1, 1, 6, 8, 7, 10, 9, 9, 7]
wellbeing = [8, 9, 10, 9, 3, 3, 2, 3, 7, 7]
minimum_time = [35, 1, 3, 0, 0, 0, 0, 0, 0, 0]
maximum_time = [45, 2, 7, 5, 15, 15, 15, 7, 15, 10]
total_budget = 350
total_hours = 100
N = len(my_list)
knapsack_model = Model('knapsack')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment