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

cost parameter in Solve function #1

Closed
captainst opened this issue Aug 4, 2020 · 2 comments
Closed

cost parameter in Solve function #1

captainst opened this issue Aug 4, 2020 · 2 comments
Assignees
Milestone

Comments

@captainst
Copy link

captainst commented Aug 4, 2020

Great implementation!

One issue I would like to point out is the cost parameter in Solve function, which is indeed modified inside the solve function. I did not notice that in the beginning until some werid result came up (I continued to use cost data later on in the program).

I think that it would be better to make a copy of the double[,] cost in the beginning of the solve function to avoid this mis-understanding, like this:

double[,] cost_copy = cost.Clone() as double[,];
// from here on, use cost_copy ...
// ...
@fuglede
Copy link
Owner

fuglede commented Oct 3, 2020

Thanks for the comment @captainst, and apologies for the late reply -- I managed to somehow only see your post now -- and for the debugging experience you had to go through.

I agree, that's likely to cause confusion. Copying can be quite costly, performance wise, so I'd probably make it optional (but default it to copying). That'll be a breaking change to the API, but if I get around to publishing the other changes that came about since the last NuGet deploy, there will be plenty of those anyway.

@fuglede fuglede closed this as completed in 57cd8b7 Oct 3, 2020
@fuglede
Copy link
Owner

fuglede commented Oct 3, 2020

Both Solver methods now come with an optional allowOverwrite (default: false) that can be toggled to improve performance in cases where copies could otherwise be avoided.

@fuglede fuglede added this to the 1.2.0 milestone Oct 4, 2020
@fuglede fuglede self-assigned this Oct 4, 2020
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