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

Creating a default for make_cost_matrix #11

Merged
merged 2 commits into from
Jun 27, 2017
Merged

Creating a default for make_cost_matrix #11

merged 2 commits into from
Jun 27, 2017

Conversation

brunokim
Copy link
Contributor

I believe the make_cost_matrix function is more complex than it should. The most obvious solution would be to simply negate the profit matrix, but I'm not sure if the method expects a strictly positive matrix. We can then translate the negated matrix values enough to ensure positivity, by translating as much as the maximum. That is,

cost_matrix = max(profit_matrix) - profit_matrix

This solution works for all numeric types, thus not requiring one to specify a lambda function.

@brunokim
Copy link
Contributor Author

[PING] Is everything ok with this request?

@bmc bmc closed this Jun 27, 2017
@bmc bmc reopened this Jun 27, 2017
@bmc
Copy link
Owner

bmc commented Jun 27, 2017

I'm merging this in now. Can't believe it took me so long. It passes my newly implemented unit tests, so it's good to go.

@bmc bmc merged commit 984457e into bmc:master Jun 27, 2017
bmc added a commit that referenced this pull request Jun 27, 2017
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

Successfully merging this pull request may close these issues.

2 participants