So I’ve been trying to figure out a way to convert the constraints to equality via the slack variables, but I couldn’t make it work.
Some related posts are: Constraints during sampling and Additional constraint on unit simplex (which is yours, so I assume you’ve tried those approaches already :-) Also, the work on Quadratic optimizer seems relevant, but looking at the associated Github issue it looks like the implementation was never finished. But there was some discussion on constraints and convex polytope’s which might (and might not) be relevant.
A big problem for any way to parametrize a general convex polyhedron of dimension n constrained by linear inequalities for use in Stan is that you need a smooth bijective mapping between \mathbb{R}^n and points in the region. The smoothness seems to be a problem. If I for example choose to parametrize a convex polytope by choosing an interior point a unit n-dimensional vector indicating direction from the point and a number between 0 and 1 indicating position between the chosen point and a side of the polyhdreon / infinity, this mapping will not be smooth as the direction traverses individual sides.
EDIT: After reflection the idea in this post is probably misguided, hiding it for now.
Click to see a probably wrong direction
However, there are shapes that are easy to parametrize - e.g. a simplex (in the geometrical sense) can be easily parametrized as a convex combination of its vertices (which is both smooth and bijective), using Stan’s simplex
type. Simplices with some sides “open” (i.e. unconstrained) would also be easy to parametrize.
A probably not very practical way to get around this would be to decompose the polyhedron into as few as possible segments that can be easily parametrized and then add a discrete random variable indicating which segment was chosen. This discrete variable could then be marginalized out and this could give a well-behaved parametrization. For non-trivial shapes in higher dimensions this would however introduce a lot of nuisance parameters and would be difficult to implement (and not guaranteed to actually work…)
So sorry, no good answers from me.
Tagging @bgoodri as I believe he has more insight than me into whether something like this is feasible or if there are other good alternatives.