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
#Import libraries | |
import pyproj | |
import pandas as pd | |
#Pyspark functions - ONLY - DO not import functions like "import * from <package name>" | |
from pyspark.sql.functions import * | |
from pyspark.sql.types import DoubleType | |
#Read dataframe with XY(eastings and northings) and population value |
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
#SetWD | |
setwd("C:/Users/misba/Desktop/PROCESS/") | |
#Load libraires | |
library(dplyr) | |
library(raster) | |
library(rgdal) | |
library(data.table) | |
#Read object |
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
#Function for solver | |
def solve_gas(InputRawMaterial, D): | |
s = newSolver('Gas blending problem') | |
nR,nF = len(InputRawMaterial),len(D) | |
Roc,Rmax,Rcost = 0,1,2 | |
Foc,Fmin,Fmax,Fprice = 0,1,2,3 | |
G = [[s.NumVar(0.0,10000,'') | |
for j in range(nF)] for i in range(nR)] | |
ProductList = [s.NumVar(0,InputRawMaterial[i][Rmax],'') for i in range(nR)] | |
F = [s.NumVar(D[j][Fmin],D[j][Fmax],'') for j in range(nF)] |
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
#Import ortools solver | |
from ortools.linear_solver import pywraplp | |
#Creating a solver object | |
solver_lin = pywraplp.Solver('Swiggy Food Solver',pywraplp.Solver.GLOP_LINEAR_PROGRAMMING) | |
#Step 1 - Create Decision variables | |
# x[0] for number of biryanis | |
# x[1] for number of Bowls |