Per Item Prefix Capacity Admission
Admit only the longest affordable ordered prefix of explicit per-item costs; after the first failure later cheaper items are not skipped into admission.
Description
Admit only the longest affordable ordered prefix of explicit per-item costs; after the first failure later cheaper items are not skipped into admission.
Prefix admission preserves request order by stopping at the first unaffordable item. It does not skip that item to admit cheaper later requests.
When to use this tool
Admit only the longest affordable ordered prefix of explicit per-item costs; after the first failure later cheaper items are not skipped into admission.
- Prepare the supplied costs, budget fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter costs, budget. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.admittedCount, result.used, result.remainder, result.rejectedIndexes. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Require nonnegative costs and budget. Accumulate costs until adding the next would exceed budget, then return admittedCount, used, remainder and all remaining source indexes as rejected.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| costs | costs. | List of finite numbers; at most 128 entries |
| budget | budget. | Finite number |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.admittedCount | The admitted count value under the stated formula or text convention. |
| result.used | The used value under the stated formula or text convention. |
| result.remainder | The remainder value under the stated formula or text convention. |
| result.rejectedIndexes | The rejected indexes list in the ordering and representation described above. |
{
"input": {
"costs": [
2,
5,
1
],
"budget": 6
},
"output": {
"result": {
"admittedCount": 1,
"used": 2,
"remainder": 4,
"rejectedIndexes": [
1,
2
]
}
}
} Limitations and assumptions
- Zero-cost items can be admitted while in the prefix. The result is not a knapsack optimum or a policy for independent later requests.
- All declared input fields are required and unexpected top-level fields are rejected. Numbers must be finite; lists are limited to 128 entries and ordinary text fields to 8,192 UTF-16 code units, with tighter limits where stated.
- JSON text inputs must parse within bounded nesting and size limits. Numeric outputs outside the safe finite range are rejected; large exact integer results use decimal strings. Indexes and half-open spans are zero-based unless a rank is explicitly described as one-based.
Alternative or Complementary methods
Check the arithmetic against the actual scheduling or storage policy. Add variable costs, arrivals, concurrent state and overhead in a model that explicitly represents them when they affect the decision.
References
Similar or alternative tools
- Capacity Reserve Percent Budget
Reserve a ceiling-rounded percentage of integer capacity and expose the usable whole-unit budget; explicit arithmetic, not availability certification.
- Round Robin Budget Allocation
Allocate integer capacity one unit per active demand in stable round-robin order, retaining unused budget once all demands are satisfied.