My objective function, $ f (r, k; s, d) $takes three different expressions, denoted by $ f ^ 1 $. $ f ^ 2 $, and $ f ^ 3 $Depending on the conditions for the arguments and parameters as follows:

$ f ^ 1 (r, k; s, d) = frac {3s left (d ^ 2-k ^ 2 r right) + k ^ 2 r (3 d + kr) -6 ds ^ 2 + 3 s ^ 3} {6 s ^ 2} $ when $ 0 leq d leq 1, s geq 2 d, 0 leq k <d, 0 leq r leq 1 $.

$ f ^ 2 (r, k; s, d) = frac {d ^ 3 + 3 d ^ 2 (k (r-1) -s) + 3 d left (k ^ 2 ((r-3) ) r + 1) +2 kr s-2 (r-1) s ^ 2 right) + k ^ 3 (r ((r-1) r + 3) -1) -3 k ^ 2 r ^ 2 s + 3 (r-1) s ^ 3} {6 (r-1) s ^ 2} $ when $ 0 leq d leq 1, s geq 2 d, d leq k leq s, 0 leq r < frac {d} {k} $.

$ f ^ 3 (r, k; s, d) = frac {d ^ 3 + 3 d ^ 2 kr + 3 dr left (k ^ 2 (r-1) -2 s ^ 2 right) + k ^ 3 (r-1) ^ 2 r + 3 rs ^ 3} {6 rs ^ 2} $ when $ 0 leq d leq 1, s geq 2 d, d leq k leq s, frac {d} {k} leq r leq 1 $,

My ultimate goal is to find the optimal value of $ r $ and $ k $ where the objectively works $ f $ will be maximized in all three cases. It has turned out that working with analytical solutions is quite daunting. So I'm working with numerical simulations that are limited to the parameter values of $ d in [0,1]$ and $ s in [0,2]$,

My strategy is as follows:

First, create a code that solves the maximization problem for each of the three functions above and calculates the maximized value of the function and the corresponding optimum $ r $ and $ k $ (This is of course a function of $ s $ and $ d $.) For example, for the first case of $ f ^ 1 $let me call you by $ f ^ {1 *} $. $ r ^ {1 *} $, and $ k ^ {1 *} $; and the same for the cases of $ f ^ 2 $ and $ f ^ 3 $,

Second, with `Plot3D`

, Plot $ f ^ {1 *} $. $ f ^ {2 *} $, and $ f ^ {3 *} $ in one and the same diagram $ d in [0,1]$ and $ s in [0,2]$; in a similar way action $ r ^ {1 *} $. $ r ^ {2 *} $, and $ r ^ {3 *} $ in one and the same diagram $ d in [0,1]$ and $ s in [0,2]$and action $ k ^ {1 *} $. $ k ^ {2 *} $, and $ k ^ {3 *} $ in one and the same diagram $ d in [0,1]$ and $ s in [0,2]$,

Finally, the first diagram allows a comparison $ f ^ {1 *} $. $ f ^ {2 *} $, and $ f ^ {3 *} $I can get the maximum value of the objective function $ f $and by looking at the second and third graphs I can get the corresponding optimum $ r $ and $ k $I'm looking for.

My Mathematica code for this is as follows (this is an extension of Alex Trounev's answer in the results of 3D Plot Optimization for different parameter values):

```
block[{T=0}=f1(k^2r(3d+kr)+3(d^2-k^2r)s-6ds^2+3s^3)/(6S^2);max1=flattening[Table[{DsMaxValue[F10{<=d[{T=0}=f1(k^2r(3d+kr)+3(d^2-k^2r)s-6ds^2+3s^3)/(6S^2);max1=Flatten[Table[{DsMaxValue[F10{<=d[{t=0}f1=(k^2r(3d+kr)+3(d^2-k^2r)s-6ds^2+3s^3)/(6s^2);max1=Abflachen[Tabelle[{dsMaxValue[{f10<=d[{t=0}f1=(k^2r(3d+kr)+3(d^2-k^2r)s-6ds^2+3s^3)/(6s^2);max1=Flatten[Table[{dsMaxValue[{f10<=d<= 1, s >= 2 d, 0 <= k <d, 0 <= r <= 1}, {k, r}]}, {d, 0, 1, .1}, {s, 0, 2, .1}], 1]; maxk1 = flattening[Table[{Dsk/load@Maximize[F10{<=d[Table[{Dsk/load@Maximize[F10{<=d[Tabelle[{dsk/Last@Maximize[{f10<=d[Table[{dsk/Last@Maximize[{f10<=d<= 1, s >= 2 d, 0 <= k <d, 0 <= r <= 1}, {k, r}]}, {d, 0, 1, .1}, {s, 0, 2, .1}], 1]; maxr1 = flattening[Table[{Dsr/load@Maximize[F10{<=d[Table[{Dsr/load@Maximize[F10{<=d[Tabelle[{dsr/Last@Maximize[{f10<=d[Table[{dsr/Last@Maximize[{f10<=d<= 1, s >= 2 d, 0 <= k <d, 0 <= r <= 1}, {k, r}]}, {d, 0, 1, .1}, {s, 0, 2, .1}], 1];]block[{T=0}f2=1/(6(-1+r)s^2)(d^3+k^3(-1+r(3+(-1+r)))+^3d2(k(1+r)-s)-3K^^2r2s+3(-1+r)s^3+3d(k^2(1+(-3+r)r)+2krs-2(-1+r)s^2));max2=flattening[Table[{DsMaxValue[F20{<=d[{T=0}f2=1/(6(-1+r)s^2)(d^3+k^3(-1+r(3+(-1+r)))+^3d2(k(1+r)-s)-3K^^2r2s+3(-1+r)s^3+3d(k^2(1+(-3+r)r)+2krs-2(-1+r)s^2));max2=Flatten[Table[{DsMaxValue[F20{<=d[{t=0}f2=1/(6(-1+r)s^2)(d^3+k^3(-1+r(3+(-1+r)r))+3d^2(k(-1+r)-s)-3k^2r^2s+3(-1+r)s^3+3d(k^2(1+(-3+r)r)+2krs-2(-1+r)s^2));max2=Abflachen[Tabelle[{dsMaxValue[{f20<=d[{t=0}f2=1/(6(-1+r)s^2)(d^3+k^3(-1+r(3+(-1+r)r))+3d^2(k(-1+r)-s)-3k^2r^2s+3(-1+r)s^3+3d(k^2(1+(-3+r)r)+2krs-2(-1+r)s^2));max2=Flatten[Table[{dsMaxValue[{f20<=d<= 1, s >= 2 d, d <= k <= s, 0 <= r <d / k}, {k, r}]}, {d, 0, 1, .1}, {s, 0, 2, .1}], 1]; maxk2 = flattening[Table[{Dsk/load@Maximize[F20{<=d[Table[{Dsk/load@Maximize[F20{<=d[Tabelle[{dsk/Last@Maximize[{f20<=d[Table[{dsk/Last@Maximize[{f20<=d<= 1, s >= 2 d, d <= k <= s, 0 <= r <d / k}, {k, r}]}, {d, 0, 1, .1}, {s, 0, 2, .1}], 1]; maxr2 = flattening[Table[{Dsr/load@Maximize[F20{<=d[Table[{Dsr/load@Maximize[F20{<=d[Tabelle[{dsr/Last@Maximize[{f20<=d[Table[{dsr/Last@Maximize[{f20<=d<= 1, s >= 2 d, d <= k <= s, 0 <= r <d / k}, {k, r}]}, {d, 0, 1, .1}, {s, 0, 2, .1}], 1];]block[{T}=0f3=(d^3+3d+k^2kr^3(-1+r)^2r+3RS^3+3DR(k^2(1+r)-2S^2))/(6RS^2)=max3flattening[Table[{DsMaxValue[F30{<=d[{T}=0f3=(d^3+3d+k^2kr^3(-1+r)^2r+3RS^3+3DR(k^2(1+r)-2S^2))/(6RS^2);max3=Flatten[Table[{DsMaxValue[F30{<=d[{t=0}f3=(d^3+3d^2kr+k^3(-1+r)^2r+3rs^3+3dr(k^2(-1+r)-2s^2))/(6rs^2);max3=Abflachen[Tabelle[{dsMaxValue[{f30<=d[{t=0}f3=(d^3+3d^2kr+k^3(-1+r)^2r+3rs^3+3dr(k^2(-1+r)-2s^2))/(6rs^2);max3=Flatten[Table[{dsMaxValue[{f30<=d<= 1, s >= 2 d, d <= k <= s, d / k <= r <= 1}, {k, r}]}, {d, 0, 1, .1}, {s, 0, 2, .1}], 1]; maxk3 = flattening[Table[{Dsk/load@Maximize[F30{<=d[Table[{Dsk/load@Maximize[F30{<=d[Tabelle[{dsk/Last@Maximize[{f30<=d[Table[{dsk/Last@Maximize[{f30<=d<= 1, s >= 2 d, d <= k <= s, d / k <= r <= 1}, {k, r}]}, {d, 0, 1, .1}, {s, 0, 2, .1}], 1]; maxr3 = flattening[Table[{Dsr/load@Maximize[F30{<=d[Table[{Dsr/load@Maximize[F30{<=d[Tabelle[{dsr/Last@Maximize[{f30<=d[Table[{dsr/Last@Maximize[{f30<=d<= 1, s >= 2 d, d <= k <= s, d / k <= r <= 1}, {k, r}]}, {d, 0, 1, .1}, {s, 0, 2, .1}], 1];] {ListPlot3D[max1, max2, max3, AxesLabel -> {"d", "s", "V"}], ListPlot3D[maxk1, maxk2, maxk3, PlotRange -> {0, 2}, AxesLabel -> {"d", "s", "k"}], ListPlot3D[maxr1, maxr2, maxr3, PlotRange -> {0, 1}, AxesLabel -> {"d", "s", "r"}]}
```

(In the code you can simply bypass the meaning of $ t = 0 $.)

When this code is executed, a list of error messages will be displayed. Can someone help? Thanks in advance!