{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/time-fairness-in-online-knapsack-problems","title":"Time Fairness in Online Knapsack Problems","arxiv_id":"2305.13293","date":"2023-05-22","proceeding":null,"authors":["Adam Lechowicz","Rik Sengupta","Bo Sun","Shahin Kamali","Mohammad Hajiesmaili"],"abstract":"The online knapsack problem is a classic problem in the field of online algorithms. Its canonical version asks how to pack items of different values and weights arriving online into a capacity-limited knapsack so as to maximize the total value of the admitted items. Although optimal competitive algorithms are known for this problem, they may be fundamentally unfair, i.e., individual items may be treated inequitably in different ways. We formalize a practically-relevant notion of time fairness which effectively models a trade off between static and dynamic pricing in a motivating application such as cloud resource allocation, and show that existing algorithms perform poorly under this metric. We propose a parameterized deterministic algorithm where the parameter precisely captures the Pareto-optimal trade-off between fairness (static pricing) and competitiveness (dynamic pricing). We show that randomization is theoretically powerful enough to be simultaneously competitive and fair; however, it does not work well in experiments. To further improve the trade-off between fairness and competitiveness, we develop a nearly-optimal learning-augmented algorithm which is fair, consistent, and robust (competitive), showing substantial performance improvements in numerical experiments.","url_abs":"https://arxiv.org/abs/2305.13293v2","url_pdf":"https://arxiv.org/pdf/2305.13293v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"time-fairness-in-online-knapsack-problems","repo_url":"https://github.com/adamlechowicz/fair-knapsack","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":null}],"tasks":[{"task_slug":"fairness","task_name":"Fairness"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2305.13293","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2305.13293"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/adamlechowicz/fair-knapsack","reach":null}],"summary":{"ran_draft_wrong":2,"ran_honours":1,"unverified":2},"by_repo_kind":{"official":{"samples":5,"ran":3,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":5,"samples":[{"code_sha256_prefix":"bbcdd0eec8fd623b","entry":"LAECT","repo":"adamlechowicz/fair-knapsack","repo_kind":"official","path":"knapsack.py","file_url":"https://github.com/adamlechowicz/fair-knapsack/blob/HEAD/knapsack.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bbcdd0eec8fd623b"}},{"code_sha256_prefix":"57a20c9ec8883f16","entry":"alphaLA","repo":"adamlechowicz/fair-knapsack","repo_kind":"official","path":"knapsack.py","file_url":"https://github.com/adamlechowicz/fair-knapsack/blob/HEAD/knapsack.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"57a20c9ec8883f16"}},{"code_sha256_prefix":"6e0b5762a7da7ef4","entry":"dpOptimalKnapsack","repo":"adamlechowicz/fair-knapsack","repo_kind":"official","path":"knapsack.py","file_url":"https://github.com/adamlechowicz/fair-knapsack/blob/HEAD/knapsack.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6e0b5762a7da7ef4"}},{"code_sha256_prefix":"b8f5c3ee94370855","entry":"ZCL","repo":"adamlechowicz/fair-knapsack","repo_kind":"official","path":"knapsack.py","file_url":"https://github.com/adamlechowicz/fair-knapsack/blob/HEAD/knapsack.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b8f5c3ee94370855"}},{"code_sha256_prefix":"835a41b0c1f19255","entry":"ZCLRandomized","repo":"adamlechowicz/fair-knapsack","repo_kind":"official","path":"knapsack.py","file_url":"https://github.com/adamlechowicz/fair-knapsack/blob/HEAD/knapsack.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"835a41b0c1f19255"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}