0

This question is an extension of this.

Again, I have n total fruit plantations and s number of just apple plantations.

I want to place s and (n-s) plantations on an m by m grid of field. Each s apple plantation should be a minimum distance, d away from each other. So each grid point has two possibilities: multiple (n-s) plantations or 1 s plantation and multiple (n-s) plantations.

The objective function should be minimizing the area of the grid field where n fruits are to be planted.

Also, I need to control the number of total plantations/grid points. That means for the two possibilities mentioned above, I might place multiple plantations on the same grid point.

New additional constraints:

  • All calculations in Manhattan distance i.e. |x1-x2|+|y1-y2|
  • This time the area calculation is approximated simply as [y2-y1]+[x2-x1] as a proxy for actual area, where y2 = max(all n plantations' y) , y1 = min(all n plantations' y), same for x2 and x1.
  • For the distance constraint for s plantations, I am thinking |ai1,j1 - ai2,j2| >=d. But I need to generalize this for all plantations.
  • Lastly, with another variable, I need to be able to control the number of total plantations/grid points.

Please help.

1 Answers1

1

The distance constraints are the same as in linear programming problem formulation (extended), with only the definition of distance changing: $$a_{i_1,j_1} + a_{i_2,j_2} \le 1 \quad \text{if $0<|i_1-i_2|+|j_1-j_2|<d$}.$$ To avoid duplication of each pair, you should consider only $i_1 < i_2$ or $i_1=i_2 \land j_1<j_2$.

For the area minimization, constraints $(1)$ through $(4)$ there still apply, but the new objective is to minimize $$\sum_{k=1}^m k \left(\ell_k + w_k\right).$$

Alternatively, you can introduce variables $x_1$, $x_2$, $y_1$, and $y_2$, objective function $(x_2-x_1)+(y_2-y_1)$, and "big-M" constraints \begin{align} x_1 - i &\le (m-i)(1-f_{i,j}) &&\text{for all $i,j$}\\ i - x_2 &\le (i-1)(1-f_{i,j}) &&\text{for all $i,j$}\\ y_1 - j &\le (m-j)(1-f_{i,j}) &&\text{for all $i,j$}\\ j - y_2 &\le (j-1)(1-f_{i,j}) &&\text{for all $i,j$} \end{align} These constraints enforce $f_{i,j} \implies (x_1 \le i \le x_2 \land y_1 \le j \le y_2)$. In words, if a plantation is placed at grid point $(i,j)$, then the minimum $x$ is at most $i$, the maximum $x$ is at least $i$, minimum $y$ is at most $j$, and the maximum $y$ is at least $j$.

To enforce an upper bound of $10$ plantations per grid point, impose linear constraint $$a_{i,j} + b_{i,j} \le 10 \quad \text{for all $i,j$}$$

You also still need constraints $(1)$ through $(4)$ from linear programming formulation, but because you can now place both apple and non-apple at the same grid point, omit constraint $(5)$.

RobPratt
  • 45,619
  • Thank you. Please note that the area calculation is approximated simply with the addition as [y2-y1]+[x2-x1] as a proxy for the actual area now. So are these equations (1) to (4) from https://math.stackexchange.com/questions/3805624/linear-programming-problem-formulation-extended still relevant? I think there should be the max and min terms in the area constraint as explained here.

    Also, I need to control the number of total plantations/grid points. E.g. maybe a binary variable will say if there are say 10, just for instance plantations in each grid point.

    –  Sep 04 '20 at 15:06
  • 1
    @svetlana the change from $\log(k)$ to $k$ in the objective function reflects the area approximation, and the constraints enforce the max and min terms. – RobPratt Sep 04 '20 at 15:55
  • Thanks a lot. One last thing- for the area minimization how did the log disappear from the constraint in this case? Also, is the objective function just manhattan distance(x2-x1)+(y2-y1)? For the constraints....If you have time please explain one of the two constraints. Sorry for bothering you. –  Sep 08 '20 at 03:00
  • 1
    For the area minimization, if you use $\ell_k$ and $w_k$, the log never appears because there is no multiplication here. The objective is already linear. If you instead use the $x_i$ and $y_i$ variables, the objective is to minimize the linear function $(x_2-x_2)+(y_2-y_1)$, which you can think of as Manhattan distance between the corners of the assigned grid. – RobPratt Sep 08 '20 at 03:21
  • The i * f_i,j in between the non-negative integer variables x1 and x2 means each of the ith plantation is placed according to the f_i,j objective function? –  Sep 08 '20 at 04:48
  • 1
    Yes, that was the intent, but they were wrong. Corrected now. – RobPratt Sep 08 '20 at 13:52
  • Thanks again. Enforce fi,j⟹(x1≤i≤x2∧y1≤j≤y2) means in words ? please.

    Also x1 - i < (m-i) (1-f _i_j) for all i , j .........x1 is the lower left corner of the grid... what is i? I understand this is saying choose the 'i's paying for it in the f_i_j but it would be helpful to see a boundary condition.

    –  Sep 08 '20 at 17:36
  • 1
    Added words just now. Not sure what boundary condition you mean. The big-M constraints apply for every grid point $(i,j)$. – RobPratt Sep 08 '20 at 17:50
  • My apologies. x1 - i < (m-i) (1-f _i_j) for all i , j .........what is the (1-f _i_j) factor here for ? Does big M mean M= {1,2,....m}? –  Sep 08 '20 at 18:00
  • 1
    The big-M is the coefficient of $(1-f_{i,j})$. You can find similar questions here. – RobPratt Sep 08 '20 at 19:27
  • For this upper bound constraint- ai,j+bi,j≤ 10 for all i,j I needed to count total plantations per each grid point, here a and b are about whether the plantations are there in i,j ..this is not about the total number of plantations on the grid point I think. –  Sep 08 '20 at 21:39
  • 1
    Please review the definitions of these decision variables here. – RobPratt Sep 08 '20 at 21:42
  • Okay. One thing - do we still need f_i,j from here https://math.stackexchange.com/questions/3803341/linear-programming-formulation? Isn't this redundant now.

    I understand our objective function changed.

    –  Sep 08 '20 at 22:21
  • 1
    Yes, you still need $f_{i,j}$ to determine $x$ and $y$ via the big-M constraints. – RobPratt Sep 08 '20 at 22:44
  • I don't need to minimize ∑i,jfi,j from the above link anymore right? –  Sep 08 '20 at 23:46
  • 1
    Right, here the objective is instead to minimize area. – RobPratt Sep 09 '20 at 00:48
  • Then I don't need equations 3 and 4 from the above link too right? –  Sep 09 '20 at 01:18
  • 1
    Yes, you do. Otherwise, all $f_{i,j}$ could be $0$, and the big-M constraints would not enforce anything. – RobPratt Sep 09 '20 at 01:22
  • Do you know any examples like this online somewhere please? dealing with similar variables and placing constraints ..with explanation –  Sep 09 '20 at 01:33
  • 1
    https://go.documentation.sas.com/?docsetId=ormpex&docsetTarget=titlepage.htm&docsetVersion=15.2&locale=en – RobPratt Sep 09 '20 at 01:38
  • For the ai1,j1+ai2,j2≤1if 0<|i1−i2|+|j1−j2|<d. I have a confusion; sorry. I am not sure if I know about this or not but this constraint only describes the d for (i1,j1) and (i2,j2). I am trying to generalize it for all i,j. Also, can we have 'if' in a programming constraint equation like this? –  Sep 09 '20 at 22:30
  • 1
    The conflict constraint applies for all pairs of grid points that satisfy the "if" condition, which defines the index set of the constraint. – RobPratt Sep 10 '20 at 00:29
  • Thank you. May I see another online example like that as I am not able to relate how just i1 and i2 expresses all i . Please. What should I google to find an example like this or understand this. –  Sep 10 '20 at 03:20