help with max_cost_assignment

Help
Teresa
2013-05-21
2013-07-16
  • Teresa

    Teresa - 2013-05-21

    Hi Davis,

    I'm trying to use max_cost_assignment.

    1) Does this function take in a square matrix or any matrix?
    2) What is the run time of this function?

    When I run in debug mode, I get this error
    DLIB_ASSERT(cost.nr() == cost.nc(),
    "\t std::vector<long> max_cost_assignment(cost)"
    << "\n\t cost.nr(): " << cost.nr()
    << "\n\t cost.nc(): " << cost.nc()
    );

    When run in release mode, I don't get this error.
    Is square matrix required as the input, if so, why doesn't it break in release?

    thank you for your help!

     
    • Davis

      Davis - 2013-07-16

      It takes a square matrix and runs in O(N^3) time.

      The assert statements are only enabled in debug mode because they slow down the code. They aren't so significant in this particular case but there are a lot of asserts in dlib and leaving them all on adds up to a big slowdown in many cases (e.g. some machine learning or image processing applications take a big hit).

      Also, if you look at the documentation for this routine (reachable by clicking the "detailed documentation" link here http://dlib.net/optimization.html#max_cost_assignment) you can find the preconditions for this function which tell you what is required to call it. In this case, it's just that you have to give a square matrix full of integers.

      Cheers,
      Davis

      P.S. Sorry for the very late reply. For some reason, I never received any notification email that you posted to the forums. I think this was when sourceforge was redoing their forum system. Who knows.

       

Log in to post a comment.