{"id":21556827,"url":"https://github.com/pinam45/uscp","last_synced_at":"2026-04-30T02:38:23.501Z","repository":{"id":67966169,"uuid":"206561870","full_name":"pinam45/USCP","owner":"pinam45","description":"Unicost Set Covering Problem","archived":false,"fork":false,"pushed_at":"2020-04-26T20:57:10.000Z","size":4752,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-24T10:32:29.639Z","etag":null,"topics":["cpp","cpp17","latex","masc","memetic-algorithms","rwls","uscp"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pinam45.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-05T12:45:37.000Z","updated_at":"2020-04-26T20:57:13.000Z","dependencies_parsed_at":"2023-03-11T02:37:22.156Z","dependency_job_id":null,"html_url":"https://github.com/pinam45/USCP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinam45%2FUSCP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinam45%2FUSCP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinam45%2FUSCP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinam45%2FUSCP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pinam45","download_url":"https://codeload.github.com/pinam45/USCP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244147681,"owners_count":20406028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpp17","latex","masc","memetic-algorithms","rwls","uscp"],"created_at":"2024-11-24T08:10:01.862Z","updated_at":"2026-04-30T02:38:18.484Z","avatar_url":"https://github.com/pinam45.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unicost Set Covering Problem (USCP)\n\n[![Build Status](https://travis-ci.org/pinam45/USCP.svg?branch=master)](https://travis-ci.org/pinam45/USCP)\n[![Build status](https://ci.appveyor.com/api/projects/status/xepey5vj71wws7cq/branch/master?svg=true)](https://ci.appveyor.com/project/pinam45/uscp/branch/master)\n[![license](https://img.shields.io/github/license/pinam45/USCP.svg)](http://opensource.org/licenses/MIT)\n\nThis repository contain documents and code related to the research I made on the USCP during my internship at the [Institut de Recherche en Informatique, Mathématiques, Automatique et Signal (IRIMAS)](https://www.irimas.uha.fr/) laboratory of the [Université de Haute-Alsace (UHA)](https://www.uha.fr/).\n\nThe internship was from *2019-09-02* to *2020-02-07* and was my last year internship for the [Université de technologie de Belfort Montbéliard (UTBM)](https://www.uha.fr/) and the [Université du Québec à Chicoutimi (UQAC)](https://www.uqac.ca/).\n\nThe internship goal was to develop a memetic algorithm inspired from [Moalic2018] using the Row Weighting Local Search (RWLS) algorithm from [Gao2015] as a local search. The final version of the algorithm is named Memetic Algorithm for Set Covering (MASC) and was submitted to the [14th Learning and Intelligent OptimizatioN Conference](http://www.caopt.com/LION14/) (LION14).\n\nThe LION14 submission is \"**A memetic approach on the Unicost Set Cover Problem**\" by\n\n| Name                | Email                      | Institute |\n|:--------------------|:---------------------------|:---------:|\n| Maxime Pinard       | maxime.pin@live.fr         |    1,2    |\n| Laurent Moalic      | laurent.moalic@uha.fr      |    1,2    |\n| Mathieu Brévilliers | mathieu.brevilliers@uha.fr |    1,2    |\n| Julien Lepagnot     | julien.lepagnot@uha.fr     |    1,2    |\n| Lhassane Idoumghar  | lhassane.idoumghar@uha.fr  |    1,2    |\n\n| Ref. | Institute                                                            |\n|:----:|:---------------------------------------------------------------------|\n|  1   | Université de Haute-Alsace, IRIMAS UR 7499, F-68100 Mulhouse, France |\n|  2   | Université de Strasbourg, France                                     |\n\n## documents\n\nThis folder contains documents written in LaTeX. To compile the documents to PDF files, you will need a LaTeX distribution such as [TeX Live](http://tug.org/texlive) that include [LuaTeX](http://www.luatex.org/) installed on your system.\n\nFor each document, a ``.latexmkrc`` is provided so the document can be compiled by running *latexmk* in the document directory:\n```\n$ latexmk -silent\n```\n\n### instances\n\nThis document contain summary tables of instances used to benchmark the implemented methods. The instances described and several more information can be found in [USCP_instances](https://github.com/pinam45/USCP_instances).\n\n## code\n\nThis directory contain the C++ code of the project, the project was implemented in C++17 and uses CMake to configure the build, it is split in 3 targets, a common library and two programs: solver and printer.\n\n### common\n\nThis library contain the basic structures used to represent the USCP, the instances reader and writer functions, all serializable classes, some utility functions and logging related stuff.\n\nIt also contain the database of \"known\" instances from [USCP_instances](https://github.com/pinam45/USCP_instances):\n```\n4.1,4.2,4.3,4.4,4.5,4.6,4.7,4.8,4.9,4.10,5.1,5.2,5.3,5.4,5.5,5.6,5.7,5.8,5.9,5.10,6.1,6.2,6.3,6.4,6.5,A.1,A.2,A.3,A.4,A.5,B.1,B.2,B.3,B.4,B.5,C.1,C.2,C.3,C.4,C.5,D.1,D.2,D.3,D.4,D.5,E.1,E.2,E.3,E.4,E.5,NRE.1,NRE.2,NRE.3,NRE.4,NRE.5,NRF.1,NRF.2,NRF.3,NRF.4,NRF.5,NRG.1,NRG.2,NRG.3,NRG.4,NRG.5,NRH.1,NRH.2,NRH.3,NRH.4,NRH.5,CLR10,CLR11,CLR12,CLR13,CYC6,CYC7,CYC8,CYC9,CYC10,CYC11,RAIL507,RAIL516,RAIL582,RAIL2536,RAIL2586,RAIL4284,RAIL4872,STS9,STS15,STS27,STS45,STS81,STS135,STS243,STS405,STS729,STS1215,STS2187\n```\n\n### solver\n\nThis program solve USCP instances with different algorithms and parameters and generate json reports with the resulting solution and all the resolution information (solving time, steps made,...).\n\nThis program implements 3 algorithms:\n - A deterministic greedy algorithm\n - Row Weighting Local Search (RWLS)\n - Memetic Algorithm for Set Covering (MASC)\n\nIt is a command line program, possible options are given by ``solver --help``:\n```\n      --help                    Print help\n      --version                 Print version\n  -i, --instances NAME          Instances to process\n      --instance_type orlibrary|orlibrary_rail|sts|gvcp\n                                Type of the instance to process\n      --instance_path PATH      Path of the instance to process\n      --instance_name NAME      Name of the instance to process\n  -o, --output_prefix PREFIX    Output file prefix (default: solver_out_)\n  -r, --repetitions N           Repetitions number (default: 1)\n      --greedy                  Solve with greedy algorithm (no repetition as\n                                it is determinist)\n      --rwls                    Improve with RWLS algorithm (start with a\n                                greedy)\n      --rwls_steps N            RWLS steps limit (default:\n                                18446744073709551615)\n      --rwls_time N             RWLS time (seconds) limit (default:\n                                18446744073709551615)\n      --memetic                 Solve with memetic algorithm\n      --memetic_cumulative_rwls_steps N\n                                Memetic cumulative RWLS steps limit (default:\n                                18446744073709551615)\n      --memetic_cumulative_rwls_time N\n                                Memetic cumulative RWLS time (seconds) limit\n                                (default: 18446744073709551615)\n      --memetic_time N          Memetic time limit (default:\n                                18446744073709551615)\n      --memetic_crossover OPERATOR\n                                Memetic crossover operator (default: default)\n      --memetic_wcrossover OPERATOR\n                                Memetic RWLS weights crossover operator\n                                (default: default)\n```\n\nThe known instances are those from the common library, they can be specified using ``--instances=\u003ccomma separated list of instances\u003e``, for an unknown instance, use ``--instance_type=\u003corlibrary|orlibrary_rail|sts|gvcp\u003e --instance_path=\u003cpath\u003e --instance_name=\u003cname\u003e``.\n\nFor the Memetic algorithm, possible crossovers are:\n - **identity**: return the first parent for the first child, return the second parent for the second child\n - **merge**: return a solution with subsets from both parents\n - **greedy_merge**: return a solution generated by taking greedily and alternatively subsets from the first and the second parent\n - **subproblem_random**: return a solution generated by launching a random resolution on the subproblem generated with subsets from both parents\n - **extended_subproblem_random**: return a solution generated by launching a random resolution on the subproblem generated with subsets from both parents and a random solution\n - **subproblem_greedy**: return a solution generated by launching a greedy resolution on the subproblem generated with subsets from both parents\n - **extended_subproblem_greedy**: return a solution generated by launching a greedy resolution on the subproblem generated with subsets from both parents and a random solution\n - **subproblem_rwls**: return a solution generated by launching RWLS on the subproblem generated with subsets from both parents\n - **extended_subproblem_rwls**: return a solution generated by launching RWLS on the subproblem generated with subsets from both parents and a random solution\n\nand possible wcrossover are:\n - **reset**: return a vector with all weights equal to 1\n - **keep**: return a vector with the weights of the first parent for the first child and the weights of the second parent for the second child\n - **average**: return a vector in which each weight is the average of the corresponding weights in the parents\n - **mix_random**: return a vector in which each weight taken randomly from one of the parents\n - **add**: return a vector in which each weight is the sum of the corresponding weights in the parents\n - **difference**: return a vector in which each weight is the difference of the corresponding weights in the parents\n - **max**: return a vector in which each weight is the maximum of the corresponding weights in the parents\n - **min**: return a vector in which each weight is the minimum of the corresponding weights in the parents\n - **minmax**: return a vector with each weight being the minimum of the corresponding weights in the parents for the first child, and each weight being the maximum of the corresponding weights in the parents for the second child\n - **shuffle**: return a vector with the weights of the first parent shuffled for the first child and the weights of the second parent shuffled for the second child\n\nUsage examples:\n - Solve CYC10 and CYC11 instances with RWLS and a limit of 5000 steps:\n```\n./solver --instances=CYC10,CYC11 --rwls --rwls_steps=5000\n```\n - Solve R42, an unknown RAIL instance in ``./rail_42.txt`` using the same format as in OR-Library, with the Memetic algorithm, the subproblem_rwls crossover, the max wcrossover and a limit of 360 seconds:\n```\n./solver --instance_type=orlibrary_rail --instance_path=./rail_42.txt --instance_name=R42 --memetic --memetic_crossover=subproblem_rwls --memetic_wcrossover=max --memetic_time=360\n```\n\nFor more example, see the benchmarks results and launching scripts in [USCP_results](https://github.com/pinam45/USCP_results).\n\nThe program contain a lot of debug asserts and the CMake config will link the address, leak, undefined behaviour and memory sanitizers in debug. When not debugging or testing the solver, please compile the in release to be efficient.\n\n### printer\n\nThis program take as input the reports generated by the solver and process them to generate a LaTeX document containing instances information tables, a results table and optionally a RWLS statistics table, RWLS weights plots and memetic comparison tables.\n\nIt is a command line program, possible options are given by ``printer --help``:\n```\n      --help                  Print help\n      --version               Print version\n  -i, --input FOLDER/FILE     Input folders/files to process\n  -o, --output_prefix PREFIX  Output file prefix (default: printer_out_)\n  -v, --validation REGEX      Input files name validation regex (default:\n                              .*\\.json)\n      --rwls_stats            Generate RWLS stats table\n      --rwls_weights          Generate RWLS weights plots\n      --memetic_comparisons   Generate memetic comparison tables\n```\n\nUsage example:\n - Generate result document with RWLS stats for solver reports stored in ./solver_out:\n```\n./printer --input=./solver_out --rwls_stats\n```\n\nFor more example, see the arguments used for the benchmarks in [USCP_results](https://github.com/pinam45/USCP_results).\n\n### Dependencies\n\nLibraries used:\n- [CMutils](https://github.com/pinam45/CMutils): CMake utilities for C/C++ projects\n- [dynamic_bitset](https://github.com/pinam45/dynamic_bitset): C++17 header-only dynamic bitset \n- [spglog](https://github.com/gabime/spdlog): Fast C++ logging library\n- [inja](https://github.com/pantor/inja): Template Engine for Modern C++\n- [json](https://github.com/nlohmann/json): JSON for Modern C++\n- [cxxopts](https://github.com/jarro2783/cxxopts): Lightweight C++ command line option parser\n\nAll libraries are included as git submodule and built with the project, they don't need to be installed.\n\n### Build\n\nDon't forget to pull the submodules with the repository using ``--recursive``:\n```\ngit clone --recursive https://github.com/pinam45/USCP.git\n```\n\nor if you have already cloned the repository:\n```\ngit submodule update --init\n```\n\nTo build the project you will need a **C++17 compliant compiler** and **CMake 3.10 or later**. The project uses CMake to build, see [Running CMake](https://cmake.org/runningcmake/) for more information.\n\nOn linux, a common CMake use is:\n```\n$ mkdir cmake-build\n$ cd cmake-build\n$ cmake ..\n$ make\n```\n\nOn Windows, there is batch files available to configure a Visual Studio project in the [ide](code/ide) folder.\n\nProject CMake targets:\n - **common**: build the common library\n - **solver**: build the solver\n - **printer**: build the printer\n - **format-common**: format the  common library code\n - **format-solver**: format the solver code\n - **format-printer**: format the printer code\n - **git_info** / **update_git_info**: generate the git_info.hpp file with the git current commit information\n\n### Run\n\nThe programs must be run in the folder containing the resources folder, otherwise instances and documents templates can't be loaded.\n\n## References\n\n```BibTeX\n@Article{Gao2015,\n  author       = {Chao Gao and Xin Yao and Thomas Weise and Jinlong Li},\n  title        = {An efficient local search heuristic with row weighting for the unicost set covering problem},\n  journaltitle = {European Journal of Operational Research},\n  date         = {2015},\n  volume       = {246},\n  number       = {3},\n  pages        = {750--761},\n  issn         = {0377-2217},\n  doi          = {10.1016/j.ejor.2015.05.038},\n  groups       = {Local search, Reviewed},\n  keywords     = {Combinatorial optimization, Unicost set covering problem, Row weighting local search},\n}\n@Article{Moalic2018,\n  author       = {Moalic, Laurent and Gondran, Alexandre},\n  title        = {Variations on memetic algorithms for graph coloring problems},\n  journaltitle = {Journal of Heuristics},\n  date         = {2018-02},\n  volume       = {24},\n  number       = {1},\n  pages        = {1--24},\n  issn         = {1572-9397},\n  doi          = {10.1007/s10732-017-9354-9},\n  keywords     = {Combinatorial optimization, Metaheuristics, Coloring, Graph, Evolutionary},\n  publisher    = {Springer US},\n}\n```\n\n## License\n\n\u003cimg align=\"right\" src=\"http://opensource.org/trademarks/opensource/OSI-Approved-License-100x137.png\"\u003e\n\nUSCP is licensed under the [MIT License](http://opensource.org/licenses/MIT):\n\nCopyright \u0026copy; 2019 [Maxime Pinard](https://github.com/pinam45)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinam45%2Fuscp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpinam45%2Fuscp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinam45%2Fuscp/lists"}