# How to set Initial Points for optimization problems

How to set Initial Points for optimization problems in MMA?

In this case,we do not need to set the range of the variable x1, x2.

fgoal = (1 - x1)^2 + 100*(x2 - x1^2)^2;
fcon1 = x1^2 + x2^2 <= 1;

fcon2 = x1 + 3 x2 <= 5;

NMinimize[{fgoal, fcon1, fcon2}, {x1, x2},
Method -> {"Automatic", "InitialPoints" -> {1.3, 0.5}}]


It returns:

• As we know NMinimize always attempts to find a global minimum subject to the constraints given. Therefore we don't need to restrict initial point. In turn with FindMinimum[{fgoal, fcon1, fcon2}, {{x1, 1.3}, {x2, .5}}] we can get local extremum. Commented Jan 9, 2022 at 4:30
• @AlexTrounev thanks a lot for your support! Commented Jan 9, 2022 at 14:42
• You are welcome! Commented Jan 9, 2022 at 14:50

Clear["Global*"]

fgoal = (1 - x1)^2 + 100*(x2 - x1^2)^2;
fcon1 = x1^2 + x2^2 <= 1;
fcon2 = x1 + 3 x2 <= 5;


The "InitialPoints" are expected to be a List of points. Even if you only provide one point, that point must be in a List

sol1 = NMinimize[{fgoal, fcon1, fcon2}, {x1, x2},
Method -> {"Automatic", "InitialPoints" -> {{1.3, 0.5}}}]

(* {0.0456748, {x1 -> 0.786415, x2 -> 0.617699}} *)


For this problem, no option is needed

sol2 = NMinimize[{fgoal, fcon1, fcon2}, {x1, x2}]

(* {0.0456748, {x1 -> 0.786415, x2 -> 0.617699}} *)


Or the problem can be done exactly with Minimize

sol3 = Minimize[{fgoal, fcon1, fcon2}, {x1, x2}] // RootReduce

(* {Root[6544214292004000000 - 144368235817268120000 # +
24470854590692601200 #^2 - 13682324808464174004 #^3 +
6947692863550867001 #^4 - 216684553251678400 #^5 +
2560711072960000 #^6 - 13311744000000 #^7 + 25600000000 #^8& , 1,
0], {x1 ->
Root[-1 - 198 # + 30200 #^2 + 598 #^3 - 70599 #^4 - 400 #^5 +
10400 #^6 + 40000 #^8& , 5, 0],
x2 -> Root[-10000 - 20200 # + 59800 #^2 + 120800 #^3 - 99399 #^4 -
220600 #^5 + 9600 #^6 + 120000 #^7 + 40000 #^8& , 4, 0]}} *)

sol3 // N

(* {0.0456748, {x1 -> 0.786415, x2 -> 0.617698}} *)

• which options for display iter-detailed in MMA? Commented Jan 10, 2022 at 11:41
• I do not understand your question. If you are asking how you would know that the option value must be a List, it is implicit in the option name: InitialPoints. An unspecified number of points (plural) could only be passed in a List; and things which can be lists are usually lists (e.g., output of Solve` and similar functions are a list of solutions even when there is only a single solution). Commented Jan 10, 2022 at 13:43