Code Monkey home page Code Monkey logo

Comments (4)

peternowee avatar peternowee commented on July 30, 2024

Actually that second route is the same as the first, just starting at a different point, going backwards and not returning to the start point. Not returning to the start point is what saves 1000.

from chinese-postman.

itsmi avatar itsmi commented on July 30, 2024

Thanks. What you say is true, but in the first (more expensive) case, the algorithm has to go back to the starting point in order to cover all lines. By doing that, it covers line [0,1] twice. In the second case, it doesn't have to return. So, it isn't/shouldn't be a requirement for the algorithm to return, but only to cover all lines in the shortest distance. Also, shouldn't the algorithm be able to find the best starting point automatically?

from chinese-postman.

peternowee avatar peternowee commented on July 30, 2024

I see what you mean, but I think you are defining a new problem then, because according to the Wikipedia-article on the Route inspection problem the path has to be closed:

[T]he Chinese postman problem (CPP), postman tour or route inspection problem is to find a shortest closed path or circuit that visits every edge of an (connected) undirected graph.

Still, interesting question you pose: What is the shortest route if closing the path is optional? I guess that you could just first find the closed path and then cut out the longest edge. That immediately defines the two starting/end points then.

from chinese-postman.

itsmi avatar itsmi commented on July 30, 2024

I understand -- I wasn't aware of that. Yes, that's how I implemented it. Thanks for your assistance!

from chinese-postman.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.