1
$\begingroup$

This is similar to question I asked here: Priotization rules for variable allocation in linear programming. In an optimization problem, the goal is to manage the purchase and sale of items under specific conditions. We have the following rules:

  1. Purchasing New Items:

    • If the net value, calculated as $C_{t} \cdot x - E_{t} $, is positive, then new items should be purchased at price $CO_{t}$. This purchase is adjusted so that the net value after purchase becomes zero, formulated as $C_{t} \cdot x - E_{t} - CO_{t} \cdot y_{t} = 0$.
  2. Selling Items:

    • If the net value is negative, there are two steps for selling items:
      • First, try selling new items at price $SN_{t}$ to balance the net value, formulated as $C_{t} \cdot x - E_{t} + SN_{t} \cdot zn_{t} = 0$.
      • If selling new items doesn't balance it, then sell initial items at price $S_{t}$ to achieve $C_{t} \cdot x - E_{t} + S_{t} \cdot z_{t} = 0$.
  3. Mutual Exclusivity of Transactions:

    • At any given time $t$, only one type of transaction can occur – either buying new items, selling new items, or selling initial items. This means only one of the variables $y_{t}$, $z_{t}$, and $zn_{t}$ can be greater than zero at any time $t$.

The decision variables are defined as follows:

\begin{alignat*}{2} & x && : \text{Represents initial allocation of items}, \quad 0 \leq x \leq 1. \\ & z_{t} && : \text{Represents percentage of initial items sold in year } t, \quad 0 \leq z_{t} \leq 1. \\ & y_{t} && : \text{Represents percentage of the new items purchased at time \( t \), \( 0 \leq y_t \leq 1 \)} \\ & zn_{t} && : \text{Represents percentage of new items sold at time \( t \), \( 0 \leq zn_{t} \leq 1 \)} \end{alignat*}

How can we formulate these conditions or prioritization rules in the optimization model? Additionally, is it possible to set a different prioritization rule where selling initial items $z_{t} > 0$ is only allowed if the selling of new items $zn_{t}$ has reached its upper bound (i.e., $zn_{t} = 1$), and purchasing new items $y_{t}$ is not permitted if either $z_{t}$ or $zn_{t}$ is positive?

$\endgroup$
2
  • $\begingroup$ Welcome to OR.SE. In your first bullet, what do you mean by purchased at price CO_t? Is $(C_t x − E_t \geq 0) \implies (y_t \geq 0)$ what you are looking for? Why have you tried to use the cost in the constraints as it really makes sense to be in the objective function? $\endgroup$
    – A.Omidi
    Commented Jan 16 at 14:01
  • $\begingroup$ Thanks @A.Omidi. $CO_{t}$ is the data representing cost or price you would pay for an item at time $t$- it is a vector. When $C_{t} \cdot x - E_{t} \geq 0$ that means we have some surplus that we use to buy new items. When you pay the cost $CO_{t} \cdot y$, you lose that amount from the account so that's why you need to factor it into the constraint. Yes, $C_{t} \cdot x - E_{t} \geq 0 \Rightarrow y_{t} \geq 0$ does mean a purchase at time $t$ and $C_{t} \cdot x - E_{t} - CO_{t} \cdot y = 0$ $\endgroup$
    – Lemma
    Commented Jan 16 at 15:02

1 Answer 1

1
$\begingroup$

I'm going to drop the subscript $t$ to save clutter. Let $B = C\cdot x - E.$ Introduce three binary variables $\omega_1,$ $\omega_2,$ $\omega_3$ together with the constraints $y \le \omega_1,$ $zn \le \omega_2,$ $z \le \omega_3$ and $\omega_1 + \omega_2 + \omega_3 = 1.$

We want to enforce is the following: $$\omega_1 = 1 \iff B \ge 0,$$ $$\omega_2 = 1 \iff 0 > B \ge -SN,$$ and $$\omega_3 = 1\iff -SN > B \ge -S.$$ Since exactly one $\omega_i$ will be 1 and the right hand sides form a disjoint partition of the feasible values of $B,$ it suffices to enforce just the $\implies$ direction.

Strict inequalities are taboo in LP/IP models, so read $>$ as $\ge$ in the above. The good news is that if $B = 0$ we don't care whether $y,$ $zn$ or $z$ is used since any of them would take the value 0. The remaining weakness is that if $B=-SN,$ either $\omega_2 = 1$ or $\omega_3 = 1$ would be feasible, meaning either $zn$ or $z$ could be used. If that is a problem, your only recourse is to change the third inequality to $-SN - \epsilon \ge B \ge -S$ for some small positive $\epsilon,$ the effect of which is to make any $x$ for which $-SN - \epsilon < B < -SN$ infeasible.

Finally, we add the following inequalities, where $M$ is an valid upper bound on $B:$ $$B \ge -SN\cdot \omega_2 - S\cdot \omega_3$$ and $$B \le M\cdot \omega_1 -SN\cdot \omega_3.$$ These enforce the $\implies$ directions of the three main inequalities.

$\endgroup$
5
  • $\begingroup$ Thank you. For the issue you have mentioned if $B=-SN,$ to enforce the inequality $-SN - \epsilon \ge B \ge -S$, should I change the last constraint to the following and that is the only change required? $$B \le M\cdot \omega_1 -(SN+\epsilon) \cdot \omega_3.$$ $\endgroup$
    – Lemma
    Commented Jan 17 at 18:34
  • $\begingroup$ Can we apply this logic to this other similar question I have asked here: or.stackexchange.com/questions/11526/… I will draft an answer building on your solution here, but happy for you to post it if you prefer it and I will accept it. $\endgroup$
    – Lemma
    Commented Jan 17 at 18:36
  • $\begingroup$ Yes, this should apply. Feel free to answer the other question yourself (and maybe point to this one). $\endgroup$
    – prubin
    Commented Jan 17 at 20:26
  • $\begingroup$ Thank you. One last thing I wanted to check was the constraint: $$\omega_{1}+\omega_{2}+\omega_{3} =1$$. If I change it $$\omega_{1}+\omega_{2}+\omega_{3} \leq 1$$, would that invalidate any other constraints? The reason I am considering changing it is because it may better capture the case of $$B=0$$, so that we we don't strictly enforce one of the binary variables to take value of 1. $\endgroup$
    – Lemma
    Commented Jan 17 at 20:43
  • $\begingroup$ That should be compatible with the rest of the model. $\endgroup$
    – prubin
    Commented Jan 18 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.