The Assignment problem is from Google OR-Tools
Others framework can solve this problem, even using Excel Solver. But ILOG CPLEX cannot solve this problem.
Here is my code in jupyter notebook:
import cplex
import docplex.mp
from docplex.mp.model import Model
import numpy as np
assignment_model = Model(name='Assignemnt_Problem', log_output=True)
costs = np.array([[90,80,75,70],
[35,85,55,65],
[125,95,90,95],
[45,110,95,115],
[50,100,90,100]])
x = assignment_model.binary_var_matrix(costs.shape[0], costs.shape[1], name="a")
assignment_model.add_constraints((sum(x[i,j] for i in range (costs.shape[0])) <=1
for j in range (costs.shape[1])), names ="workers")
assignment_model.add_constraints((sum(x[i,j] for j in range (costs.shape[1])) ==1
for i in range (costs.shape[0])), names ="tasks")
obj_fn = sum(x[i,j]*costs[i,j] for i in range (costs.shape[0]) for j in range(costs.shape[1]))
assignment_model.set_objective('min', obj_fn)
assignment_model.print_information()
assignment_model.solve()
print('Optimization is done. Objective Function Value: %.2f' % assignment_model.objective_value)
The error "DOcplexException: Model<Assignemnt_Problem> did not solve successfully"
Thanks