Commit Graph

71 Commits

Author SHA1 Message Date
Michael Neumann
c7dd965658 Get rid of panics. Return Result instead 2018-01-30 15:12:51 +01:00
Michael Neumann
46599ee62a Reformat source code using "cargo fmt" 2018-01-30 15:09:27 +01:00
Michael Neumann
75f19c85cd Document time complexity O(n^3) of the algorithm 2018-01-30 15:03:03 +01:00
Michael Neumann
4e6ba86258
Merge pull request #6 from mjkillough/disallowed
Support for disallowed assignments.
2018-01-30 14:51:37 +01:00
Michael Neumann
fcdd4e4b79
Merge pull request #5 from Antti/switch-to-ndarray
Switch to ndarray crate for the SquareMatrix
2018-01-30 12:41:41 +01:00
Michael Killough
d3e2c23415 Support for disallowed assignments.
Add support for disallowed assignments, and include a check to avoid
attempting to solve unsolvable matrices (where a row only has disallowed
values).

For now only allow `f32`/`f64`, as we can use `INFINITY` to encode a
disallowed assignment.

This is a re-implementation of most of bmc/munkres#20, but is missing
the changes to `step6`, which attempt to detect when we're not making
progress. I couldn't implement this without regressing performance and I
am not sure they add much given we're checking `is_solvable()` before
attempting to solve.
2017-11-07 12:21:19 +00:00
Andrii Dmytrenko
ad0d85a2c4 Remove square_matrix module 2017-11-07 11:26:00 +00:00
Michael Neumann
9596e3eef1 Merge pull request #4 from olleolleolle/patch-1
README: Use SVG for shiny badge
2017-10-25 16:57:42 +02:00
Andrii Dmytrenko
092818ab88 Use ndarray to implement SquareMatrix 2017-10-16 16:34:14 +01:00
Olle Jonsson
9a52140c0c README: Use SVG for shiny badge
- [ci skip]
2017-08-22 16:06:53 +02:00
Michael Neumann
b34aa6b2eb Remove unstable feature zero_one (Zero trait)
This allows this library to be build with a stable Rust release.
2016-07-16 13:40:13 +02:00
Michael Neumann
5f90104607 Update version to 0.2.0 2016-02-27 22:48:09 +01:00
Michael Neumann
9e72192398 Slightly improve performance by reusing path 2016-02-27 22:43:08 +01:00
Michael Neumann
ba128c0c93 Add is_zero() to trait WeightNum 2016-02-27 22:36:04 +01:00
Michael Neumann
ed7c417013 Remove benchmarks with 1000 or 2000. It's too slow 2016-02-27 22:30:53 +01:00
Michael Neumann
7ab7269164 Some minor changes 2016-02-27 22:30:06 +01:00
Michael Neumann
92b390ce88 Add some more test cases which detected the bug fix in
51c5b7638f
2016-02-27 20:46:35 +01:00
Michael Neumann
7feb1fcdaf unmark() need not be public. 2016-02-27 20:45:46 +01:00
Michael Neumann
a3a79cc599 Add some more debug assertions 2016-02-27 20:45:11 +01:00
Michael Neumann
51c5b7638f BUG FIX! If we cover a row and column, we have to leave the column
loop.

This degrades performance by a LOT!
2016-02-27 20:44:02 +01:00
Michael Neumann
75a5f20802 Add test case for WeightMatrix 2016-02-27 19:30:33 +01:00
Michael Neumann
999470f6ed Add test cases for SquareMatrix 2016-02-27 19:21:08 +01:00
Michael Neumann
1e3068fc29 Version 0.1.0 2015-12-21 15:48:24 +01:00
Michael Neumann
1abfbf5ada Add todo itemAdd todo itemAdd todo itemAdd todo itemAdd todo itemAdd todo itemAdd todo itemAdd todo item 2015-11-29 17:31:11 +01:00
Michael Neumann
f47fb4eb32 Use associated type 2015-11-29 17:18:55 +01:00
Michael Neumann
482bf47cd0 Introduce trait Weights 2015-11-29 17:14:50 +01:00
Michael Neumann
b69aa2c942 rustfmt 2015-11-29 16:31:58 +01:00
Michael Neumann
57dbd9c7b4 rustfmt 2015-11-29 16:31:50 +01:00
Michael Neumann
2eb5f8994f Move WeightMatrix into it's own module 2015-11-29 16:30:27 +01:00
Michael Neumann
98b367d434 Use more compact representation of Mark 2015-11-29 16:24:36 +01:00
Michael Neumann
883165b0d5 Refactor 2015-11-29 16:18:19 +01:00
Michael Neumann
5b5849cd40 Operating directly on bit-representation is not much faster. 2015-11-29 16:10:34 +01:00
Michael Neumann
1a15e8f7ac Refactor 2015-11-29 15:45:26 +01:00
Michael Neumann
856ea59d70 Improve performance by replacing bit_vec with fixedbitset.
Before:
    test bench_solve_100  ... bench:      53,365 ns/iter (+/- 651)
    test bench_solve_1000 ... bench:   5,864,809 ns/iter (+/- 102,059)
    test bench_solve_2000 ... bench:  34,347,333 ns/iter (+/- 200,639)

After:

    test bench_solve_100  ... bench:      41,574 ns/iter (+/- 765)
    test bench_solve_1000 ... bench:   4,693,452 ns/iter (+/- 189,201)
    test bench_solve_2000 ... bench:  29,954,973 ns/iter (+/- 438,573)
2015-11-29 15:03:57 +01:00
Michael Neumann
c61d7152a3 Refactor a bit 2015-11-29 14:53:51 +01:00
Michael Neumann
a9bf86e22a Only require PartialOrd, not Ord and Eq. This enables us to use floats as weights. 2015-10-30 13:07:05 +01:00
Michael Neumann
7abc850887 Add WeightMatrix::from_fn() 2015-10-30 12:51:05 +01:00
Michael Neumann
188dc61817 Fix warning 2015-10-30 10:27:06 +01:00
Michael Neumann
4ee267acc5 rustfmt 2015-10-26 00:12:54 +01:00
Michael Neumann
9619f69a4e Add keyword to Cargo.toml and release new version 2015-10-20 23:32:52 +02:00
Michael Neumann
4812071ec3 Add TODO 2015-10-20 23:31:44 +02:00
Michael Neumann
e4f3d74ad6 Rename benchmarks 2015-10-20 23:31:21 +02:00
Michael Neumann
7177a250e5 Hide mark_matrix::Mark 2015-10-20 13:47:54 +02:00
Michael Neumann
39fc8be008 Use an owned slice instead of Vec.
We never going to modify the shape of the matrix.
2015-10-20 13:38:15 +02:00
Michael Neumann
ec7ec7fa4f Add test case 2015-10-20 13:22:36 +02:00
Michael Neumann
8a9221d9fd license 2015-10-20 01:25:35 +02:00
Michael Neumann
7c4576f62a Add meta data 2015-10-20 01:24:13 +02:00
Michael Neumann
1fa471a35d Improve performance
Before:

    test bench_solve100  ... bench:      59,998 ns/iter (+/- 4,502)
    test bench_solve1000 ... bench:   6,761,411 ns/iter (+/- 379,337)

After:

    test bench_solve100  ... bench:      55,945 ns/iter (+/- 1,682)
    test bench_solve1000 ... bench:   6,116,007 ns/iter (+/- 277,546)
2015-10-20 01:18:25 +02:00
Michael Neumann
a3a55a5a57 Do not always inline 2015-10-20 01:02:18 +02:00
Michael Neumann
d33071e044 Improve performance of map_row()
Before:

    test bench_solve100  ... bench:      64,727 ns/iter (+/- 691)
    test bench_solve1000 ... bench:   7,160,735 ns/iter (+/- 315,280)

After:

    test bench_solve100  ... bench:      59,998 ns/iter (+/- 4,502)
    test bench_solve1000 ... bench:   6,761,411 ns/iter (+/- 379,337)
2015-10-20 01:00:25 +02:00