0
$\begingroup$

(So i was trying to find how to allocate my stats in my rpg character and i stumble across something i don't know how to formulate):

Maximize $$Z = \frac{x_1}{100}*\left(1+\frac{x_2}{100}\right)*(bd+0.5*x_1) + \left(1-\frac{x_1}{100}\right)*(bd+0.5*x_1)$$ ($bd$ is constant) subject to:
$$x_1 \geq 41$$ $$x_2 \geq 40$$ $$x_1 + x_2 \leq 2000$$ $$x_j \geq 0$$ $$x_1, x_2 \text{integer}$$

$\frac{x_1}{100}$ in the first term of objective function represent a probability and $\left(1-\frac{x_1}{100}\right)$ the complement.

My problem is that when $x_1>100$ i want my objective function to take account only the first term $$\left(1+\frac{x_2}{100}\right)*(bd+0.5*x_1)$$ with $\frac{x_1}{100}=1$ (so the second term isn't considered $\left(1-\frac{x_1}{100}\right)=0$). I thought of using integer variables but i don't know how to formulate the model. (I solved it in excel with if function but i want to know the analytic version)

(Background: $x_1$ points of stat 1 (Dexterity) and in this game it contributes to critical chance and damage, where as $x_2$ (Cunning) contributes to critical damage)

If there is another way to formulate, i'll be glad to see it.

Thank you for your time.

$\endgroup$
  • 1
    $\begingroup$ Can you use $\LaTeX$ please? $\endgroup$ – Dr. Sonnhard Graubner Dec 10 '19 at 14:00
  • 1
    $\begingroup$ I have edited you post to make use of mathjax for equation. I'll be a lot easier to read. $\endgroup$ – Alain Remillard Dec 10 '19 at 14:04
  • 1
    $\begingroup$ Note that your problem (as is) is not a linear program $\endgroup$ – Kuifje Dec 10 '19 at 14:18
  • 1
    $\begingroup$ Try Karush–Kuhn–Tucker . $\endgroup$ – callculus Dec 10 '19 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.