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:
16
tasks_gen/train/G1311/generation.json
Normal file
16
tasks_gen/train/G1311/generation.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"id": "G1311",
|
||||
"pool": "train",
|
||||
"category": "K",
|
||||
"base_task": "G1009",
|
||||
"style": "incomplete",
|
||||
"tool_schema": null,
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
140
tasks_gen/train/G1311/hidden/t31_hidden.clas.abap
Normal file
140
tasks_gen/train/G1311/hidden/t31_hidden.clas.abap
Normal file
@@ -0,0 +1,140 @@
|
||||
CLASS {{p}}t31_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}fish_auction.
|
||||
METHODS setup.
|
||||
METHODS sums_two_species FOR TESTING.
|
||||
METHODS counts_distinct_boats FOR TESTING.
|
||||
METHODS ignores_zero_weight FOR TESTING.
|
||||
METHODS ignores_blank_species FOR TESTING.
|
||||
METHODS trims_and_uppercases FOR TESTING.
|
||||
METHODS sorts_by_species FOR TESTING.
|
||||
METHODS empty_input FOR TESTING.
|
||||
METHODS all_entries_invalid FOR TESTING.
|
||||
METHODS best_species_highest FOR TESTING.
|
||||
METHODS best_species_tie FOR TESTING.
|
||||
METHODS best_species_none FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t31_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}fish_auction( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sums_two_species.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = 'COD' weight_kg = 100 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 50 )
|
||||
( boat_id = 'B1' species = 'HERRING' weight_kg = 30 ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 2 ).
|
||||
READ TABLE lt_result INTO DATA(ls_row) WITH KEY species = 'COD'.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-total_weight exp = 150 ).
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-boat_count exp = 2 ).
|
||||
READ TABLE lt_result INTO ls_row WITH KEY species = 'HERRING'.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-total_weight exp = 30 ).
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-boat_count exp = 1 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD counts_distinct_boats.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = 'COD' weight_kg = 10 )
|
||||
( boat_id = 'B1' species = 'COD' weight_kg = 20 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 5 ) ) ).
|
||||
|
||||
READ TABLE lt_result INTO DATA(ls_row) WITH KEY species = 'COD'.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-total_weight exp = 35 ).
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-boat_count exp = 2 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ignores_zero_weight.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = 'COD' weight_kg = 0 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = -5 )
|
||||
( boat_id = 'B3' species = 'COD' weight_kg = 7 ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 1 ).
|
||||
READ TABLE lt_result INTO DATA(ls_row) WITH KEY species = 'COD'.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-total_weight exp = 7 ).
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-boat_count exp = 1 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ignores_blank_species.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = '' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = ' ' weight_kg = 20 )
|
||||
( boat_id = 'B3' species = 'COD' weight_kg = 5 ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 1 ).
|
||||
READ TABLE lt_result INTO DATA(ls_row) WITH KEY species = 'COD'.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-total_weight exp = 5 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD trims_and_uppercases.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = ' cod ' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 20 ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 1 ).
|
||||
READ TABLE lt_result INTO DATA(ls_row) WITH KEY species = 'COD'.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-total_weight exp = 30 ).
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-boat_count exp = 2 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorts_by_species.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = 'TUNA' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 20 )
|
||||
( boat_id = 'B3' species = 'MACKEREL' weight_kg = 5 ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 3 ).
|
||||
READ TABLE lt_result INTO DATA(ls_row) INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-species exp = 'COD' ).
|
||||
READ TABLE lt_result INTO ls_row INDEX 3.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-species exp = 'TUNA' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_input.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #( ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 0 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD all_entries_invalid.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = ' ' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 0 ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 0 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD best_species_highest.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = mo_cut->best_species( VALUE #(
|
||||
( boat_id = 'B1' species = 'COD' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = 'TUNA' weight_kg = 40 )
|
||||
( boat_id = 'B3' species = 'HERRING' weight_kg = 25 ) ) )
|
||||
exp = 'TUNA' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD best_species_tie.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = mo_cut->best_species( VALUE #(
|
||||
( boat_id = 'B1' species = 'TUNA' weight_kg = 30 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 30 ) ) )
|
||||
exp = 'COD' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD best_species_none.
|
||||
cl_abap_unit_assert=>assert_initial( mo_cut->best_species( VALUE #( ) ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
96
tasks_gen/train/G1311/reference/fish_auction.clas.abap
Normal file
96
tasks_gen/train/G1311/reference/fish_auction.clas.abap
Normal file
@@ -0,0 +1,96 @@
|
||||
CLASS {{p}}fish_auction DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_species TYPE c LENGTH 10.
|
||||
TYPES ty_boat_id TYPE c LENGTH 10.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_catch,
|
||||
boat_id TYPE ty_boat_id,
|
||||
species TYPE ty_species,
|
||||
weight_kg TYPE i,
|
||||
END OF ty_catch.
|
||||
TYPES tt_catch TYPE STANDARD TABLE OF ty_catch WITH EMPTY KEY.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_summary,
|
||||
species TYPE ty_species,
|
||||
total_weight TYPE i,
|
||||
boat_count TYPE i,
|
||||
END OF ty_summary.
|
||||
TYPES tt_summary TYPE STANDARD TABLE OF ty_summary WITH EMPTY KEY.
|
||||
|
||||
METHODS summarize
|
||||
IMPORTING it_catch TYPE tt_catch
|
||||
RETURNING VALUE(rt_summary) TYPE tt_summary.
|
||||
|
||||
METHODS best_species
|
||||
IMPORTING it_catch TYPE tt_catch
|
||||
RETURNING VALUE(rv_species) TYPE ty_species.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_boat_species,
|
||||
species TYPE ty_species,
|
||||
boat_id TYPE ty_boat_id,
|
||||
END OF ty_boat_species,
|
||||
tt_boat_species TYPE HASHED TABLE OF ty_boat_species
|
||||
WITH UNIQUE KEY species boat_id.
|
||||
|
||||
METHODS species_key
|
||||
IMPORTING iv_species TYPE ty_species
|
||||
RETURNING VALUE(rv_species) TYPE ty_species.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}fish_auction IMPLEMENTATION.
|
||||
|
||||
METHOD summarize.
|
||||
DATA lt_total TYPE SORTED TABLE OF ty_summary WITH UNIQUE KEY species.
|
||||
DATA lt_boat_species TYPE tt_boat_species.
|
||||
DATA lv_species TYPE ty_species.
|
||||
|
||||
LOOP AT it_catch INTO DATA(ls_catch).
|
||||
lv_species = species_key( ls_catch-species ).
|
||||
IF lv_species IS INITIAL OR ls_catch-weight_kg <= 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
|
||||
READ TABLE lt_total WITH TABLE KEY species = lv_species
|
||||
ASSIGNING FIELD-SYMBOL(<ls_total>).
|
||||
IF sy-subrc <> 0.
|
||||
INSERT VALUE #( species = lv_species ) INTO TABLE lt_total.
|
||||
READ TABLE lt_total WITH TABLE KEY species = lv_species
|
||||
ASSIGNING <ls_total>.
|
||||
ENDIF.
|
||||
<ls_total>-total_weight = <ls_total>-total_weight + ls_catch-weight_kg.
|
||||
|
||||
INSERT VALUE #( species = lv_species boat_id = ls_catch-boat_id )
|
||||
INTO TABLE lt_boat_species.
|
||||
IF sy-subrc = 0.
|
||||
<ls_total>-boat_count = <ls_total>-boat_count + 1.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
rt_summary = lt_total.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD best_species.
|
||||
DATA(lt_summary) = summarize( it_catch ).
|
||||
DATA lv_best_weight TYPE i.
|
||||
|
||||
LOOP AT lt_summary INTO DATA(ls_summary).
|
||||
IF ls_summary-total_weight > lv_best_weight.
|
||||
lv_best_weight = ls_summary-total_weight.
|
||||
rv_species = ls_summary-species.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD species_key.
|
||||
DATA lv_species TYPE ty_species.
|
||||
lv_species = iv_species.
|
||||
SHIFT lv_species LEFT DELETING LEADING space.
|
||||
rv_species = to_upper( lv_species ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,77 @@
|
||||
CLASS ltc_fish_auction DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}fish_auction.
|
||||
METHODS setup.
|
||||
METHODS sums_and_counts FOR TESTING.
|
||||
METHODS ignores_invalid_entries FOR TESTING.
|
||||
METHODS normalizes_species FOR TESTING.
|
||||
METHODS result_is_sorted FOR TESTING.
|
||||
METHODS best_species_wins FOR TESTING.
|
||||
METHODS best_species_tie FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_fish_auction IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}fish_auction( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sums_and_counts.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = 'COD' weight_kg = 100 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 50 )
|
||||
( boat_id = 'B1' species = 'COD' weight_kg = 25 ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 1 ).
|
||||
READ TABLE lt_result INTO DATA(ls_row) WITH KEY species = 'COD'.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-total_weight exp = 175 ).
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-boat_count exp = 2 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ignores_invalid_entries.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = ' ' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 0 ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 0 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD normalizes_species.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = ' tuna' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = 'TUNA ' weight_kg = 20 ) ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( act = lines( lt_result ) exp = 1 ).
|
||||
READ TABLE lt_result INTO DATA(ls_row) WITH KEY species = 'TUNA'.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-total_weight exp = 30 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD result_is_sorted.
|
||||
DATA lt_result TYPE STANDARD TABLE OF {{p}}fish_auction=>ty_summary WITH EMPTY KEY.
|
||||
lt_result = mo_cut->summarize( VALUE #(
|
||||
( boat_id = 'B1' species = 'TUNA' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 10 ) ) ).
|
||||
|
||||
READ TABLE lt_result INTO DATA(ls_row) INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( act = ls_row-species exp = 'COD' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD best_species_wins.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = mo_cut->best_species( VALUE #(
|
||||
( boat_id = 'B1' species = 'COD' weight_kg = 10 )
|
||||
( boat_id = 'B2' species = 'TUNA' weight_kg = 40 ) ) )
|
||||
exp = 'TUNA' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD best_species_tie.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = mo_cut->best_species( VALUE #(
|
||||
( boat_id = 'B1' species = 'TUNA' weight_kg = 30 )
|
||||
( boat_id = 'B2' species = 'COD' weight_kg = 30 ) ) )
|
||||
exp = 'COD' ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
5
tasks_gen/train/G1311/spec.md
Normal file
5
tasks_gen/train/G1311/spec.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Create the public final class {{P}}FISH_AUCTION. It has a public constructor without parameters. Define these public types: TY_SPECIES (character 10), TY_BOAT_ID (character 10), TY_CATCH (structure with BOAT_ID type TY_BOAT_ID, SPECIES type TY_SPECIES, WEIGHT_KG type i), TT_CATCH (table type of TY_CATCH; it can hold more than one entry with the same boat ID and species), TY_SUMMARY (structure with SPECIES type TY_SPECIES, TOTAL_WEIGHT type i, BOAT_COUNT type i), and TT_SUMMARY (table type of TY_SUMMARY). Add these public methods: SUMMARIZE importing IT_CATCH type TT_CATCH returning RT_SUMMARY type TT_SUMMARY; BEST_SPECIES importing IT_CATCH type TT_CATCH returning RV_SPECIES type TY_SPECIES. Do not add other public methods.
|
||||
|
||||
SUMMARIZE must: not change IT_CATCH. For each entry, build a species key: remove leading and trailing blanks from SPECIES and convert all letters to upper case. Ignore the entry if the species key is empty. Ignore the entry if WEIGHT_KG is zero or less. Group the remaining entries by the species key. TOTAL_WEIGHT of a group is the sum of WEIGHT_KG of all entries in the group. BOAT_COUNT of a group is the number of different boat IDs in the group. The result has one row for each group. The rows are in ascending order of the species key. If no entry remains, the result is empty.
|
||||
|
||||
BEST_SPECIES must: build the groups with the same rules as SUMMARIZE. Return the species key of the group with the highest TOTAL_WEIGHT. If two groups have the same highest TOTAL_WEIGHT, return the species key that is first in ascending order. If there is no group, return an empty value.
|
||||
45
tasks_gen/train/G1311/task.json
Normal file
45
tasks_gen/train/G1311/task.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"id": "G1311",
|
||||
"category": "K",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}FISH_AUCTION"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"No other object in package $TMP."
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T31_HIDDEN",
|
||||
"file": "hidden/t31_hidden.clas.abap",
|
||||
"description": "T31 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}FISH_AUCTION",
|
||||
"file": "reference/fish_auction.clas.abap",
|
||||
"description": "Consolidates the catch of the fishing boats",
|
||||
"testclasses_file": "reference/fish_auction.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"nested_loops"
|
||||
],
|
||||
"base_task": "G1009",
|
||||
"input_style": "incomplete"
|
||||
}
|
||||
Reference in New Issue
Block a user