Pipeline controller: plan 2 (hard +, error +50 %), backlog throttle, 2 trajectory workers, stop rules, summaries every 50; budget reserve
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
76
tasks_gen/train/G1041/spec.md
Normal file
76
tasks_gen/train/G1041/spec.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# 1. Goal
|
||||
A zoo keeps a feed store. Two suppliers send their feed deliveries. The store
|
||||
manager needs one consolidated stock list per feed type, the quantity of one
|
||||
feed type, and the feed type with the highest quantity. A store program calls
|
||||
the class for each delivery round.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Interface {{P}}IF_FEED_STOCK exists in package $TMP. It is active.
|
||||
- The interface has these types:
|
||||
- TY_FEED_TYPE (CHAR 8), TY_UNIT (CHAR 3), TY_QUANTITY (packed, 3 decimals).
|
||||
- TY_DELIVERY with the fields FEED_TYPE, UNIT and QUANTITY.
|
||||
- TT_DELIVERY: a table of TY_DELIVERY.
|
||||
- TY_STOCK with the fields FEED_TYPE, UNIT, QUANTITY and DELIVERIES
|
||||
(integer).
|
||||
- TT_STOCK: a table of TY_STOCK.
|
||||
- The interface has three methods:
|
||||
- CONSOLIDATE with the importing parameters IT_SUPPLIER_A and IT_SUPPLIER_B
|
||||
(both TT_DELIVERY) and the returning parameter RT_STOCK (TT_STOCK).
|
||||
- QUANTITY_OF with the importing parameters IT_STOCK (TT_STOCK) and
|
||||
IV_FEED_TYPE (TY_FEED_TYPE) and the returning parameter RV_QUANTITY
|
||||
(TY_QUANTITY).
|
||||
- TOP_FEED with the importing parameter IT_STOCK (TT_STOCK) and the
|
||||
returning parameter RV_FEED_TYPE (TY_FEED_TYPE).
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}FEED_STOCK in package $TMP.
|
||||
- The class is public, final, and has a public constructor without parameters.
|
||||
- The class implements {{P}}IF_FEED_STOCK.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
|
||||
## 5.1 Input
|
||||
- A delivery row has the fields FEED_TYPE, UNIT and QUANTITY.
|
||||
- The caller passes two delivery lists: supplier A and supplier B. Each list
|
||||
can hold any number of rows, including none.
|
||||
|
||||
## 5.2 CONSOLIDATE
|
||||
1. Count a row only when its feed type is not empty and its quantity is not
|
||||
zero. Ignore every other row.
|
||||
2. Read the counted rows of supplier A first, in the given order, then the
|
||||
counted rows of supplier B, in the given order.
|
||||
3. Group the counted rows by feed type. The result has one row per feed type.
|
||||
4. The quantity of a result row is the sum of the quantities of the counted
|
||||
rows of this feed type. A negative quantity reduces the sum.
|
||||
5. The unit of a result row is the unit of the first counted row of this feed
|
||||
type.
|
||||
6. The deliveries of a result row is the number of counted rows of this feed
|
||||
type.
|
||||
7. Remove a result row whose quantity is zero.
|
||||
8. Sort the result rows by feed type in ascending order.
|
||||
9. Return an empty list when no result row remains.
|
||||
|
||||
## 5.3 QUANTITY_OF
|
||||
1. Return the quantity of the result row with the given feed type.
|
||||
2. Return zero when the list has no row with this feed type.
|
||||
|
||||
## 5.4 TOP_FEED
|
||||
1. Return the feed type with the highest quantity in the list.
|
||||
2. When more than one feed type has the same highest quantity, return the feed
|
||||
type that comes first in ascending order.
|
||||
3. Return an empty feed type when the list is empty.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
||||
variables. No comment that restates the code.
|
||||
- Out of scope: do not change {{P}}IF_FEED_STOCK.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
Reference in New Issue
Block a user