Python Forum
Optimization problem using pulp
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Optimization problem using pulp
#1
Hello all - I have an optimization assignment that I'm struggling with - see problem below.
Quote:Chandler Oil has 5000 barrels of crude oil 1 and 10,000 barrels of crude oil 2 available. Chandler sells gasoline and heating oil. These products are produced by blending the two crude oils together. Each barrel of crude oil 1 has a quality level of 10 and each barrel of crude oil 2 has a quality level of 5.6 Gasoline must have an average quality level of at least 8, whereas heating oil must have an average quality level of at least 6. Gasoline sells for $75 per barrel, and heating oil sells for $60 per barrel. In addition, if any barrels of the crude oils are leftover, they can be sold for $65 and $50 per barrel, respectively. We assume that demand for heating oil and gasoline is unlimited so that all of Chandler’s production can be sold. Chandler wants to maximize its revenue from selling gasoline, heating oil, and any leftover crude oils.

Objective To develop an LP model for finding the revenue-maximizing plan that meets quality constraints and stays within limits on crude oil availabilities.

Here's what I have written so far:

import pulp

m = pulp.LpProblem("Scheduling Example", pulp.LpMinimize)

Og1 = pulp.LpVariable('Oil 1 for Gas',      lowBound=0, cat='Continuous')
Oh1 = pulp.LpVariable('Oil 1 for Heating',  lowBound=0, cat='Continuous')

Og2 = pulp.LpVariable('Oil 2 for Gas',      lowBound=0, cat='Continuous')
Oh2 = pulp.LpVariable('Oil 2 for Heating',  lowBound=0, cat='Continuous')

Og1L = pulp.LpVariable('Oil 1 for Gas left-over',      lowBound=0, cat='Continuous')
Oh1L = pulp.LpVariable('Oil 1 for Heating left-over',  lowBound=0, cat='Continuous')

Og2L = pulp.LpVariable('Oil 2 for Gas left-over',      lowBound=0, cat='Continuous')
Oh2L = pulp.LpVariable('Oil 2 for Heating left-over',  lowBound=0, cat='Continuous')

# Objective function
m += 70*(Og1 + Oh1) + 60*(Og2 + Oh2) + 60*(Og1L + Oh1L) + 65*(Og2L + Oh2L) , "Total Revenue"

#contraints
m += Og1 + Oh1 <= 5000, "Oil 1 Barrel Constraint"
m += Og2 + Oh2 <= 10000, "Oil 2 Barrel Constraint"
m += 2*(Og1) - 3*(Og2) >=0, "Gasoline Quality Constraint"
m += 4*(Oh1) - Oh2 >=0, "Heating Quality Constraint"
The last part of my objective function (60*(Og1L + Oh1L) + 65*(Og2L + Oh2L)) is contingent on there being leftovers. I'm struggling with how to write this within the model. Or do it outside of the model, and if so, how?

Any insights are greatly appreciated. Please provide as much detail in your response as possible. I still consider myself a newbie.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Inventory Management Optimization problem Mini_Miudo 1 2,919 Dec-13-2018, 07:49 PM
Last Post: Mini_Miudo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020