Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transport Plan with Negative Value #10

Closed
davibarreira opened this issue Oct 28, 2021 · 2 comments
Closed

Transport Plan with Negative Value #10

davibarreira opened this issue Oct 28, 2021 · 2 comments

Comments

@davibarreira
Copy link
Member

I was updating one of the examples, and I realized that the transport plan was coming out with negative values.
I don't remember if we already discussed the issue, or if it's somehow wrongfully passing our tests. Here is the code I'm running:

using OptimalTransport
using Distances
using Plots
using Tulip

using LinearAlgebra
using Random

Random.seed!(1234)
M = 200
μ = fill(1 / M, M)
μsupport = rand(M,2)

N = 250
ν = fill(1 / N, N)
νsupport = rand(N,2);
C = pairwise(SqEuclidean(), μsupport', νsupport'; dims=2);
γ = emd(μ, ν, C, Tulip.Optimizer());

Of course, the problem is just the numerical approximation of the floats, when the values should actually be zero. But I wonder if we should enforce it to round up to zero or something.

@devmotion devmotion transferred this issue from JuliaOptimalTransport/OptimalTransport.jl Oct 28, 2021
@devmotion
Copy link
Member

We already specify that the solution has to be non-negative:

MOI.add_constraint(model, MOI.SingleVariable(xi), MOI.GreaterThan(zero_T))
So it's not our fault but you just observe the behaviour of Tulip (which apparently accepts if constraints are satisfied approximately). Some other LP solver might return non-negative values with these constraints... My suggestion would be to ask in Tulip if this behaviour is expected or should be considered a bug. But I think we should not change anything in our implementation for now.

@davibarreira
Copy link
Member Author

Great, thanks! Perhaps we should write something in our docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants