GithubHelp home page GithubHelp logo

dias1c / lem-in Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 2.0 3.42 MB

๐Ÿœ Find optimal paths for ants

License: MIT License

Go 38.38% CSS 13.59% JavaScript 33.61% HTML 14.42%
graph golang go visualization web clean-architecture pkg alem-school lem-in algorithms

lem-in's Introduction

lem-in

The task of the project is here
Wiki here and thx for him

Chapters

Briefly about the project

This is a console program that builds a graph based on the data transmitted by the user and distributes the ants along the paths so that everyone reaches from A to B in a minimum of steps.

lem-in preview

Also you can use web version for visualize your result. To do this, insert the map with result into the text result block and click on Set Params. Now your graph is represented graphically.

How use program

Program takes only 1 argument. It can be filename or flags.

Default:

  • "filename" - your file path with graph data

Flags:

  • --file="filename" - as default input. Just an explicit launch with a file
  • --http=":port" - starts run server on your port. Using for visualization.

For run project:

go run ./cmd (filename | --http=:port | --file=filename)

Example:

Run program:

$ go run ./cmd example.txt
#My comment
3
##start
start 2 2
r1 3 1
r2 3 3
r3 4 1
##end
end 5 2

start-r1
start-r2
r1-r3
r2-end
r3-end
L1-r2 L2-r1 
L1-end L2-r3 L3-r2 
L2-end L3-end 

Also Get Steps Count:

$ go run ./cmd example.txt | grep '^L' | wc -l
3

Run visualization:

$ go run ./cmd --http=:8080
YYYY/MM/DD hh:mm:ss Server started on http://localhost:8080

The program is provided with information about the graph (anthill) at the input:

  • Number of ants (ants > 0)
  • The name of the vertices and their coordinates. The ##start and ##end commands specify the starting and ending vertices of the path. (x > 0 & y > 0)
  • Edges connecting vertices.
  • Optional comments starting by # (program ignore them)

Graphs in file

The map file looks like this

#My comment
3
##start
start 2 2
r1 3 1
r2 3 3
r3 4 1
##end
end 5 2

start-r1
start-r2
r1-r3
r2-end
r3-end

How Program works

short in diagram

To learn more, read the wiki

Suurballe's algorithm Links:

Authors

lem-in's People

Contributors

dias1c avatar raevnur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lem-in's Issues

We Should change algoritm "finding path" and fix "replace edges"

Commit 526713e0f82c4532aa886073136f6e5af2db0209
Finded Bug for 2 maps

  • Map 5ants2paths7steps
    This map tells us that we need to change the pathfinding algorithm.
5
##start
start 0 1
1 1 1
2 2 1
3 3 1
##end
end 4 1
5 1 0
6 2 0
7 3 0
8 1 2
9 2 2
10 3 2
start-1
1-2
2-3
3-end
5-1
5-6
6-7
7-end
start-8
8-9
9-10
10-3
2-5
2-10
  • Map 90ants3paths35steps
    This map shows that we have an incorrect replace edges when finding paths
90
##start
1 0 6
2 6 1
3 4 4
4 4 8
5 4 11
6 10 1
7 8 4
8 8 8
9 7 11
10 14 1
11 12 4
12 12 8
13 10 11
14 18 1
#com
15 16 4
16 16 8
17 13 11
18 16 11
##end
19 20 6
1-3
1-4
1-5
2-3
#com
2-6
3-4
3-7
4-8
6-7
6-10
7-8
7-11
8-12
10-11
10-14
11-12
11-15
12-16
14-19
14-15
15-19
15-16
#comande
16-19
5-9
9-13
13-17
17-18
18-16
4-5

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.