Skip to content

Comparison to Gurobi: OT (emd) not giving optimal plan #477

Answered by rflamary
floyebolu asked this question in Q&A
Discussion options

You must be logged in to vote

I had a look at the cost matrix and it appears that you have very large values and very small ones. I guess that gurobi has tricks to handle this but the OT solver in ot.emd uses float64 that can handle a dynamic of only around 1e16 and provides the best solution at this precision.

I just cliped the max values à 1e10 with cost_matrix2 = np.clip(cost_matrix, a_min=-np.inf, a_max=1e10) and the resulting OT plan and cost is now very close to gurobi at 0.7318552570921427 when computing the loss with the original matrix.

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@floyebolu
Comment options

Answer selected by rflamary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants