-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from sedatsevgili/problem
Problem
- Loading branch information
Showing
27 changed files
with
736 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Include any files or directories that you don't want to be copied to your | ||
# container here (e.g., local build artifacts, temporary files, etc.). | ||
# | ||
# For more help, visit the .dockerignore file reference guide at | ||
# https://docs.docker.com/engine/reference/builder/#dockerignore-file | ||
|
||
**/.DS_Store | ||
**/__pycache__ | ||
**/.venv | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Use an official PHP runtime as a parent image | ||
FROM php:8.1-cli | ||
|
||
# Set working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Install Composer globally | ||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer | ||
|
||
# Adding user for application (non-root) | ||
RUN useradd -m appuser && chown -R appuser:appuser /usr/src/app | ||
USER appuser | ||
|
||
# Copy the application files | ||
COPY --chown=appuser:appuser . . | ||
|
||
# Install dependencies | ||
RUN composer install | ||
|
||
# Command to run the application | ||
CMD [ "php", "./run.php" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
up: | ||
docker-compose up -d | ||
|
||
down: | ||
docker-compose down | ||
|
||
build: | ||
docker-compose build | ||
|
||
logs: | ||
docker-compose logs -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
build: . | ||
volumes: | ||
- .:/usr/src/app | ||
ports: | ||
- "8000:8000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,35 @@ | ||
<?php | ||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
$chromosome = new \Charlie\Chromosome\Chromosome([ | ||
new \Charlie\Gene\ByteGene(), | ||
new \Charlie\Gene\ByteGene(), | ||
new \Charlie\Gene\ByteGene(), | ||
(new \Charlie\Gene\ByteGene())->set(true), | ||
(new \Charlie\Gene\ByteGene())->set(true), | ||
(new \Charlie\Gene\ByteGene())->set(true), | ||
$population = \Charlie\Util\StringUtilities::createPopulationWithByteGenes([ | ||
'000000000', | ||
'000100000', | ||
'001000000', | ||
'011000000', | ||
'000100000', | ||
'001000000', | ||
'011001000', | ||
'000100000', | ||
'001001000', | ||
'011001000', | ||
'000100000', | ||
'001001000', | ||
'011000000', | ||
'000100100', | ||
'001010000', | ||
'011010000', | ||
]); | ||
|
||
dump($chromosome->__toString()); | ||
$chromosome->mutate(); | ||
dump($chromosome->__toString()); | ||
$randomizer = new \Charlie\Randomizer\MtRandomizer(); | ||
|
||
$problem = new \Charlie\Actions\Problem\Problem(); | ||
$problem->setCalculator(new \Charlie\Fitness\DummySumCalculator()); | ||
$problem->setCrossOver(new \Charlie\Actions\CrossOver($randomizer)); | ||
$problem->setMutator(new \Charlie\Actions\Mutator($randomizer)); | ||
$problem->setSelection(new \Charlie\Actions\PairSelection()); | ||
$problem->setPopulation($population); | ||
$problem->setMaxEvolveCount(100); | ||
|
||
$problem->solve(); | ||
|
||
echo (string) $problem->getPopulation() . PHP_EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.