{"id":18609598,"url":"https://github.com/opt-mucca/context-aware-cut-selection","last_synced_at":"2025-10-28T11:09:03.771Z","repository":{"id":181222454,"uuid":"666329865","full_name":"Opt-Mucca/Context-Aware-Cut-Selection","owner":"Opt-Mucca","description":"A Context-Aware Cutting Plane Selection Algorithm for Mixed-Integer Programming","archived":false,"fork":false,"pushed_at":"2023-08-02T07:48:03.000Z","size":73,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-27T01:25:20.263Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Opt-Mucca.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":"2023-07-14T08:45:34.000Z","updated_at":"2024-04-30T01:19:09.000Z","dependencies_parsed_at":"2024-12-27T01:24:43.490Z","dependency_job_id":"9253582b-a223-49d6-8c58-dd09ef2885e1","html_url":"https://github.com/Opt-Mucca/Context-Aware-Cut-Selection","commit_stats":null,"previous_names":["opt-mucca/context-aware-cut-selection"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Opt-Mucca%2FContext-Aware-Cut-Selection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Opt-Mucca%2FContext-Aware-Cut-Selection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Opt-Mucca%2FContext-Aware-Cut-Selection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Opt-Mucca%2FContext-Aware-Cut-Selection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Opt-Mucca","download_url":"https://codeload.github.com/Opt-Mucca/Context-Aware-Cut-Selection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239400596,"owners_count":19632049,"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":[],"created_at":"2024-11-07T03:06:35.474Z","updated_at":"2025-10-28T11:09:03.724Z","avatar_url":"https://github.com/Opt-Mucca.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Context-Aware Cutting Plane Selection Algorithm for Mixed-Integer Programming\n\nIf this software was used for academic purposes, please cite our paper with the below information:\n\n`@article{turner2023context,\n  title={{A Context-Aware Cutting Plane Selection Algorithm for Mixed-Integer Programming}},\n  author={Turner, Mark and Berthold, Timo and Besan{\\c{c}}on, Mathieu},\n  journal={arXiv preprint arXiv:2307.07322},\n  year={2023}\n}`\n\n## Install Guide\nRequirements: Python 3.9 / Debian 11 (Also tested with 3.11).\nWe use SLURM https://slurm.schedmd.com/overview.html as a job manager. \nAll calls go through a central function however, and in theory SLURM could be replaced by python's \ndefault multiprocessing package.\n\nRun the bash script init_venv. If you don't use bash, configure the shebang (first line of the script) \nto be your shell interpreter.\n\n`./init_venv`\n\nAfter installing the virtual environment, make sure to always activate it with the script printed beneath. \nThis is so your python path is appended and files at different directory levels can import from each other.\n\n`source ./set_venv`\n\nNow go and install SCIP from (https://www.scipopt.org/index.php#download / https://github.com/scipopt/scip)\nFor Ubuntu / Debian, the .sh installer is the easiest choice if you don't want to configure it yourself). \nThe latest release version of SCIP is required for this project, or the development branch `mt/ensemble_cutsel`.\n\nYou can test if SCIP is installed by locating /bin/scip and calling it through the command line. \nSCIP should hopefully open.\n\nOne then needs to install PySCIPOpt https://github.com/scipopt/PySCIPOpt. \nI would recommend following the INSTALL.md guide. Make sure to have set your environment variable pointing to SCIP! \nYou can test if this has been properly installed by running one of the tests, or by trying to import Model. \nThis research was done using PySCIPOpt 4.3.0. \n\n## How to run the software\nWe use Nohup https://en.wikipedia.org/wiki/Nohup to run all of our jobs and to capture output \nof the main function calls. It also allows jobs to be started through a SHH connection. \nUsing this is not necessary however, so feel free to use whatever software you prefer. \nAn example call to redirect output to nohup/nohup.out and to run the process in the background would be\n\n`nohup python dir/example.py \u003e nohup/nohup.out \u0026`\n\nFor our experiments we used [MIPLIB 2017](https://miplib.zib.de/), \n[StrIPLib](https://striplib.or.rwth-aachen.de/login/), and [SNDlib-MIPS](https://zenodo.org/record/8021237).\nA combination of these instances were used for training, where we evaluated our final model on the MIPLIB 2017 \nbenchmark set.\n\nTo select instances in a similar to us, please download all the appropriate instances from the respective websites \n(or feel free to use instances that you have on hand). Place all instances in a single directory.\nWe reduce the amount of instances for training by running:\n\n`python Slurm/generate_instance_subset.py instance_dir solution_dir instance_subset_dir results_dir outfiles_dir`\n\nAfter the instances have been pre-filtered, we can now get their feature embeddings to perform a maximally diverse \nselection. To do this run\n\n`python scripts/get_instance_embeddings.py instance_dir feature_dir`\n\nThen to actually select a maximally diverse subset run\n\n`python scripts/get_diverse_instance_subset.py instance_dir selected_instance_dir feature_dir plot_stuff`\n\nhere `plot_stuff` is an argument about whether you'd like the end result visualised. You can feel free to manually \nchange between PCA or 2-SNE as the embedding options for visualisation. (You have to manually gzip all .sol files at \nthis point)\n\n## Running the Software\n\nNow we can train a SMAC model. To do this run\n\n`nohup python Slurm/main.py bool_1 seed instance_dir solution_dir results_dir outfiles_dir \u003e nohup/test.out \u0026`\n\n`bool_1` here is whether ot not you want to first generate default runs to compare against (This is an option in \ncase you already have generated your default runs and don't want to constantly reproduce identical results).\n\nThis main function trains a SMAC model, with output being redirected to `nohup/test.out`. In that file you will find \nthe training progression along with the best parameter choice found at the end of training as well as how it \nperformed. For more information, one can view the SMAC run history file that was also created. \n\nTo test a given configuration on some test set, you can run the following:\n\n`nohup python Slurm/test_configuration.py config_file bool instance_dir solution_dir results_dir outfiles_dir \u003e \nnohup/test.out \u0026`\n\n#### Thanks for Reading!! I hope this code helps you with your research. Please feel free to send any issues.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopt-mucca%2Fcontext-aware-cut-selection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopt-mucca%2Fcontext-aware-cut-selection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopt-mucca%2Fcontext-aware-cut-selection/lists"}