{"id":15539650,"url":"https://github.com/thchang/projection-failure","last_synced_at":"2025-06-24T16:38:39.499Z","repository":{"id":203206506,"uuid":"690770256","full_name":"thchang/projection-failure","owner":"thchang","description":"Demo of failure cases for various QP codes when solving the projection problem from ACM TOMS 1012","archived":false,"fork":false,"pushed_at":"2023-10-17T23:53:18.000Z","size":66809,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-09T12:58:48.873Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thchang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-09-12T20:57:53.000Z","updated_at":"2023-10-23T23:54:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"4844a179-64ff-4418-87f2-1f45f100acae","html_url":"https://github.com/thchang/projection-failure","commit_stats":null,"previous_names":["thchang/projection-failure"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thchang/projection-failure","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thchang%2Fprojection-failure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thchang%2Fprojection-failure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thchang%2Fprojection-failure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thchang%2Fprojection-failure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thchang","download_url":"https://codeload.github.com/thchang/projection-failure/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thchang%2Fprojection-failure/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261715577,"owners_count":23198773,"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-10-02T12:11:00.997Z","updated_at":"2025-06-24T16:38:39.470Z","avatar_url":"https://github.com/thchang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Geometric Projection Failures for Remark on ACM TOMS Algorithm 1012\n\nThis repository contains demonstrations of failure cases for various\nquadratic program (QP) solver codes on the projection problem from\nACM TOMS 1012.\n\n## Problem Details\n\nAt certain points in ACM TOMS Algorithm 1012, one needs to compute the\nprojection of an extrapolation point $z$ onto the convex hull of the\ntraining points $P$, denoted $CH(P)$.\n\nThis is done by solving\n\n$\\min_{x\\in R^n} || Wx - z ||^2$\n\nsuch that\n\n$\\sum x = 1; x \\geq 0$\n\nwhere $P$ consists of $n$ points in $R^d$,\nand $W = [p_1 | p_2 | ... | p_n]$ for\n$p_i \\in P$.\n\nNote that this problem can be posed as an equality-constrained\nnonnegative least-squares problem, which is a special case of a\nconvex QP.\n\nDue to the unusual shape of the matrix $W$, this is a nonstandard\nuse-case for many QP solvers and an extremely difficult problem\nwhen the number of training points ($n$) is large.\nThis results in most open-source solvers failing to achieve the\nnecessary accuracy.\n\nWe have proposed the usage of the BQPD solver of R. Fletcher to solve\nthis problem, using a dot-product kernel that exploits the structure\nof the problem.\nThe purpose of this repository is to demonstrate this solution compared\nto other open-source QP solvers and the SLATEC DWNNLS solver, which was\nused in the original DelaunaySparse code.\n\n## Setup\n\nBefore attempting to reproduce our results, take the following steps\nto install and build dependencies:\n\n - Make sure that you have a copy of ``gfortran`` installed on\n   your machine (using the shell command ``gfortran`` to compile);\n - Fetch the old and new versions of DelaunaySparse into the ``experiments``\n   subdirectory using the commands\n   ```\n   git submodule init\n   git submodule update --recursive --remote\n   ```\n - Make sure that you have ``python 3.8`` or newer;\n - We recommend that you set up a local python virtual environment for reproducibility\n   ```\n   python3 -m venv env\n   source env/bin/activate\n   ```\n - Install requirements with ``python -m pip install -r REQUIREMENTS.txt`` in the base directory;\n - Build and test DelaunaySparse's shared object libraries, use the command\n   ```\n   pushd experiments/ds_v1/DelaunaySparse/python \u0026\u0026 python example.py \u0026\u0026 popd\n   pushd experiments/ds_v2/DelaunaySparse/python \u0026\u0026 python example.py \u0026\u0026 popd\n   ```\n\n## Reproducing Results\n\nAfter following the above steps:\n\n - The ``experiments`` subdirectory contains the script and dependencies that\n   reproduce our results.\n   To run it: ``cd experiments \u0026\u0026 python projection.py``\n - the ``data`` subdirectory contains a list of csv data files containing the\n   test problems used. The first line is the name of the problem, the second\n   line contains the integer values ``d,n,m`` in that order. The next ``n``\n   lines contain the data points (defining the convex hull) as\n   comma-separated row-vectors.\n   The last ``m`` lines contain the points to project onto the convex hull\n   as comma-separated row-vectors.\n - The generative experiments take approximately 50 hours to run on a 10 core 2021 Macbook Pro M1 laptop and can be executed and analyzed with the commands\n   ```\n   pushd experiments\n   python run_generative_tests.py\n   python process_generative_test_results.py\n   popd\n   ```\n - Additionally some simple visualizations are provided that help provide intuition into how projection onto the Delaunay mesh works. First the following commands are needed to fix one of the required libraries:\n   ```\n   pushd env/lib/python3.11/site-packages/plotly/grid_objs\n   cp grid_objs.py old.grid_objs.py\n   python -c \"import fileinput, re; [print(re.sub('from collections import MutableSequence', 'from collections.abc import MutableSequence', line), end='') for line in fileinput.input()]\" \u003c old.grid_objs.py \u003e grid_objs.py\n   popd\n   ```\n   Then different explorations can be done with the following:\n   ```\n   python explore_sample_projection.py\n   python explore_sample_lattice_extrapolation.py\n   python explore_sample_delaunay.py\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthchang%2Fprojection-failure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthchang%2Fprojection-failure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthchang%2Fprojection-failure/lists"}