Git Product home page Git Product logo

boat-soldiers-problem's Introduction

CS 461 โ€“ ARTIFICIAL INTELLIGENCE

HW #1

The problem was represented using different java objects such as Boy, Soldier, Boat, SideofRiver etc. Using these objects and the problem constraints every possible state was generated using the StateGenerator class. The StateGenerator also connected the states by checking in pairs if it was possible to reach one from the other. Visualising the resulting graph, we noticed that it looked very much like a tree. Using this insight, we turned the graph into a tree taking the initial state as root and adjusting the edges to make the graph directed. This was done in the GraphTraverser class. Having represented all possible states and their transitions as a tree, we used Breadth First Search to obtain the path from the initial state to the goal state. The Solver class searches the tree in a breadth first fashion and saves its path into a hash which is then printed onto the console.

The code also includes the GraphGenerator class which, using the data resulting from the solution procedure, visualises the solution tree into a file format viewable by a web browser. This file can be viewed by opening index.html with a web browser.

All of the necessary work is done in the main function within the Main class.

The library cytoscape.js is used to visualize the state tree. This library can be accessed from https://github.com/cytoscape/cytoscape.js

The state tree in index.html looks like this:

Black dots indicate the path from the initial state to the goal state. Green dots represent the search path. State tree

UML Diagram

UML

boat-soldiers-problem's People

Contributors

deterjan avatar eliztekcan avatar mrsfy avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

boat-soldiers-problem's Issues

<

<

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.