Code Monkey home page Code Monkey logo

quasigroupcompletion's Introduction

Quasigroup Completion

A quasigroup or latin square is an n ร— n array filled with n different symbols, each occurring exactly once in each row and exactly once in each column. In Quasigroup Completion Problem, a partial assignment of a latin square is given and one has to find whether it's possible to assign the remaining cells so that the result is a valid latin square.

So how do we approach solving the problem?

Try plain Backtracking first

We can use Backtracking to solve the problem. But backtracking visits a lot of nodes, most of which are backtracked from. If we could somehow avoid assigning the current variable a value that directly clashes with the assignment of past variables, we could have managed to prune a lot of unnecessary branches.

Don't contradict with past using Forward Checking

Forward Checking makes sure that we don't visit those unncessary branches, that directly contradict with the assignment of past variables. The AC3 algorithm for FC described here is used to make sure that we never assign the contradicting values to a variable. Still we are visiting a lot of nodes (but a lot less than plain backtracking) from which we are backtracked.

Detect furture failure with Maintaining Arc Consistency

Maintaining Arc Consistency takes the pruning one step further. It uses a AC3 algorithm for MAC described here to detect also the conflicts between future variables and therefore allows branches of the search tree that will lead to failure to be pruned earlier than with forward checking.

Variable Ordering

Variable Ordering determines which unassigned variable to assign next at some depth of the search tree we are traversing. Five types of ordering were reported:

  • Smallest Domain First
  • Minimum Forward Degree
  • Brelaz (minimizes domain size and then break ties by minimizing forward degree)
  • DOMDDEG (minimizes domain size to forward degree ratio)
  • Row Major (just pick the unassigned cells one by one sequentially)

Value Ordeing

After we have picked the variable (cell) for assignment, Value Ordeing is used to determine in which order should we try assigning a value from the current domain of the variable. Two types of ordering were reported:

  • Sequential Ordering (try the available values from smallest to largest)
  • Diagonal Frequency Ordering (give priority to values which occur more frequently in the diagonally adjacent assigned cells of the selected cell)

quasigroupcompletion's People

Contributors

solaimanope avatar

Watchers

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