Skip to content

Instantly share code, notes, and snippets.

@faizankshaikh
Created October 8, 2017 17:57
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save faizankshaikh/84a71e213306980ec6f75dc9e3e709dd to your computer and use it in GitHub Desktop.
Save faizankshaikh/84a71e213306980ec6f75dc9e3e709dd to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gabrielawad
Copy link

Hi !!!!

A wonderful application of linear programming.

Thanks!!!

I believe that the third line should be:

import pandas as pd

instead of:

import padnas as pd

Best regards,

Gabriel

@akshithrk
Copy link

Great example.. practical linear programming application
Also, I second the pandas misspelling

@nanduni-nin
Copy link

Thank you

@Pradeepy16k
Copy link

Great example.. practical linear programming application

@krlakshmikanth
Copy link

krlakshmikanth commented Nov 8, 2018

Thanks for sharing and in #Create optimization Function, the code should be modified as follows.

Create optimization Function

total_views = ' '
for rownum, row in data.iterrows():
for i, talk in enumerate(decision_variables):
if rownum == i:
formula = row['views'] * talk
total_views += formula
prob += total_views

print('Optimization function: ' + str(total_views))

@selmayildirim
Copy link

Very nice code and idea. Thank you for sharing. I used pulp.LpAffineExpression and dictionaries to define the objective function and constraint equations, it worked well.

I should also mention that one would get a different list with and without rounding. I guess this is because of the rounding process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment