Using a list for possible values that a variable should have

Hi,
I need to assign possible values for a variable and then to chose the optimal value? Like a=[1,2,5,8] and then to find the optimal value among them according to an optimization purpose.

It is not clear exactly what you are trying to do. Assuming your “optimization” computation can be expressed as a function f and the “optimal value” is the Max of that function for each of the values then e.g.

a = {1, 2, 5, 8};
f[x_] := x^2;
f /@ a // Max
(* 64 *)

The optimization is to find the lowest value for an objective function and then it should tell me which value that will do ?

Linear programming with interval coefficients is one of the tools to tackle uncertainty in mathematical programming models. This paper presents a problem solving linear programming with interval coefficients. The problem will be solved by the algorithm general method to solve linear programming with interval coefficients. Thus, the best and the worst optimum solutions can be obtained, the upper bounds and lower bounds for the optimum value of the main problems can be determined.

Then just replace f with your objective function and Max by Min.

So how can I know which value of “a” is used ?

There are no doubt one-line statements which can do this, but here is a hopefully understandable approach:

(* objective function *)
obj[x_] := (x - 5)^2 + 3

Plot[obj[x], {x, 0, 10}]

(* candidate values *)
xList = Range[1, 10];

(* return a trial value and its function value *)
try[x_] := {x, obj[x]}

(* try them all *)
tryList = try /@ xList

(* find the minimum *)
MinimalBy[tryList, #[[2]] &]

(* {{5,3}} *)
(* the minimizing value is x = 5 for a min of 3 *)