Finally, the discount I love most, duovigintuple points, is back aux Galeries Lafayette Xidan (Beijing). I decided bien en profiter, treating myself with some CHANEL products.
Simple rules here:
- For each yuan spent on cosmetics, 22 points are rewarded to your account after the payment. Only whole yuan produces points.
- Every 100 points count as 1 yuan for payment. Only multiples of 100 points can be redeemed for payment.
- You cannot spend points earned by a purchase on the purchase itself.
- You cannot cash points, which makes points less valuable than cash.
I planned to buy the following things:
|Product||Price per piece (yuan)||Quantity|
Suppose initially I have no points in my account, a good sequence of purchases is:
- 1 soap, 1 gel, 1 foam and 1 serum;
- 1 soap.
The first purchase costs 2205 yuan, and produces 48510 points. The second purchase costs 0 yuan and 48000 points. At last, I have 510 points in my account.
The sequence is by no means guaranteed to be optimal, as I just used some heuristics: the nominal price is 2685 yuan, and the perfect price is 2685÷(1+22%)≈2200.82 yuan, where the reduction is 484.18 yuan, near to the price of soap.
If everything had happened as planned, this wouldn’t be intersting. The soap is out of stock. It is, in fact, limited, and most major CHANEL cosmetics stores are out of stock of it. Neither is the product available from its official website in China. Using again the heuristics, I found a good sequence for the modified order: first the foam and the serum, then the gel.
On a first thought, a generalised version of finding the best sequence of purchases should be intractable, as many other notoriously hard combinatorial optimisation problems. Let’s formulate the problem formally and prove its intractability.
Problem OPT-DISCOUNT Given natural numbers where , let be the initial amount of points. Find a partition of along with numbers that minimises the output of the following program:
- Set and use the initial value of .
- For :
- Set .
- If or , set and terminate the loop.
- Otherwise, set and .
- Output .
Here models the maximum number of payments one can stand to make. Splitting the order takes more effort when paying! The decision version of the above problem is:
Problem DISCOUNT Given natural numbers , decide whether the minimised value in OPT-DISCOUNT is no greater than .
Anyone with basic computer science knowledge (稍有常识的人) will immediately see that DISCOUNT is NP-complete. Let’s prove its NP-hardness.
Problem SUBSET-SUM-22-100 Given natural numbers , decide whether there exists such that .
Lemma SUBSET-SUM-22-100 is NP-hard.
Proof Let be a regular subset sum problem (asking whether there exists a subset that sums to half of the total sum) and suppose WLoG that , put for and and form a SUBSET-SUM-22-100 instance with .
- If the SUBSET-SUM instance has a solution , one possible solution to the SUBSET-SUM-22-100 instance is .
- If the SUBSET-SUM-22-100 instance has a solution , it must be the case that , because the sum without would be too small. Now one can easily verify that is a solution to the SUBSET-SUM instance.
Corollary DISCOUNT is NP-hard.
Proof A portion of DISCOUNT, namely that restricted to , is exactly SUMSET-SUM-22-100, excluding those whose is not an integer thus the answer is immediate.
For real-world scenarios, seems to be enough for a super-near-optimum. The strategy is:
- Make a big purchase below the ‘perfect price’ (nominal price divided by 1.22) without redeeming points.
- Make a small purchase, the nominal price of which plus the previous one exceeds the ‘perfect price’, redeeming a carefully-chosen amount of points so that the cash paid on the first two purchases is the ‘perfect price’.
- Make a final purchase, redeeming as many points as possible and paying the residual amount.
By the way, the formalised model does not take the value of points into account. A returning customer surely benefits from the points left in the account.