5 kyu

Travelling salesman problem - Optimal solution

Description
Loading description...
Mathematics
Algorithms
  • Please sign in or sign up to leave a comment.
  • tobeannouncd Avatar

    Haskell translation

    • The description has been updated.
      • Code blocks have been made language-specific.
      • Most spelling/grammar errors have been corrected.
    • glovastefan Avatar

      Thank you for the Haskell translation. It has been approved.

      Also, thank you for correcting the spelling and grammar errors. Much appreciated.

      Suggestion marked resolved by glovastefan 5 months ago
  • Kata0329 Avatar

    This error comes up when I try without any of my code:

    div = max(abs(actual), abs(expected), 1) ^^^^^^^^^^^ TypeError: bad operand type for abs(): 'NoneType'

  • juanmcristobal Avatar

    Maybe it's something personal, because I'm practicing for interviews where I won't have the help of Google. But it would be interesting to have the Haversine formula available in the question statement

  • lechevalier Avatar

    Also typo travel_expenses

  • lechevalier Avatar

    Perhaps add links to other katas mentioned in description

  • Voile Avatar

    Every valid random test expects a large value, and tolerance = 0.1, so even, say, a constant difference of 2000 still passes all the random tests, and only fails the fixed test.

    • glovastefan Avatar

      Thank you. I have change tolerance to 0.00001, which accepts difference up to 0.01%. Also updated task from fixed amount of money to %.

      Issue marked resolved by glovastefan 2 years ago
  • Fbasham Avatar

    There's something wrong with your tests. See my solution.

    • glovastefan Avatar

      This comment has been hidden.

    • Fbasham Avatar

      Looks like tolerance has to be less than 1?

    • Fbasham Avatar

      Are you sure about the first sample test?

      test.assert_approx_equals(travel_expences(
          [
              {"lat": 55.8642, "long": -4.2518},
              {"lat": 52.4862, "long": -1.8904},
              {"lat": 53.2268, "long": -0.5379},
              {"lat": 53.5229, "long": -1.1312},
          ]
      ), 7602, 1)
      

      edit:

      looks like you other kata specified the distance as an int, but this one is a float?

      I think for continuity both katas should be reconciled to have the same distance calc. For now I think this is fixed.

    • Fbasham Avatar
      Issue marked resolved by Fbasham 2 years ago
    • Voile Avatar

      Sample tests still uses tolerance = 1.