# Specify the criteria of the optimal solution

I have three variables $$x_{1},x_{2},x_{3}$$ and a function $$f : D \rightarrow \mathbb{R}$$ where $$D$$ is defined as such :

$$D = (x_{1},x_{2},x_{3})$$ such that $$x_{1}+x_{2}+x_{3}=1$$ and $$x_{1}>x_{2}>x_{3}$$ Therefore, D is the intersection of a plane and a box, and hence is a plane.

The objective is to find $$(x_{1},x_{2},x_{3}) \in D$$ such as $$f(x_{1},x_{2},x_{3}) = c \in \mathbb{R}$$. The function $$f$$ is injective and so for a fixed $$c \in \mathbb{R}$$, there can be multiple solutions $$(x_{1},x_{2},x_{3})$$. Among all the solutions, I want to find the one that has the highest $$x_{1}$$, and then once the highest $$x_{1}$$ is found, the highest $$x_{2}$$. How do I specify this constraint ?

Note that the function $$f$$ doesn't have a closed-form solution and I am using minimize from scipy to find the $$(x_{1},x_{2},x_{3})$$.

If I understood your problem correctly, you want to find $$(x_1,x_2,x_3)$$ such that:

• $$(x_1,x_2,x_3) \in D$$
• $$f(x_1,x_2,x_3) = c$$, where $$c$$ is a given parameter
• $$x_1>x_2 >x_3$$

Also, you want to maximize $$x_1$$ and $$x_2$$, but $$x_1$$ has "priority" over $$x_2$$. So you can use the following objective function:

$$\max \; \omega_1 x_1 + \omega_2 x_2$$

where $$\omega_1$$ is weight larger than $$\omega_2$$, e.g., $$\omega_1 = 10 \omega_2$$. Choosing adequate values for $$\omega_1$$ and $$\omega_2$$ depends on $$D$$.

• In this case simply add the terms to your existing objective function. – Kuifje Jun 25 at 10:20
• EDIT : Sorry I made a mistake in the last comment. The objective function is rather $$\min f(x_{1},x_{2},x_{3})-c$$ so the transformed objective function would be $$\min f(x_{1},x_{2},x_{3})-c-\lambda (w_{1}x_{1}+w_{2}x_{2})$$ with $\lambda >0$. In this case, the heuristic choice of $\lambda$ makes the problem randomish, no ? – FredNgu Jun 25 at 10:33
• Why don't you add $f(x_1,x_2,x_3)=c$ as a constraint ? Or if you cannot have the exact equality, $f(x_1,x_2,x_3) \le c +\varepsilon_1$, and $f(x_1,x_2,x_3) \ge c -\varepsilon_2$ – Kuifje Jun 25 at 10:33
• I couldn't have the exact equality so my first intuition was to minimize the difference. But yes actually adding a small $\epsilon$ and adding it as a inequality constraint is a great idea and should work, thank you ! I'll try this out. – FredNgu Jun 25 at 10:37
• When I first heard of 'Operations Research Beta' I immediately thought to look you up, Kuifje! – BCLC Jun 26 at 7:48