This file contains hidden or 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
import csv | |
import pulp #This contains LP Modeling and solver | |
import time #This is used to see how much time for solving | |
####################################################################### | |
####################################################################### | |
This file contains hidden or 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
import csv | |
import pulp #This contains LP Modeling and solver | |
import time #This is used to see how much time for solving | |
####################################################################### | |
####################################################################### | |
This file contains hidden or 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
import csv | |
import pulp #This contains LP Modeling and solver | |
import time #This is used to see how much time for solving | |
import random | |
####################################################################### | |
####################################################################### | |
This file contains hidden or 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
import csv | |
import pulp #This contains LP Modeling and solver | |
#------------------------------------------------------------------------------------------------------ | |
#GETTING & PREPARING DATA | |
#------------------------------------------------------------------------------------------------------ | |
with open('InputItems.csv') as csvfile: | |
data = list(csv.reader(csvfile)) |
This file contains hidden or 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
import csv | |
import pulp #This contains LP Modeling and solver | |
import time #This is used to see how much time for solving | |
print() | |
print("Solving the problem... Please wait") | |
print() | |
This file contains hidden or 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
import pulp #This contains LP Modeling and solver | |
import time #This is used to see how much time it takes for solving | |
####################################################################### | |
####################################################################### | |
SizeOfStrips = [25, 40, 50, 55, 70] #size of strips that can be cut from rolls |
This file contains hidden or 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
"""Capacitated Vehicle Routing Problem with Time Windows (CVRPTW). | |
""" | |
import csv | |
import math | |
from ortools.constraint_solver import pywrapcp | |
from ortools.constraint_solver import routing_enums_pb2 | |
"""Check https://developers.google.com/optimization/reference/constraint_solver/routing/RoutingModel/, | |
https://developers.google.com/optimization/reference/constraint_solver/routing/RoutingDimension/, |
This file contains hidden or 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
import numpy as np | |
import math | |
'''Using MonteCarlo Simulation to maximize profit. | |
A Newspaper boy can buy 100, 120, 140, or 160 newspapers/day/month. | |
He will only be able to buy same number of newspapers for the whole month. | |
For example, if he buys 100 newspapers/day/month, then he will not be able to | |
buy 120, 140, or 160 newspapers in any day in that month. |
This file contains hidden or 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
import time | |
import random | |
'''Course: https://www.coursera.org/learn/algorithmic-toolbox#about''' | |
def maxPairwiseProductSlow(numberList): | |
'''prints max product between any two numbers in the numberList | |
slow approach''' |
This file contains hidden or 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
'''Course: https://www.coursera.org/learn/algorithmic-toolbox#about''' | |
def getFibonacciNumberForNSlow(number): | |
'''very slow algorithms to get fibonacci number. | |
Uses recursion (calls same function inside)''' | |
assert number >= 0, "number should be greater than or equal to 0" | |
if number <= 1: |
OlderNewer