Real World NPComplete Problems Computer Science Department University
Real World NP-Complete Problems Computer Science Department University of Central Florida COP 6410 Jonathan Cazalas & Tracy Bierman
Outline n Real World Problem n n n Explain problem Optimization problem Decision problem n Show Problem is NP-Complete n n Is problem in NP Known NP problem Polynomial transformation Check instances Real World NP-Complete Problems page 2
Real World Problem n Promotional Products Company n n Provider of imprinted promotional merchandise Customers (end-users) purchase imprinted/logoed products to give away as a form of marketing n n n ex: pens, t-shirts, padfolios, sports bottles, etc anything and everything that can be printed with a logo Customers have a limited budget n want to maximize the value they get on purchased items § translates to minimizing my profit margins § of course, they never directly say this § rather, they usually say n “with my budget of X dollars, find us the best Y items that maximizes the value of our purchase” Real World NP-Complete Problems page 3
Real World Problem n Ex: Medical Center n want items for their health fair n n they go to our website Healthcare, Wellness, & Safety category Budget of $5000 Want at least 3 different types of items § 1000+ each of at least 3 items (ex: pill boxes, lib balms, and bandage dispensers) Real World NP-Complete Problems page 4
Real World Problem n Formalize the problem n Optimization Problem: n Given: set of promotional products PP = {P 1, P 2, …, Pi, …, Pn} price (Pi) = price of each product (customer’s price) margin(Pi) = profit margin of each product minqty(Pi) = minimum purchase quantity Customer gives: B = Budget SS = subset of items customer is willing to consider X = minimum # of different products wanted n Problem: within this subset of products, and getting a minimum of X # of products, use all of my budget while minimizing margins. Real World NP-Complete Problems page 5
Real World Problem n Formalize the problem n Decision Problem (call it π): n Given: set of promotional products PP = {P 1, P 2, …, Pi, …, Pn} price(Pi) = price of each product (customer’s price) margin(Pi) = profit margin of each product minqty(Pi) = minimum purchase quantity Customer gives: B = Budget M = maximum allowed profit margin SS = subset of items customer is willing to consider X = minimum # of different products wanted n Question: can I make a purchase such that avg(margin(Pi)) ≤ M and Σprice(Pi) ≤ B? Real World NP-Complete Problems page 6
Is π NP-Complete? n (1) Is π in NP? n n n What will the witness provide? witness will give the set of items purchased, along with their respective quantities can easily check in polynomial time if n n Average of all the margins ≤ M Sum of all the individual prices ≤ B n So the answer is yes. n π is in NP. Real World NP-Complete Problems page 7
Is π NP-Complete? n (2) Select known NP-C problem that we think π can successfully reduce to n n Knapsack (call this problem K) Decision Problem: n Given: Set of items X = {x 1, x 2, …, xi, …, xn} v(xi) = value of each item w(xi) = weight of each item V = minimum Value desired W = maximum allowable weight n Question: can I place, into the knapsack, a subset of X whose Σv(xi) ≥ V and whose Σw(xi) ≤ W ? Real World NP-Complete Problems page 8
Is π NP-Complete? n (3) Make a polynomial transformation from K to π. (K ► π) n n We want to take an arbitrary instance of K (IK), and from that, make an instance of π (Iπ) from IK. Thereby, reducing π to K. IYES INO π K (instance) Real World NP-Complete Problems page 9
Is π NP-Complete? n (3) Make a polynomial transformation from K to π. (K ► π) n Few initial restrictions: n n n minqty(Pi) = 0 for all Pi X = 0 // no minimum requirement of product types The subset of categories is all of PP Real World NP-Complete Problems page 10
Is π NP-Complete? n (3) Make a polynomial transformation from K to π. (K ► π) n Next, we make the transformation with the following: n n n price(Pi) = w(xi) margin(Pi) = w(xi) – v(xi) / w(xi) Budget = W M = (W – V) / W This transformation does work preserving the yes instances. Real World NP-Complete Problems page 11
Is π NP-Complete? n (4) Check for preservation of the instances n n It works! Example: n n w = {10, 8, 8, 6, 6} v = {5, 7, 6, 5, 4} Real World NP-Complete Problems page 12
Is π NP-Complete? n On a side note, the problem could have been worded differently: n We realize: n n n Minimizing margins equates to minimizing my profits Minimizing my profits equates to maximizing my actual cost based on the sales price The higher the cost (for the same sales price), the higher the “value” (V) Real World NP-Complete Problems page 13
Real World Problem n Re-Formalize the problem n Decision Problem (call it π): n Given: set of promotional products PP = {P 1, P 2, …, Pi, …, Pn} price(Pi) = price of each product (customer’s price) cost(Pi) = cost of each product // thing of as “value” minqty(Pi) = minimum purchase quantity Customer gives: B = Budget V = minimum value allowed by customer SS = subset of items customer is willing to consider X = minimum # of different products wanted n Question: can I make a purchase such that Σcost(Pi) ≥ V and Σprice(Pi) ≤ B? Real World NP-Complete Problems page 14
Is π NP-Complete? n This is now a 1 -1 mapping with Knapsack and is intuitively NP-C. n Lesson learned: spend more time formalizing the problem. Real World NP-Complete Problems page 15
Questions: n Easy questions only n Real World NP-Complete Problems page 16
Real World NP-Complete Problems Computer Science Department University of Central Florida COP 6410 Jonathan Cazalas & Tracy Bierman
- Slides: 17