At a benefits-program review, the coordinator sees three proposed choices: a mug, another color of the same mug and a tumbler. An employee who wants no drinkware still has little to choose. Adding a power bank would create another function, but it would also introduce a charging requirement. Before invitations go out, the coordinator needs a better three-item menu, and finance needs to know what happens if everyone chooses its costliest item.

This model selects a small gift menu using declared suitability requirements and a conservative funding limit. It enumerates the possible subsets, rejects those that fail coverage or budget, and ranks the rest in a fixed order. The output is a reproducible shortlist with profile coverage, category concentration and maximum liability. It does not predict demand, decide how many units people will choose or allocate a fixed warehouse inventory.
The practical question is whether the menu offers real alternatives under the conditions you have actually verified. Three photographs are not necessarily three functions. And a low average price cannot fund a choice menu if every recipient is allowed to choose its most expensive item.
Define a function separately from a category or color
Give each candidate a stable machine ID, a display label, a functional identity and a broader category. A notebook and pen have different functions but can share the stationery category. Two colorways of the same bottle share a function. The selector allows only distinct functions in its chosen menu, then measures broader category concentration separately.
4imprint's employee-gift page lists product groups such as pens, notebooks, tote bags and water bottles separately from color filters. That is useful evidence for structuring candidate inputs. It is not a quotation for the constructed examples below, proof that those items are available in the required quantity or evidence that another supplier carries them.
The buyer must define functional identities consistently before running the model. Renaming a red mug “morning companion” cannot turn it into a different function from the blue mug. Conversely, putting every object used at a desk into one function would erase useful differences. Document the practical use that distinguishes the options and keep merchandising names in the separate display-label field.
Use unique ASCII IDs for deterministic sorting. Native Unicode product names can appear in display labels, including multilingual names; they do not determine the final tie-break. Changing a label's language should not silently change the chosen menu. Replacing a candidate with a different product, however, requires new evidence and a rerun.
Establish the input evidence before calculating
The model accepts a nonnegative integer recipient count, N, and a target menu size, K, from one through six. There may be at most 20 candidate IDs. Budget B, reserve R, unit costs and fixed setup charges are nonnegative integers in one currency's minor units. For the US example, $12 is entered as 1,200 cents, not the floating-point value 12.00.
Use one approved all-in unit-cost basis across every candidate. Decide what the quotation includes, such as the agreed customization, packaging, taxes and delivery scope, and identify exclusions or uncertainties before calling it all-in. Reserve remains separate. A unit-only price and a delivered customized price cannot become comparable merely by labeling both USD.
Each row needs a known fixed setup charge, even if that charge is an explicitly evidenced zero. Missing cost is different from free. The implementation requires reference text for costs, supply and each suitability value; a reference string makes the record traceable but does not verify its truth. The buyer still has to examine the underlying quotation or product evidence.
Availability also has a quantity meaning. The supplier must be able to supply N units of any selected option under the same quoted basis. If the bottle can serve only ten of twenty recipients, this model cannot fund or present it as an unrestricted choice for all twenty. It excludes candidates marked unavailable or with insufficient confirmed capacity. Unknown availability is rejected rather than guessed.
The code rejects negative or fractional counts, missing values, mixed currency or basis, duplicate IDs and Boolean values passed as integers. That last check matters in Python because a casual integer test can accept True as one. Rejecting the input creates a request for evidence, not a negative evaluation of the product.
Encode joint needs as their own profiles
A profile is a named combination of requirements for which the menu must provide alternatives. Set its minimum coverage floor before selecting the menu; two suitable choices per profile is the normal starting point here. Coverage means a count of suitable selected options, not a count of recipients or a percentage of expected orders.
Do not confuse separate coverage with joint coverage. Suppose one item avoids food but requires size selection, and another needs no size selection but contains food. A person requiring both no food and no size selection cannot necessarily use either. Create a separate “no food AND no size selection” profile and verify each candidate against that intersection.
Use exact zero or one values. One means the candidate has been verified against that declared profile; zero means it does not meet it. Unknown or unsupported suitability must be resolved before the row enters the model. Do not convert a blank to zero and continue: that would hide uncertainty inside an apparently complete matrix.
Profiles should describe the requirements you intend to cover, without collecting unnecessary personal histories. The selector needs a verified suitability matrix, not names or explanations of why a person has a requirement. A selected menu still needs an ordinary decline route outside the optimization. Declining does not justify assuming a lower paid quantity when testing the maximum liability.
Fund the maximum, then rank feasible menus
For every K-item subset with distinct functions, count the suitable options for each profile. Reject a subset if any coverage is below its declared floor. Then calculate its liability in minor units:
L = N × highest selected unit cost + all selected setup charges + R.This bound assumes one gift per recipient and funds the possibility that everyone chooses the most expensive selected option. All selected setup charges are included even though everyone might choose only one item, making the setup treatment conservative. Do not sum every selected unit cost as if each recipient receives the whole menu, and do not substitute a guessed popularity-weighted average.
Reject L greater than B. Equality is allowed. Among the remaining menus, apply this lexicographic order: first maximize the lowest profile coverage; then minimize the largest category count; then minimize the sum of selected unit costs; finally choose the lexicographically smallest sorted tuple of ASCII IDs. Each stage applies only when earlier stages tie. These are explicit model choices, rather than a supplier's definition of an ideal assortment.
The unit-cost sum is a deterministic tie-break, not expected spending. Likewise, lower category concentration is a preference after coverage, not permission to violate a required profile. A menu with three covered choices for each profile outranks one with only two, even if the latter looks more varied. With zero recipients, return an empty no-launch result; there is no funded campaign to display.
The funding bound follows directly from the purchase rule. With at most one gift for each of N recipients, there can be at most N purchased gift units. Each unit costs no more than the highest selected unit amount under the approved basis. Multiplying those two bounds and then adding every selected setup and the reserve therefore covers that stated scenario. It does not cover an extra gift per person or an unquoted charge outside the basis.
Minimum quantities deserve particular attention. If a supplier requires a batch purchase for each displayed option, you may owe for unchosen stock as well as the gifts recipients select. That is a different obligation from one unit per recipient at the approved all-in rate. Do not enter a retail-looking price and assume the formula covers mandatory batch purchases. Ask procurement to establish an applicable bound or change the offer before using this selector.
Worked decision one: a $350 limit selects pen, tote and bottle
Assume 20 recipients, a three-function menu, a $20 reserve and a $350 approved limit. Every candidate below is assumed available for all 20 recipients, with zero setup charges evidenced within this constructed example. The three profiles are no food, no sizing and no power; each requires at least two suitable options. These are separate profiles for this example, not a claim that every intersection has also been covered.
Constructed US input matrix; prices are assumed all-in unit amounts, not vendor quotations:
| ID and function | Category | Unit cost | No food | No sizing | No power |
|---|---|---|---|---|---|
| A — notebook | Stationery | $12 | 1 | 1 | 1 |
| B — pen | Stationery | $8 | 1 | 1 | 1 |
| C — tote | Carry | $11 | 1 | 1 | 1 |
| D — bottle | Drinkware | $15 | 1 | 1 | 1 |
| E — chocolate | Food | $10 | 0 | 1 | 1 |
| F — power bank | Technology | $14 | 1 | 1 | 0 |
Running the implementation returns B,C,D: pen, tote and bottle. Coverage is three for every profile, and the largest category count is one. Its unit-cost sum is $8 + $11 + $15 = $34. The liability is 20 × $15 + $0 setup + $20 reserve = $320, or 32,000 cents, within the $350 limit.
A,C,D ties on coverage and category concentration but has a higher tie cost: $12 + $11 + $15 = $38. A,B,C has full coverage too, but two stationery items create a largest category count of two. The ranking therefore selects B,C,D. It has not predicted that the bottle will be popular; it has selected a menu that remains funded even if everyone chooses it.
The buyer can proceed to menu approval only after replacing the assumed evidence with confirmed inputs. If D cannot serve all 20, remove or update it and rerun rather than presenting a first-come limit the calculation did not model. If the bottle fails a newly declared profile, add the actual profile and reassess every subset. Acceptance concerns the stated matrix and quote basis, not a universal claim about these product names.
Worked decision two: a $270 limit changes the tradeoff
Hold the same recipients, candidates, suitability, setup and reserve constant, but reduce the approved budget to $270. The first menu's $320 liability now fails by $50. Do not assume that some recipients will decline or choose cheaper items to recover that difference. The cost test protects a choice each person is allowed to make.
The executed result becomes A,B,C: notebook, pen and tote. Each profile still has three suitable options. The largest category count rises from one to two because notebook and pen both belong to stationery. The tie cost is $12 + $8 + $11 = $31, and liability is 20 × $12 + $0 setup + $20 reserve = $260, or 26,000 cents.
The $10 difference between the $270 limit and $260 liability is uncommitted headroom under this input basis; it does not replace the $20 reserve already included. The coordinator now has a clear decision: accept the more concentrated but fully covered menu, or ask the owner to change an input and rerun. Quietly reclassifying the pen as technology would conceal the tradeoff rather than solve it.
Suppose the supplier subsequently adds setup charges. Those belong in the rows, and all selected setup charges enter the liability. Or suppose a delivery quote excludes a destination previously covered. The approved cost basis is no longer the one used for selection. Hold the affected menu while the owner resolves the new costs, rather than using an old selected status as permission to launch.
The comparison does not say that a lower budget always selects stationery, or that this specific menu is optimal under another organization's priorities. It shows the consequence of this ranking for this verified-or-assumed matrix. If category breadth must be a hard requirement, that would be a changed model contract, requiring explicit agreement and new validation rather than a hidden exception.
Run the complete selector and reproduce the outputs
The Python implementation below uses only the standard library. Money is stored as integer cents, and the demonstration references identify assumptions rather than real procurement evidence. Replace those references and values with checked project inputs before relying on a result. Different products can share a function in the candidate list, but they cannot occupy two selected slots together.
from itertools import combinations
from collections import Counter
import re
def integer(value, name, low=0, high=None):
if type(value) is not int or value < low or (high is not None and value > high):
raise ValueError(name + ': invalid integer')
def text(value, name):
if type(value) is not str or not value.strip():
raise ValueError(name + ': missing text/evidence')
def select_menu(plan):
required = {'N', 'K', 'B', 'R', 'currency', 'basis', 'floors', 'rows'}
if type(plan) is not dict or set(plan) != required:
raise ValueError('plan: incorrect fields')
for key in ('N', 'B', 'R'):
integer(plan[key], key)
integer(plan['K'], 'K', 1, 6)
text(plan['currency'], 'currency')
if not re.fullmatch(r'[A-Z]{3}', plan['currency']):
raise ValueError('currency: use one three-letter code')
text(plan['basis'], 'basis')
floors, rows = plan['floors'], plan['rows']
if type(floors) is not dict or not floors:
raise ValueError('floors: at least one named profile')
for profile, floor in floors.items():
text(profile, 'profile')
integer(floor, 'floor')
if type(rows) is not list or len(rows) > 20:
raise ValueError('rows: maximum 20 candidates')
fields = {'id', 'label', 'function', 'category', 'unit', 'setup',
'available', 'capacity', 'currency', 'basis', 'suitable',
'cost_ref', 'supply_ref', 'suit_ref'}
seen = set()
for row in rows:
if type(row) is not dict or set(row) != fields:
raise ValueError('row: incorrect fields')
identifier = row['id']
text(identifier, 'id')
if not re.fullmatch(r'[A-Za-z0-9][A-Za-z0-9_-]*', identifier):
raise ValueError('id: stable ASCII key required')
if identifier in seen:
raise ValueError('id: duplicate')
seen.add(identifier)
for key in ('label', 'function', 'category', 'cost_ref', 'supply_ref'):
text(row[key], key)
for key in ('unit', 'setup', 'capacity'):
integer(row[key], key)
integer(row['available'], 'available', 0, 1)
if row['currency'] != plan['currency'] or row['basis'] != plan['basis']:
raise ValueError('row: mixed currency or cost basis')
for key in ('suitable', 'suit_ref'):
if type(row[key]) is not dict or set(row[key]) != set(floors):
raise ValueError(key + ': exact profile keys required')
for profile in floors:
integer(row['suitable'][profile], 'suitability', 0, 1)
text(row['suit_ref'][profile], 'suitability evidence')
if plan['N'] == 0:
return {'status': 'no_launch', 'ids': [], 'coverage': {}, 'L': 0}
eligible = sorted((r for r in rows if r['available'] == 1
and r['capacity'] >= plan['N']), key=lambda r: r['id'])
best = None
for subset in combinations(eligible, plan['K']):
if len({r['function'] for r in subset}) != plan['K']:
continue
coverage = {p: sum(r['suitable'][p] for r in subset) for p in floors}
if any(coverage[p] < floors[p] for p in floors):
continue
liability = (plan['N'] * max(r['unit'] for r in subset)
+ sum(r['setup'] for r in subset) + plan['R'])
if liability > plan['B']:
continue
ids = tuple(r['id'] for r in subset)
concentration = max(Counter(r['category'] for r in subset).values())
tie_cost = sum(r['unit'] for r in subset)
score = (-min(coverage.values()), concentration, tie_cost, ids)
result = {'status': 'selected', 'ids': list(ids), 'coverage': coverage,
'largest_category': concentration, 'unit_sum': tie_cost,
'L': liability}
if best is None or score < best[0]:
best = (score, result)
return best[1] if best else {'status': 'no_solution', 'ids': []}
def example():
profiles = ('no_food', 'no_sizing', 'no_power')
rows = []
data = [('A', 'Notebook', 'notebook', 'stationery', 1200, (1, 1, 1)),
('B', 'Pen', 'pen', 'stationery', 800, (1, 1, 1)),
('C', 'Tote', 'tote', 'carry', 1100, (1, 1, 1)),
('D', 'Bottle', 'bottle', 'drinkware', 1500, (1, 1, 1)),
('E', 'Chocolate', 'chocolate', 'food', 1000, (0, 1, 1)),
('F', 'Power bank', 'power_bank', 'technology', 1400, (1, 1, 0))]
for identifier, label, function, category, unit, values in data:
rows.append(dict(id=identifier, label=label, function=function,
category=category, unit=unit, setup=0, available=1,
capacity=20, currency='USD', basis='demo_all_in',
suitable=dict(zip(profiles, values)),
cost_ref='assumed demo cost and zero setup',
supply_ref='assumed capacity of 20',
suit_ref={p: 'assumed demo verification' for p in profiles}))
return dict(N=20, K=3, B=35000, R=2000, currency='USD',
basis='demo_all_in', floors={p: 2 for p in profiles}, rows=rows)
if __name__ == '__main__':
import json
plan = example()
print(json.dumps(select_menu(plan), sort_keys=True))
plan['B'] = 27000
print(json.dumps(select_menu(plan), sort_keys=True))
Running the code prints the following two selected results. Coverage keys name the actual profiles, and all monetary output fields remain cents:
{"L": 32000, "coverage": {"no_food": 3, "no_power": 3, "no_sizing": 3}, "ids": ["B", "C", "D"], "largest_category": 1, "status": "selected", "unit_sum": 3400}
{"L": 26000, "coverage": {"no_food": 3, "no_power": 3, "no_sizing": 3}, "ids": ["A", "B", "C"], "largest_category": 2, "status": "selected", "unit_sum": 3100}
Enumeration is deliberate: with at most 20 candidates and K at most six, the search is bounded by 38,760 subsets for a fixed K. This is an exact comparison over the submitted candidates, not proof that the best product exists somewhere outside the shortlist. An omitted or incorrectly encoded option cannot be recovered by the ranking.
For an optional spreadsheet audit of one selected subset, use a binary selection column and a corresponding suitability column for each profile. Microsoft's SUMPRODUCT documentation explains corresponding-array multiplication and summation, requires equal dimensions and notes that nonnumeric entries are treated as zero. Validate the inputs first; a spreadsheet's quiet conversion of text to zero is not verification of an unknown suitability value. This audit checks arithmetic, not the model's procurement assumptions.
Read the actual boundary checks alongside the result
The implementation was executed against 40 boundary and validation fixtures: 40 passed and zero failed. Those are software checks on constructed inputs, not recipient trials or evidence of commercial outcomes. Key cases and actual results are summarized below.
| Fixture | Constructed input | Actual result |
|---|---|---|
| Exact budget and one-cent excess | Restrict candidates to B,C,D; reserve 2,000; compare budgets 32,000 and 31,999 | Selected at 32,000; no solution at 31,999 |
| Every setup included | B,C,D setups 100,200,300; budget 32,600 | Liability 32,600; reducing budget by one cent fails |
| Zero reserve and zero recipients | B,C,D with reserve zero; separately N zero and empty candidates | Liability 30,000; separate case returns no launch |
| Known zero versus unknown | One eligible zero-cost candidate with evidence; missing cost or empty evidence separately | Zero accepted; missing or unsupported cost rejected |
| Joint coverage | A=(1,0,0), B=(0,1,0), C=(1,1,1) for no food, no sizing, both; floors two | No solution despite separate coverage of two |
| Joint option added | Add D=(1,1,1); equal costs and distinct categories | A,C,D; joint coverage two |
| Stable final tie | Six equal-cost, fully suitable candidates with distinct categories; reverse input order | A,B,C in either row order |
| Input and supply checks | Duplicate IDs, mixed bases, unknown flags or Boolean integers; separately remove D or reduce capacity | Invalid inputs rejected; changed supply selects A,B,C |
The joint fixture assigns each candidate the same assumed unit cost and its own category. Its failure is meaningful: satisfying two separate columns does not meet a floor of two in the intersection column. Removing a product also triggers a fresh calculation of every profile; the output does not retain obsolete coverage from a previous menu.
No-solution is a usable result. Check the verified inputs and identify whether more candidates, a changed budget or another explicitly approved requirement would help. Do not turn unknown flags into ones or reduce the reserve silently to obtain a menu. Retain the original failed run so the reason for changing the decision is visible.
Hand procurement a menu with its boundaries
Before invitations, retain the candidate evidence, profile definitions and floors, input count, budget, reserve, currency, basis and selected output together. Procurement should be able to explain what the menu covers and why the next-ranked alternative lost. The selected IDs must resolve to the exact products, customization and delivery scope in the quote.
Confirm again that any selected item can supply the entire N under that basis. This model does not reserve stock, place orders or allocate scarce quantities between recipients. If a menu uses inventory caps, variable tier pricing or destination-dependent costs that are not bounded by the approved unit costs, revise the inputs or use a suitable separate model before making the choices available.
Read the status explicitly during handoff. A selected result means a feasible subset was found under the supplied contract. No solution means valid inputs produced no qualifying menu. No launch means the recipient count is zero. A validation exception means the inputs were not accepted at all. These states call for different actions; an empty ID list should never be turned into a storefront with default products to make the launch appear complete.
Rerun when quotes, availability, recipient count, profile definitions or menu eligibility change. Keep a decline route and the actual product information visible to recipients, but do not present suitability flags as a promise that everyone will like an option. The calculation establishes the declared coverage and funding bound; people still make their own choices.
Bring the selected menu and quote assumptions to Giftpack
The benefits coordinator can now replace the three nearly identical drinkware choices with an explainable menu. Under the first constructed budget, pen, tote and bottle offer three functions with full declared coverage. Under the tighter budget, notebook, pen and tote preserve coverage while concentrating two choices in stationery. Finance can see the maximum liability without a popularity forecast.
Giftpack describes recipient choice, merchandise and delivery services. Bring the proposed products, recipient count, approved amount, profile requirements and cost basis to discuss actual availability and quotations. Ask how the quoted quantities, setup charges, packaging and destinations affect the menu before treating any candidate as verified.
For original products or packaging, Giftpack's custom merchandise service provides a relevant discussion route for concepts, samples and production requirements. This selector's automated operation or native integration with Giftpack has not been established. Its value here is a reproducible buyer decision that can be checked against an actual offer before invitations go out.

