AMPL is reporting an error when the solve command is processing your objective function:

maximize risk_adjusted_return:
risk_aversion*((sum {i in A} mu[i] * w[i]- R_min)/(R_max-R_min))+
(1-risk_aversion)*((sum {i in A, j in A} w[i] * S[i, j] * w[j]- Var_min)/(Var_max - Var_min));

The message can'tcompute0.363404/0 indicates that a division by zero is occurring when AMPL tries to evaluate the coefficients in your objective. Add the following statement just before min_var.solve() to check the values that AMPL has for the two expressions that the objective is dividing by:

What output do you see? If R_max-R_min or Var_max-Var_min is zero, then you can check your Python program to determine the cause. Otherwise, you can get more help by posting your entire program, including the data.

Are you expecting R_max to be greater than R_min? Both R_max and R_min are params of the model, so if you are expecting R_max > R_min but AMPL is seeing R_max = R_min, then you should look for an error in your Python program.

Or, do you actually want your model to work when R_max = R_min? Then you cannot use an objective function that divides by R_max – R_min. You will have to reformulate the objective so that it does not divide by R_max – R_min. I cannot tell you what changes to make, however, since I am not familiar with the application that you are modeling.

R_max and R_min corresponding return values of variance min and variance max models,they have to be in the final model,I will do scaling,It is better when R_max=R_min solver still works,but how,model gives me like that.

I suggest that you concentrate on answering the following question:

When R_max = R_min, what expression do you want to use for the objective function?

If you can answer this question, then it should be possible to tell you how to write an AMPL model that works when R_max = R_min and also when R_max > R_min.