I have a Integer Linear Programming probem to solve. So, I decided o use python and SciPy spcecifically.
I have the following short snippet.
obj_function = running_instance_coeffs + new_instance_coeffs
A = [[1]*len(running_instance_coeffs) + [1]*len(new_instance_coeffs), encoding_speed_running_instances + encoding_speed_new_instances]
b = [MAX_INSTANCES, ((-1)*load/QoS)]
bounds=[]
for inst in running_instances:
bounds.append([0,1])
for inst in instances:
bounds.append([0,10])
res=linprog(obj_function, A_ub=A, b_ub=b, bounds=bounds, options={"disp": True})
print('Optimal value:', res.fun, '\nX:', res.x)
It works perfectly well. However, it does not give an integer solution. Is it possible to simply change it to ILP
solution? I realize there are other libraries like pulp
which allow to do this, but it would be easier to change it here.