Giter Club home page Giter Club logo

project2-tsp's Introduction

Daniel Kryzhanovsky and Gabe Howland

1/2.With the first 2 projects, we started off by defning the x and y coordinates of each city, going through the list of the cities and getting the coordinates. The output operator then goes the list compile in the istream and initializes it within the ostream.

3.Total path distance goes the list of the cities and initliazes the current 2 cities values to caluclate the distance of the two points. After the loop ends, it goes through the process again to find the diatcne of the last point in the list and the first point in the list.

4. To reorder, Cities::reorder is able to take a random ordering of the list and redifine each new ordered point based on the new position they are given by the permuation through the loop. It then pushes the new order to nu_ord to get the new order of the cities.

5.In order to get random integers to use for the program, we make sure to declare a list of order cities incase one wasn't made through the first for loop, we then shuffle all the cities starting from the first and ending in the last in order to get the current order of cities. 

6.We start off by checking if the file is being initialized or not, if so, we then intiailize the is_file and istreams and ostreams to get the program running. We then make sure to use the city size and city distance to initalize the total amount of cities and the "best route" for the list of cities. We then use best city to allow for the permutaion of the new random cities to be accounted for when creating the new shortest path, which allows all of the random permutations to be set. Through the for loop, we start from the beginning until we reach 1 million, which then generates a new list of cities, caculates the distance, reorders them, and then finally initalizes the cities within the new cities object. It then saves these files to the file called "shortest.tsv".

project2-tsp's People

Contributors

gabeah avatar

Watchers

 avatar

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.