I am trying to maximize a problem that contains a set of continuous variables(x_1,...,x_n \in [0,1]) using CPLEX. I attached the code in the following. The problem is that culex always gives me all the variables x_1,.., xn =0.5 which is the wrong answer. I changed the c matrix (cost function), and do warm startup, but nothing changes the solutions. It gives always the solution of 0.5 for all variables. Could any one kindly help me? Thanks
from docplex.mp.model import Model
mdl = Model()
x = [mdl.continuous_var(0,1,name="x%s" % i) for i in range(len(c))]
objective = mdl.sum(
[c[i, j] * x[i] * (1 - x[j]) for i in range(len(c)) for j in range(len(c))]
)
mdl.maximize(objective)
warmstart=mdl.new_solution()
warmstart.add_var_value(x[0],0.5)
warmstart.add_var_value(x[1],0.25)
mdl.add_mip_start(warmstart)
sol=mdl.solve(log_output=True)
------------------------------
Roya Radgohar
------------------------------