{"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/learning-solution-aware-transformers-for","title":"Learning Solution-Aware Transformers for Efficiently Solving Quadratic Assignment Problem","arxiv_id":"2406.09899","date":"2024-06-14","proceeding":null,"authors":["Zhentao Tan","Yadong Mu"],"abstract":"Recently various optimization problems, such as Mixed Integer Linear Programming Problems (MILPs), have undergone comprehensive investigation, leveraging the capabilities of machine learning. This work focuses on learning-based solutions for efficiently solving the Quadratic Assignment Problem (QAPs), which stands as a formidable challenge in combinatorial optimization. While many instances of simpler problems admit fully polynomial-time approximate solution (FPTAS), QAP is shown to be strongly NP-hard. Even finding a FPTAS for QAP is difficult, in the sense that the existence of a FPTAS implies $P = NP$. Current research on QAPs suffer from limited scale and computational inefficiency. To attack the aforementioned issues, we here propose the first solution of its kind for QAP in the learn-to-improve category. This work encodes facility and location nodes separately, instead of forming computationally intensive association graphs prevalent in current approaches. This design choice enables scalability to larger problem sizes. Furthermore, a \\textbf{S}olution \\textbf{AW}are \\textbf{T}ransformer (SAWT) architecture integrates the incumbent solution matrix with the attention score to effectively capture higher-order information of the QAPs. Our model's effectiveness is validated through extensive experiments on self-generated QAP instances of varying sizes and the QAPLIB benchmark.","url_abs":"https://arxiv.org/abs/2406.09899v2","url_pdf":"https://arxiv.org/pdf/2406.09899v2.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":"learning-solution-aware-transformers-for","repo_url":"https://github.com/pkutan/sawt","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"combinatorial-optimization","task_name":"Combinatorial Optimization"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2406.09899","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2406.09899"}},"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":"deterministic:regex_extraction","url":"https://github.com/PKUTAN/SAWT","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/pkutan/sawt","reach":{"status":"ok"}}],"summary":{"ran":8,"ran_fixture":1,"ran_draft_wrong":2,"ran_violates":1,"unverified":3},"by_repo_kind":{"official":{"samples":15,"ran":12,"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":15,"samples":[{"code_sha256_prefix":"344126b9167b8820","entry":"Decoder","repo":"pkutan/sawt","repo_kind":"official","path":"ActorCriticNetwork_qap_mixEncoder.py","file_url":"https://github.com/pkutan/sawt/blob/HEAD/ActorCriticNetwork_qap_mixEncoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"344126b9167b8820"}},{"code_sha256_prefix":"ad1592f8418dd699","entry":"MixEncoderLayer","repo":"pkutan/sawt","repo_kind":"official","path":"ActorCriticNetwork_qap_mixEncoder.py","file_url":"https://github.com/pkutan/sawt/blob/HEAD/ActorCriticNetwork_qap_mixEncoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ad1592f8418dd699"}},{"code_sha256_prefix":"1f4519e85832b377","entry":"MultiHeadAttentionMixedScore","repo":"pkutan/sawt","repo_kind":"official","path":"ActorCriticNetwork_qap_mixEncoder.py","file_url":"https://github.com/pkutan/sawt/blob/HEAD/ActorCriticNetwork_qap_mixEncoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1f4519e85832b377"}},{"code_sha256_prefix":"9c08d66abe21cb78","entry":"PositionwiseFeedForward","repo":"pkutan/sawt","repo_kind":"official","path":"ActorCriticNetwork_qap_mixEncoder.py","file_url":"https://github.com/pkutan/sawt/blob/HEAD/ActorCriticNetwork_qap_mixEncoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9c08d66abe21cb78"}},{"code_sha256_prefix":"4c3e30be7eb37800","entry":"ScaledDotProductAttention","repo":"pkutan/sawt","repo_kind":"official","path":"ActorCriticNetwork_qap_mixEncoder.py","file_url":"https://github.com/pkutan/sawt/blob/HEAD/ActorCriticNetwork_qap_mixEncoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4c3e30be7eb37800"}},{"code_sha256_prefix":"a58ececd126c8848","entry":"batch_pair_squared_dist_no_norm","repo":"pkutan/sawt","repo_kind":"official","path":"ActorCriticNetwork_qap_mixEncoder.py","file_url":"https://github.com/pkutan/sawt/blob/HEAD/ActorCriticNetwork_qap_mixEncoder.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a58ececd126c8848"}},{"code_sha256_prefix":"cd5ef304a9b9e96e","entry":"generate_erdos_qap_instances","repo":"PKUTAN/SAWT","repo_kind":"official","path":"QAP_DataGenerator.py","file_url":"https://github.com/PKUTAN/SAWT/blob/HEAD/QAP_DataGenerator.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cd5ef304a9b9e96e"}},{"code_sha256_prefix":"b37ca5512ebfa749","entry":"generate_erdos_qap_instances_0_1","repo":"PKUTAN/SAWT","repo_kind":"official","path":"QAP_DataGenerator.py","file_url":"https://github.com/PKUTAN/SAWT/blob/HEAD/QAP_DataGenerator.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b37ca5512ebfa749"}},{"code_sha256_prefix":"41a05afe6cb8cabe","entry":"generate_erdos_qap_instances_int","repo":"PKUTAN/SAWT","repo_kind":"official","path":"QAP_DataGenerator.py","file_url":"https://github.com/PKUTAN/SAWT/blob/HEAD/QAP_DataGenerator.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"41a05afe6cb8cabe"}},{"code_sha256_prefix":"733cd4727b4ed611","entry":"get_pad_mask","repo":"PKUTAN/SAWT","repo_kind":"official","path":"transformer/Models.py","file_url":"https://github.com/PKUTAN/SAWT/blob/HEAD/transformer/Models.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"733cd4727b4ed611"}},{"code_sha256_prefix":"1eedfb10edb08c8a","entry":"get_subsequent_mask","repo":"PKUTAN/SAWT","repo_kind":"official","path":"transformer/Models.py","file_url":"https://github.com/PKUTAN/SAWT/blob/HEAD/transformer/Models.py","link_basis":"plan_row","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1eedfb10edb08c8a"}},{"code_sha256_prefix":"459fe521069329c6","entry":"reshape_by_heads","repo":"PKUTAN/SAWT","repo_kind":"official","path":"transformer/Layers.py","file_url":"https://github.com/PKUTAN/SAWT/blob/HEAD/transformer/Layers.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"459fe521069329c6"}},{"code_sha256_prefix":"dcb619a621a712da","entry":"ActorCriticNetwork","repo":"pkutan/sawt","repo_kind":"official","path":"ActorCriticNetwork_qap_mixEncoder.py","file_url":"https://github.com/pkutan/sawt/blob/HEAD/ActorCriticNetwork_qap_mixEncoder.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"dcb619a621a712da"}},{"code_sha256_prefix":"995fc2d49101be12","entry":"Encoder","repo":"pkutan/sawt","repo_kind":"official","path":"ActorCriticNetwork_qap_mixEncoder.py","file_url":"https://github.com/pkutan/sawt/blob/HEAD/ActorCriticNetwork_qap_mixEncoder.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"995fc2d49101be12"}},{"code_sha256_prefix":"f9a43158498be829","entry":"batch_pair_squared_dist","repo":"pkutan/sawt","repo_kind":"official","path":"ActorCriticNetwork_qap_mixEncoder.py","file_url":"https://github.com/pkutan/sawt/blob/HEAD/ActorCriticNetwork_qap_mixEncoder.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f9a43158498be829"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}