0
$\begingroup$

I have the simple function:

$\qquad f(x,a)=a\,x−ln(x/100)$

with the constraints: $0.1 < a < 1$ and $0.1 < x < 10$

I want find the minimum of $f(x,\,a)$, assuming that the variable $a$ can take the worst value.

When I evaluated the following code

f[x_, a_] := a*x - Log[x/100];
Minimize[{f[x, a], 0.1 < x < 10, 0.1 < a < 1}, x]  
Maximize[{%, 0.1 < x < 10, 0.1 < a < 1}, a]

I got

Maximize[
  {Minimize[{a x - Log[x/100], 0.1 < x < 10, 0.1 < a < 1}, x],
  0.1 < x < 10, 0.1 < a < 1}, a]

Any suggestions? -_-

$\endgroup$
3
$\begingroup$
Clear["Global`*"]

f[x_, a_] := a*x - Log[x/100];

The minimum in the region is

min1 = Minimize[{f[x, a], 0.1 < x < 10, 0.1 < a < 1}, {a, x}]

(* {3.30259, {a -> 0.1, x -> 10.}} *)

The minimum for the worst case value of a is

min2 = Minimize[{f[x, a], 0.1 < x < 10, a == 1}, {a, x}]

(* {5.60517, {a -> 1., x -> 1.}} *)

ContourPlot[f[x, a], {x, 0.1, 10}, {a, 0.1, 1},
 FrameLabel -> (Style[#, 14, Bold] & /@ {x, a}),
 PlotLegends -> Automatic,
 PlotLabel -> Style[f[x, a], 14, Bold], Epilog -> {AbsolutePointSize[6],
   Green, Tooltip[Point[{x, a}], f[x, a]] /. min1[[2]],
   Red,
   Tooltip[Point[{x, a}], f[x, a]] /. min2[[2]]}]

enter image description here

Show[
 Plot3D[f[x, a], {x, 0.1, 10}, {a, 0.1, 1},
  AxesLabel -> (Style[#, 14, Bold] & /@ {x, a, f})],
 Graphics3D[{AbsolutePointSize[6],
   Green, Point[{x, a, f[x, a]} /. min1[[2]]],
   Red,
   Point[{x, a, f[x, a]} /. min2[[2]]]}],
 PlotLabel -> Style[f[x, a], 14, Bold],
 ImageSize -> Medium]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks for the answear, but I wanna know in general why my minimization problem doesn't work. This function is so simple that you see that a =1 is the worst case but with more complicated function is not possible that approach. $\endgroup$
    – Jenkner
    Oct 17 '20 at 14:01
1
$\begingroup$

It seems that at that time Minimize only work for concrete number.

Clear["`*"];
f[x_, a_] := a*x - Log[x/100];
Table[Minimize[{f[x, a], 1/10 < x < 10 }, x], {a, 1/10, 1, 1/20}]

So we have to use D.

Since D[f[x,a],{x,2}]=1/x^2>0 we can Solve D[f[x,a],x]==0 to find the minimize.

D[f[x,a],{x,2}]
(* 1/x^2 *)

Solve[D[f[x, a], x] == 0, x]
(*{{x -> 1/a}}*)

f[x,a]/.%
(* {1 - Log[1/(100 a)]} *)

So the function f[x,a] get it's minimize at x=1/a and the minimize value is

1 - Log[1/(100 a)]

$\endgroup$
0
$\begingroup$

Here I present a direct solution of this "min-min-Problem"

First calculate the minimum depending of a;

min[a_?NumericQ] := {#[[1]], x /. #[[2]]} & [NMinimize[{a*x - Log[x/100], 0.1 < x < 10  }, {x }]]

Second calculate the "worst" a

aworst = a /. NMinimize[{min[a][[1]], 0.1 < a < 1}, a][[2]]
(* 0.1 *)

result

Plot[ {min[a][[1]], min[a][[2]]} , {a, .1, 1},PlotStyle -> {Blue, Red} ,   PlotLabels -> {"min[a]", "x[a]"},GridLines -> {{{aworst, {Thickness[.02],Darker[Green]} }}, None}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks for the solution. We take the same step but with your implementation works fine! :) $\endgroup$
    – Jenkner
    Oct 17 '20 at 14:13

Your Answer

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

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