Skip to content

Commit c8abb74

Browse files
committed
feat: added files from old repository
1 parent 436ed26 commit c8abb74

File tree

4,643 files changed

+479412
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,643 files changed

+479412
-103
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Manifest.toml

Manifest.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ uuid = "543c5b92-ecbf-4ab6-ab9f-9ddc949b5521"
33
authors = ["Jaan Tollander de Balsch"]
44
version = "0.0.0"
55

6+
[deps]
7+
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
8+
69
[compat]
710
julia = "1.6"
811

README.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,70 @@
1-
# LockPatternComplexity
1+
# Solving the Most Complex Lock Patterns
2+
3×3 | 5×5
3+
:-:|:-:
4+
![](results/3x3/22/8827232152991697021.svg) | ![](results/5x5/116/10911156195890606180.svg)
5+
distance: 22 | distance: 116
26

37
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://jaantollander.github.io/LockPatternComplexity.jl/stable)
48
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://jaantollander.github.io/LockPatternComplexity.jl/dev)
59
[![Build Status](https://github.com/jaantollander/LockPatternComplexity.jl/workflows/CI/badge.svg)](https://github.com/jaantollander/LockPatternComplexity.jl/actions)
10+
11+
4×4 | 6×6
12+
:-:|:-:
13+
![](results/4x4/57/10156495539748464886.svg) | ![](results/6x6/188/1547877444729350065.svg)
14+
distance: 57 | distance: 188
15+
16+
Solving the most complex lock patterns using Constraint Programming with [MiniZinc](https://www.minizinc.org/).
17+
18+
Lock patterns plots are generated using [Julia Language](https://julialang.org/) with Plots.jl package.
19+
20+
This problem was inspired by [What Is The Most Complicated Lock Pattern?](https://www.youtube.com/watch?v=PKjbBQ0PBCQ) by *Dr. Zye*. I highly recommend watching the video!
21+
22+
You can try out lock patterns with [lock pattern demo](https://tympanix.github.io/pattern-lock-js/) by @tympanix.
23+
24+
25+
## About
26+
We use similar definition of lock pattern complexity as in the *Dr. Zye*'s video. However, we generalize the definition such that we can find solutions for all n×n grid sizes.
27+
28+
**Satisfiability problem** cares about finding a max complexity patterns, that is, patterns where each line has a unique line type.
29+
30+
**Optimization problem** consideres max complexity pattern with higher taxicab distance as more complex.
31+
32+
For small instances, it is possible to find the maximum the taxicab distance. For larger instances, simply finding satisfying solutions can be quite difficult.
33+
34+
I'm writing more in-depth theory to the [**documentation**](https://jaantollander.github.io/lock-pattern-complexity/dev/).
35+
36+
37+
## Open Questions
38+
Can we find a max complexity pattern for 4×4 grid that provably maximizes the taxicab distance?
39+
40+
Can we find a max complexity pattern for 5×5 grid that provably maximizes the taxicab distance?
41+
42+
Can we find a max complexity pattern for 7×7 grid?
43+
44+
<!-- We can generalize the definition of pattern complexity as maximizing the number of line types used in the pattern as primary objective and maximizing the taxicab distance as secondary objective. In the generalized definition, every grid size would have solutions. Also, it would preserve the max complexity patterns. -->
45+
46+
<!-- A question that arises from the generalized definition is whether all grids have a generalized complexity pattern such that each line has a unique type. -->
47+
48+
49+
## Structure
50+
The [`src/nxn.mzn`](./src/nxn.mzn) file contains the MiniZinc constraint programming formulation.
51+
52+
The [`src/plots.jl`](./src/plots.jl) file contains the plotting code.
53+
54+
Each `nxn.sh` shell script inside [`scripts`](./scripts/) contains the command for running the model for the grid of given size.
55+
56+
The [`results`](./results/) directory contains the output from the shell scripts and the generated SVG plots for each grid size and taxicab distance in format `<grid>/<distance>/<id>.svg`.
57+
58+
59+
## Instructions
60+
We can begin by installing MiniZinc and adding it to our PATH environment variable. The, we can run the appropriate shell file from the `src` directory and write the output to `results/3x3.txt` file. For example:
61+
62+
```bash
63+
./scripts/3x3.sh > results/3x3.txt
64+
```
65+
66+
Alternatively, we can run the MiniZinc model directly.
67+
68+
```bash
69+
minizinc src/nxn.mzn -s -a --solver gecode -D "n=3;"
70+
```

docs/Manifest.toml

Lines changed: 0 additions & 97 deletions
This file was deleted.

0 commit comments

Comments
 (0)