Originally posted by: maffo
Hi everybody, I don't know why in the solution of the f [n] variables it give me only 0 or 1 and not a float solution. Is there any mystake in the code?
Thank you to all.
rangen=0..9;
floatA[n]=[33.16479327, -67.47344778, -5.940004493, 29.5089636, 68.69174626, 4.840210522, 21.07559612, -7.089604808, -4.939224516, -13.38608625];
floatB[n]=[-593.63, 3895.672009, 1949.281166, -27.8694549, -18.9597056, 4479.880643, 904.7304375, -4993.571365, -349.6486495, 8535.998486];
floatC[n]=[2.424937409, 15.57329839, 7.160911971, 1.267162245, 6.071135478, 0.644973685, 4.615640621, 13.68181686, 11.81301007, 8.201283407];
inthtotmax=35;
inthmax[n]=[6, 8, 5, 6, 8, 7, 9, 10, 6, 5];
intj;
//var decisionali
dvar int+hours[n];
dvar float+f[n];
// ob.f
minimize sum(j in n) A[j]*hours[j]+ B[j]*f[j] +C[j]*hours[j]*f[j];
subject to{
forall(j in n)
hours[j]<=hmax[j];
sum(j in n) hours[j]<=htotmax;
0<=f[0]<=1;
0<=f[1]<=1;
0<=f[2]<=1;
0<=f[3]<=1;
0<=f[4]<=1;
0<=f[5]<=1;
0<=f[6]<=1;
0<=f[7]<=1;
0<=f[8]<=1;
0<=f[9]<=1;
}
#DecisionOptimization#OPLusingCPLEXOptimizer