Coder Social home page Coder Social logo

netgen's Introduction

NetGen

A tool to generate efficient cargo networks (in Transport Fever 2)

The Map class represents a map, to which Town and Industry instances can be added. The class creates a delaunay triangulation network linking all towns and industries, optionally removing edges which cross impassable lines. A network which minimises cost by using empty return journey capacity is generated.

Features

  • Uses a custom graph data structure to store directional weight and cargo flow information per edge
  • Generates tab separated text output suitable for import into data visualisation softare or futher processing
  • Well documented source code

Documentation

The source code contains documentation of the main functions and types.

CargoType and WagonType enumerations represent cargo and wagon types.

Town and Industry classes represent towns and industries.

Initialization

Map is initialized empty and information is then added using the following methods:

  • addTown(_) to add a town
  • addIndustry(_) to add an industry
  • addImpassableLine(_) to add an impassable line

Network Generation

A network can be generated using te following methods:

  • triangulateAllLocations() to create the initial triangulation between all towns and industries
  • buildNetworkGraph() to build the network graph in which edges crossing impassable lines are removed from the triangulation
  • setUniformTownCargoRequirement(_) to set a uniform consumption demand for all towns
  • makeAllConnections() to make all connections for cargo required

Reporting network structure

The network structure can be inspected using the following methods:

  • printIndustryInfo() to print node id, type and location of all industries
  • printTownInfo() to print node id name and location of all towns
  • printAllPaths() to print informatino about each path
  • printEfficiencyStats() to print statistics about the efficiency of the network

netgen's People

Contributors

peteraisher avatar

Watchers

 avatar James Cloos 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.