Skip to content

Commit 6b08cc6

Browse files
committed
v0.2.4 Docker file for OOP NQueens example. (to check that binding the same ports of localhost inside multiple running containers will not cause errors)
1 parent ff7deb0 commit 6b08cc6

File tree

6 files changed

+23
-14
lines changed

6 files changed

+23
-14
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Run build command in greyjack-solver-python dir
2+
#docker build -f ./examples/object_oriented/nqueens/Dockerfile . -t nqueens
3+
4+
FROM python:3.12.1-slim-bullseye
5+
6+
WORKDIR greyjack-solver-python
7+
8+
RUN python3 -m pip install greyjack numba
9+
10+
ADD ./examples/object_oriented/nqueens ./examples/object_oriented/nqueens/
11+
12+
EXPOSE 8000
13+
14+
CMD python3 /greyjack-solver-python/examples/object_oriented/nqueens/scripts/solve_nqueens.py
15+
#CMD ls

examples/object_oriented/nqueens/scripts/solve_nqueens.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
if __name__ == "__main__":
2121

2222
# build domain model
23-
domain_builder = DomainBuilderNQueens(16, random_seed=45)
23+
domain_builder = DomainBuilderNQueens(10000, random_seed=45)
2424
cotwin_builder = CotwinBuilderNQueens(use_incremental_score_calculator=True)
2525

2626
#termination_strategy = StepsLimit(step_count_limit=1000)
2727
#termination_strategy = TimeSpentLimit(time_seconds_limit=60)
2828
#termination_strategy = ScoreNoImprovement(time_seconds_limit=15)
2929
termination_strategy = ScoreLimit(score_to_compare=[0])
30-
agent = TabuSearch(neighbours_count=128, tabu_entity_rate=0.0,
30+
agent = TabuSearch(neighbours_count=20, tabu_entity_rate=0.0,
3131
mutation_rate_multiplier=None, move_probas=[0, 1, 0, 0, 0, 0],
3232
migration_frequency=10, termination_strategy=termination_strategy)
3333
"""agent = GeneticAlgorithm(population_size=128, crossover_probability=0.5, p_best_rate=0.05,

greyjack/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

greyjack/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "greyjack"
3-
version = "0.2.3"
3+
version = "0.2.4"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

greyjack/greyjack/SolverOOP.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,9 @@ def __init__(self, domain_builder, cotwin_builder, agent,
3232
"""
3333
On Linux platform solver needs 2 ports to bind.
3434
On other platforms n_agents + 2.
35-
All ports are binding to localhost.
36-
37-
TODO:
38-
Create and run 2 Docker containers, that will bind same internal (localhost) ports.
39-
Will them work simultaneously or someone (both) fall down?
40-
In theory, containers have theyr own network spaces.
41-
If Docker can bind the same ports of localhost in different containers
42-
for internal interprocess communication, then I don't need to care
43-
about internally binded ports count (only about exposed on the level of API facade).
35+
All ports are binding to localhost.
36+
If run multiple Dockers containers, multiple containers can bind the same ports of localhost (if built with default settings).
37+
Look examples to verify it yourself (for example, nquuens Dockerfile, guide to build is inside file).
4438
"""
4539

4640
self.domain_builder = domain_builder

greyjack/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ features = ["pyo3/extension-module"]
77

88
[project]
99
name = "greyjack"
10-
version = "0.2.3"
10+
version = "0.2.4"
1111
requires-python = ">=3.9"
1212
dependencies = [
1313
"dill",

0 commit comments

Comments
 (0)