In my problem, I have a vector x of len N. Where each element xi,j is the price of the product i in the country j. Let's say that I have 100 products and 20 countries, so N=100x20=2000.
The solution of X is subject to a set of linear constraints. For instance, minimum/maximum price for each product and maximum difference allowed for the same product between countries. Therefore, I can define the constraints as a matrix Ax<=b
I guess the problem would be like sampling points from a space bounded by hyperplanes defined by the constraints.
Assuming that the problem has multiple feasible solutions. How can I generate random points (solutions of the vector x) that satisfy the constraints? Or there is any library that could help me with that?
I tried with https://github.com/python-constraint/python-constraint, but it seems that because the number of solutions is very large, the algorithm gets stuck at some point or takes a long time to return the solution.
Maybe I'm missing something, or you simplified a bit too much your actual use case. But for the case as stated there's no need for Constraint Programming:
min_price,max_price, andmax_difffor each product (I'm assumingmax_diff <= max_price - min_price)min_priceandmax_price - max_diff. Let's say you set it at random in that rangeactual_min + max_diffactual_minandactual_max.I implemented this in a 3-steps process: create (random) data for the product (you will skip this one); compute the actual min/max values; and finally assign the prices for each product/country. At about 1300 solutions per second on my old i5 windows notebook for 100 products and 20 countries, it is even not so slow as one could have expected