Ok, so I have a problem where I have a function that depends on 9 parameters and a bound condition
$$f(x,y,z,w,t,u,v,r,s)<K$$
Now all these variables take discrete values such as:
$$x \in \{x_1, x_2,x_3,..., x_X \}$$ $$y \in \{y_1, y_2,y_3,..., y_Y \}$$
etc. Now I am using backtrack serach to find all combinations for these values that verify the condition.
I manage to do this in an acceptable way when the variables each take 4 discrete values, so the problem has a complexity of $4^9=262144$, taking little over 3 minutes to do the task. The problem is that when the lists increase it no longer takes an acceptable time. Every variable with 5 discrete values, Mathematica simply can't solve it (maybe if I've waited days but that is not the goal).
Now the fact is that it is unnecessary to test all combinations. Each value $x_1$, $x_2$, etc. represent prices from the most expensive to the cheapest solution. My idea is too find the set of most expensive solutions that means that if I find the solution
$$[3, 3, 2, 2, 3, 2, 2, 3, 3]$$
I don't care about the solution
$$[2, 3, 2, 2, 3, 2, 2, 3, 3] $$
where I just replaced the first value with a smaller one but I do care about the solution
$$[2, 3, 3, 2, 3, 2, 2, 3, 3]$$
where I have switched $x$ and $z$.
How would you do this in an easy way? I need some ideas...
A small workable example of what I did so far,
InitTime = AbsoluteTime[];
values={3,2,1,0.5}
{x,y,z,w,t,u,v,r,s} = {values, values, values, values, values, values, values, values, values};
f[x, y_, z_, w_, t_, u_, v_, r_, s_] := Sqrt[30.7912 y^2 + 30.7912 w^2 + 92.3941 u^2 + 0.641399 z^2 + 0.641399 t^2 + 74.5364 v^2 + 74.5364 s^2 + 5.60933 x^2 + 0.277617 y^2]
k = 8.83;
ResourceFunction["BacktrackSearch"][{x, y, z, w,
t, u, v, r, s},
Length[#] <= 9 &, (f @@ #) < k &, All]
AbsoluteTime[] - InitTime
ResourceFunction["AntColonyOptimization"]
. $\endgroup$