diff options
| -rw-r--r-- | .travis.yml | 42 | ||||
| -rw-r--r-- | CMakeLists.txt | 24 | ||||
| -rw-r--r-- | Dockerfile | 31 | ||||
| -rw-r--r-- | README.md | 108 | ||||
| -rw-r--r-- | Senior_Honours_Project__Solitaire_Solver.pdf | bin | 4928873 -> 0 bytes | |||
| -rw-r--r-- | analysis/patience.R | 445 | ||||
| -rw-r--r-- | archive/README.md | 4 | ||||
| -rw-r--r-- | archive/build-notes.md (renamed from build-notes.md) | 0 | ||||
| -rw-r--r-- | archive/canfield-check.py (renamed from canfield-check.py) | 0 | ||||
| -rwxr-xr-x | archive/clean-build.sh (renamed from clean-build.sh) | 0 | ||||
| -rw-r--r-- | archive/docs/DOER-document/main.tex (renamed from docs/DOER-document/main.tex) | 0 | ||||
| -rw-r--r-- | archive/docs/DOER-document/references.bib (renamed from docs/DOER-document/references.bib) | 0 | ||||
| -rw-r--r-- | archive/docs/project-tools.md (renamed from docs/project-tools.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2017-09-12.md (renamed from docs/supervisor-meetings/2017-09-12.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2017-09-19.md (renamed from docs/supervisor-meetings/2017-09-19.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2017-09-25.md (renamed from docs/supervisor-meetings/2017-09-25.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2017-10-03.md (renamed from docs/supervisor-meetings/2017-10-03.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2017-10-12.md (renamed from docs/supervisor-meetings/2017-10-12.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2017-10-17.md (renamed from docs/supervisor-meetings/2017-10-17.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2017-10-24.md (renamed from docs/supervisor-meetings/2017-10-24.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2017-10-31.md (renamed from docs/supervisor-meetings/2017-10-31.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2017-11-07.md (renamed from docs/supervisor-meetings/2017-11-07.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2017-11-14.md (renamed from docs/supervisor-meetings/2017-11-14.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2017-11-28.md (renamed from docs/supervisor-meetings/2017-11-28.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2018-02-01.md (renamed from docs/supervisor-meetings/2018-02-01.md) | 0 | ||||
| -rw-r--r-- | archive/docs/supervisor-meetings/2018-02-08.md (renamed from docs/supervisor-meetings/2018-02-08.md) | 0 | ||||
| -rwxr-xr-x | archive/generate-results-optimisations-off.sh (renamed from generate-results-optimisations-off.sh) | 0 | ||||
| -rw-r--r-- | archive/optimisation-test.py (renamed from optimisation-test.py) | 0 | ||||
| -rwxr-xr-x | archive/real-benchmark.sh (renamed from real-benchmark.sh) | 0 | ||||
| -rwxr-xr-x | archive/repeat_deal.sh (renamed from repeat_deal.sh) | 0 | ||||
| -rwxr-xr-x | build.sh | 51 | ||||
| -rwxr-xr-x | docker-install.sh | 12 | ||||
| -rwxr-xr-x | enter-container.sh | 9 | ||||
| l--------- | solvitaire | 1 | ||||
| l--------- | solvitaire-debug | 1 | ||||
| l--------- | unit-tests | 1 | ||||
| l--------- | unit-tests-debug | 1 |
37 files changed, 231 insertions, 499 deletions
diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 15b8155..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: c++ - -install: -# Upgrade GCC -- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y -- sudo apt-get update -qq -- sudo apt-get install -qq g++-6 -- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 - -# Boost -- echo "Installing Boost Libraries" -- sudo wget -O boost_1_63_0.tar.gz http://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.gz/download > /dev/null 2>&1 -- sudo tar xzvf boost_1_63_0.tar.gz > /dev/null 2>&1 -- cd boost_1_63_0/ -- sudo ./bootstrap.sh --with-libraries=log,program_options > /dev/null 2>&1 -- sudo ./b2 link=shared threading=multi toolset=gcc optimization=space > /dev/null 2>&1 -- sudo ./b2 install > /dev/null 2>&1 -- cd .. - -# RapidJSON -- echo "Installing Rapid JSON" -- git clone https://github.com/Tencent/rapidjson.git -- cd rapidjson -- mkdir build -- cd build -- cmake .. -- sudo make -- sudo make install -- cd ../.. - -script: -# Generate build -- cmake -G "CodeBlocks - Unix Makefiles" -D CMAKE_CXX_COMPILER=g++-6 -DCMAKE_BUILD_TYPE=DEBUG --target solvitaire -Bcmake-build-debug -H. -- cmake -G "CodeBlocks - Unix Makefiles" -D CMAKE_CXX_COMPILER=g++-6 -DCMAKE_BUILD_TYPE=RELEASE --target solvitaire -Bcmake-build-release -H. - -# Build -- cmake --build cmake-build-debug -- cmake --build cmake-build-release - -# Run unit tests -- ./cmake-build-debug/bin/unit_tests -- ./cmake-build-release/bin/unit_tests diff --git a/CMakeLists.txt b/CMakeLists.txt index 1815077..3f2de60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,24 +162,24 @@ set_property(TARGET solvitaire PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) # For target_link_libraries(solvitaire LINK_PUBLIC ${Boost_LIBRARIES}) # add a separete executable for the 'no pile symmetry' version of the solver -add_executable(solvitaire-no-pile-symmetry ${main} ${sources}) -target_link_libraries(solvitaire-no-pile-symmetry LINK_PUBLIC ${Boost_LIBRARIES}) -set_target_properties(solvitaire-no-pile-symmetry PROPERTIES COMPILE_FLAGS -DNO_PILE_SYMMETRY) +#add_executable(solvitaire-no-pile-symmetry ${main} ${sources}) +#target_link_libraries(solvitaire-no-pile-symmetry LINK_PUBLIC ${Boost_LIBRARIES}) +#set_target_properties(solvitaire-no-pile-symmetry PROPERTIES COMPILE_FLAGS -DNO_PILE_SYMMETRY) # add a separete executable for the 'no suit symmetry' version of the solver -add_executable(solvitaire-no-suit-symmetry ${main} ${sources}) -target_link_libraries(solvitaire-no-suit-symmetry LINK_PUBLIC ${Boost_LIBRARIES}) -set_target_properties(solvitaire-no-suit-symmetry PROPERTIES COMPILE_FLAGS -DNO_SUIT_SYMMETRY) +#add_executable(solvitaire-no-suit-symmetry ${main} ${sources}) +#target_link_libraries(solvitaire-no-suit-symmetry LINK_PUBLIC ${Boost_LIBRARIES}) +#set_target_properties(solvitaire-no-suit-symmetry PROPERTIES COMPILE_FLAGS -DNO_SUIT_SYMMETRY) # add a separete executable for the 'no symmetry' version of the solver -add_executable(solvitaire-no-symmetry ${main} ${sources}) -target_link_libraries(solvitaire-no-symmetry LINK_PUBLIC ${Boost_LIBRARIES}) -set_target_properties(solvitaire-no-symmetry PROPERTIES COMPILE_FLAGS "-DNO_SUIT_SYMMETRY -DNO_PILE_SYMMETRY") +#add_executable(solvitaire-no-symmetry ${main} ${sources}) +#target_link_libraries(solvitaire-no-symmetry LINK_PUBLIC ${Boost_LIBRARIES}) +#set_target_properties(solvitaire-no-symmetry PROPERTIES COMPILE_FLAGS "-DNO_SUIT_SYMMETRY -DNO_PILE_SYMMETRY") # add a separete executable for the 'no auto foundations' version of the solver -add_executable(solvitaire-no-auto-foundations ${main} ${sources}) -target_link_libraries(solvitaire-no-auto-foundations LINK_PUBLIC ${Boost_LIBRARIES}) -set_target_properties(solvitaire-no-auto-foundations PROPERTIES COMPILE_FLAGS -DNO_AUTO_FOUNDATIONS) +#add_executable(solvitaire-no-auto-foundations ${main} ${sources}) +#target_link_libraries(solvitaire-no-auto-foundations LINK_PUBLIC ${Boost_LIBRARIES}) +#set_target_properties(solvitaire-no-auto-foundations PROPERTIES COMPILE_FLAGS -DNO_AUTO_FOUNDATIONS) ############################################################################### diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7a63b5b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM ubuntu:18.04 + +WORKDIR /home/Solvitaire/ + +COPY . /home/Solvitaire/ + +RUN apt-get update \ +&& apt-get install -y \ +gcc-6 \ +cmake \ +libboost-all-dev \ +git \ +python3 \ +vim \ +parallel + +RUN cmake [-G "CodeBlocks - Unix Makefiles"] \ +-DCMAKE_BUILD_TYPE=RELEASE \ +-Bcmake-build-release -H. \ +&& cmake [-G "CodeBlocks - Unix Makefiles"] \ +-DCMAKE_BUILD_TYPE=DEBUG \ +-Bcmake-build-debug -H. + +RUN cmake --build cmake-build-release \ +&& cmake --build cmake-build-debug + +WORKDIR /home/ +RUN mv /home/Solvitaire/ /home/.install/ +WORKDIR /home/Solvitaire/ + +CMD /bin/bash diff --git a/README.md b/README.md new file mode 100644 index 0000000..a6efdd9 --- /dev/null +++ b/README.md @@ -0,0 +1,108 @@ +# Solvitaire: A general solver for perfect-information solitaire games + +## Install + +The easiest way to install (and run) Solvitaire is by using the supplied +Docker image. For more information about installing Docker, head to +<https://www.docker.com/get-started> + +With Docker installed, simply run: + +``` +$ ./docker-install.sh +``` + +This command downloads a docker image containing an environment in which +Solvitaire can be built and run, without the user needing to worry about having +the correct dependencies/versions. + +It also adds a pre-made CMake build system and a built binary to your directory +so you don't have to wait for an initial build to compile. Rather convenient! + +The downside to this approach is that the Docker image is unfortunately quite +large, and pulling it may take a minute or two (although you only have to do +this once!) If you don't wish to use docker, the steps contained in +_Dockerfile_ should be a good guide to the required dependencies, although bear +in mind that on older Linux systems the required versions of dependencies may +not be available through _rpm_ / _deb_. + +## Using the Docker image + +To use the docker image, simply run: + +``` +$ ./enter-container.sh +``` + +This command will start the docker container and enter an interactive session +within the container's filesystem. The files you'll see there are simply a +mounted version of the root directory, so any changes you make in the +container will be reflected in your filesystem, and vice versa. When +you exit the interactive session the container will automatically be stopped. + +If you don't wish to enter an interactive session, you can run: + +``` +$ ./enter-container.sh "command_to_be_run" +``` + +This will spin up a container, run the command, and tear the container down, +with no noticeable overhead. Combining this with the fact that the repo's +files are mounted in the Docker image, means that a user can edit +Solvitaire's files on their local system using their own tools/editor, and +then build/execute Solvitaire in the controlled Docker environment - the +best of both worlds! + +For more information on Docker images, see +<https://docs.docker.com/get-started/part2/#recap-and-cheat-sheet-optional> + +## Build + +If the above instructions have been followed, you should already have a +built binary in the root directory. + +To (re-)build Solvitaire within the container, simply run: + +``` +$ ./build.sh [--release|--debug] [--solvitaire|--unit-tests] +(default args = "--release" "--solvitaire") +``` + +If you wish to run a build from outside the container, run: + +``` +$ ./enter-container.sh ./build.sh +``` + +For more build information and options, examine _build.sh_ and +_CMakeLists.txt._ + +## Run + +To run Solvitaire from within the container, simply run either: + +``` +$ ./solvitaire +$ ./solvitaire-debug +``` + +and for the unit tests (note, these must be +run inside src/test for the integration tests to pass): + +``` +$ cd src/test +$ ../../unit-tests +$ ../../unit-tests-debug +``` + +Or from outside the container: + +``` +$ ./enter-container.sh "cd src/test; ../../unit-tests" +``` + +## Help + +If you have any problems getting these steps to work, don't hesitate to get in +touch via <thecharlesblake@live.co.uk> + diff --git a/Senior_Honours_Project__Solitaire_Solver.pdf b/Senior_Honours_Project__Solitaire_Solver.pdf Binary files differdeleted file mode 100644 index e477963..0000000 --- a/Senior_Honours_Project__Solitaire_Solver.pdf +++ /dev/null diff --git a/analysis/patience.R b/analysis/patience.R deleted file mode 100644 index 011fa44..0000000 --- a/analysis/patience.R +++ /dev/null @@ -1,445 +0,0 @@ - - -# For Solvitaire experiments - -# if not already done then do following -# install.packages("data.table",repos="https://cloud.r-project.org/") -# install.packages("Hmisc",repos="https://cloud.r-project.org/") - -require(Hmisc) - -# 1 Lower Bound -# 2 Upper Bound -# 3 Solvable -# 4 Unsolvable -# 5 Intractable -# 6 Attempted Seed -# 7 Seed State -# 8 Streamliner Results -# 9 Time Taken(ms) -# 10 States Searched -# 11 Unique States Searched -# 12 Backtracks -# 13 Dominance Moves -# 14 States Removed From Cache -# 15 Final States In Cache -# 16 Final Buckets In Cache -# 17 Maximum Search Depth -# 18 Final Search Depth -# 19+ Seeds In Progress ... - -colnames <- c( - 'lowbound', - 'upbound', - 'numsolvable', - 'numunsolvable', - 'numintractable', - 'seed', - 'status', - 'status_str', - 'time', - 'states', - 'states_unique', - 'backtracks', - 'dominances', - 'cache_states_removed', - 'cache_final_states', - 'cache_final_buckets', - 'depth_max', - 'depth_final', - 'index', - 'sorted_index' - ) - -filenames = - c( "alpha-star.csv", - "bakers-game.csv", - "black-hole.csv", - "castles-of-spain.csv", - "delta-star.csv", - "eight-off-any-card-spaces.csv", - "eight-off.csv", - "fan.csv", - "flower-garden.csv", - "fore-cell.csv", - "fortunes-favor.csv", - "free-cell-0-cell.csv", - "free-cell-1-cell.csv", - "free-cell-2-cell.csv", - "free-cell-3-cell.csv", - "free-cell-4-pile.csv", - "free-cell-5-pile.csv", - "free-cell-6-pile.csv", - "free-cell-7-pile.csv", - "free-cell.csv", - "king-albert.csv", - "northwest-territory.csv", - "one-cell.csv", - "penguin.csv", - "raglan.csv", - "sea-towers.csv", - "somerset.csv", - "spanish-patience.csv", - "spiderette.csv", - "two-cell.csv", - "will-o-the-wisp.csv" - ) - - -read_stats = function(filename) { - maxfields = max(count.fields(filename,sep=",")) - colclasses = c(rep("numeric",6),rep("character",2),rep("numeric",10),rep("NULL",maxfields-18)) - dat = read.csv(filename,skip=4,colClasses=colclasses,header=FALSE,sep=',',strip.white=TRUE,flush=TRUE) - dat[ncol(dat)+1]=1:nrow(dat) - colnames(dat)=colnames[1:ncol(dat)] - odat = dat[order(dat$time),] - odat[ncol(odat)+1]=1:nrow(odat) - colnames(odat)=colnames[1:ncol(odat)] - odat -} - -# e.g. dat =read_stats("black-hole.csv") - -dats = lapply(filenames,read_stats) - - -plot_patiences = function(fs=filenames,timeout=600000) { - d = read_stats(fs[1]) - plot(d$sorted_index/nrow(d) ~ d$time,col=1,ylim=c(0,1),xlim=c(1,timeout),log="x") - if (length(fs) > 1) { - for (i in 2:length(fs)) { - d = read_stats(fs[i]) - points(d$sorted_index/nrow(d) ~ d$time,col=i) - } - } -} - - - - - - -patience_stats = function(filename,alpha=0.01) { - - maxfields = max(count.fields(filename,sep=",")) - colclasses = c(rep("numeric",6),rep("character",2),rep("numeric",10),rep("NULL",maxfields-18)) - dat = read.csv(filename,skip=4,colClasses=colclasses,header=FALSE,sep=',',strip.white=TRUE,flush=TRUE) - colnames(dat)=colnames[1:ncol(dat)] - - num = nrow(dat) - nsat = nrow(dat[dat$status=="solved",]) - nunsat = nrow(dat[dat$status=="unsolvable",]) - ntimeout = nrow(dat[dat$status=="timed-out",]) - nsat_str = nrow(dat[dat$status_str=="solved",]) - - bound1 = binconf(nsat,num,alpha=alpha,method="wilson") - bound2 = binconf(nsat+ntimeout,num,alpha=0.01,method="wilson") - - est = (bound1[1] + bound2[1])/2 - lbound = bound1[2] - ubound = bound2[3] - - c( alpha, - est,lbound,ubound, - num,nsat,nunsat,ntimeout,nsat_str, - median(dat$time), - mean(dat$time), - mean(dat$states), - mean(dat$states_unique), - mean(dat$backtracks), - mean(dat$dominances), - mean(dat$cache_states_removed), - mean(dat$cache_final_states), - mean(dat$cache_final_buckets), - mean(dat$depth_max), - mean(dat$depth_final) - ) -} - -res=t(sapply(filenames,patience_stats)) - - - -######### IGNORE FROM HERE -######### IGNORE FROM HERE -######### IGNORE FROM HERE -######### IGNORE FROM HERE -######### IGNORE FROM HERE -######### IGNORE FROM HERE -######### IGNORE FROM HERE -######### IGNORE FROM HERE -######### IGNORE FROM HERE -######### IGNORE FROM HERE -######### IGNORE FROM HERE - - - - - - - - -require(data.table) - -diags_xlim = c(0,1.75) -diags_ns = c('21','20','19','18','17','16','15','14','13','12','11','10') -diags_types = c(12,11,10,9,8,7,6,5,4,3,2,1) - -diags_timelim=c(0.001,200) -diags_meanlim=c(1,2.5e8) - - -# following for block2dimacs expts - -# n numblocks id status satisfiable timedout conflicts conflicts-p-s decisions decisions-p-s propagations Mprops-p-s lingeling-time total-usertime total-systemtime total-elapsedtime filename - -filename <- "run-diags-lingeling-raw.txt" - -colnames <- c( - 'n', 'm', 'id', - 'status', 'sat', 'timeout', - 'conflicts', 'conflictsps', - 'nodes', 'nodesps', - 'props', 'Mpropsps', - 'solvetime', - 'totaltime', 'totalsystime','totalwalltime', - 'filename' - ) - -numbercols <- c('totaltime', 'nodes','sat','n','m','conflicts','props','solvetime') - - - -lingelingdata <- read.table(filename,col.names=colnames,header=FALSE) -ld <- data.table(lingelingdata) - - - -ld.out <- ld[,list(x=(m)/n,psat=mean(sat),ptimeout=mean(timeout),nodesmean=mean(nodes),timemean=mean(totaltime),totaltimemean=mean(totaltime+totalsystime),totaltimemedian=median(totaltime+totalsystime),med=as.double(median(nodes)),max=max(nodes)),by=c("n","m")] -xlabel="Number of disallowed diagonals / n" - -ld3 <- ld.out[order(n,m)] -plotdata=ld3 - -pdf("diags-lingeling-prob.pdf",width=6,height=6,useDingbats=FALSE) -plot(plotdata$psat ~ plotdata$x,ann=FALSE,type="n",ylim=c(0,1),xlim=diags_xlim) -for (i in c(10,11,12,13,14,15,16,17,18,19,20,21)) { - lines(plotdata$psat[plotdata$n==i] ~ plotdata$x[plotdata$n==i],lwd=1,lty=i-9,pch=i-9,col=i-9,type='b') -} -legend('topright',diags_ns,lty=diags_types,pch=diags_types,col=diags_types) -title(ylab="Probability solution exists") -title(xlab=xlabel) -grid() -dev.off() - -pdf("diags-lingeling-timeoutprob.pdf",width=6,height=6,useDingbats=FALSE) -plot(plotdata$ptimeout ~ plotdata$x,ann=FALSE,type="n",ylim=c(0,1),xlim=diags_xlim) -for (i in c(10,11,12,13,14,15,16,17,18,19,20,21)) { - lines(plotdata$ptimeout[plotdata$n==i] ~ plotdata$x[plotdata$n==i],lwd=1,lty=i-9,pch=i-9,col=i-9,type='b') -} -legend('topright',diags_ns,lty=diags_types,pch=diags_types,col=diags_types) -title(ylab="Probability solution exists") -title(xlab=xlabel) -grid() -dev.off() - -pdf("diags-lingeling-mean.pdf",width=6,height=6,useDingbats=FALSE) -plot(plotdata$nodesmean ~ plotdata$x,ann=FALSE,type="n",log='y',ylim=diags_meanlim,xlim=diags_xlim) -for (i in c(10,11,12,13,14,15,16,17,18,19,20,21)) { -#for (i in c(10,15,20,25,30,35,40,45,50,55,60)) { - lines(plotdata$nodesmean[plotdata$n==i] ~ plotdata$x[plotdata$n==i], - lwd=1,lty=i-9,pch=i-9,col=i-9,type='b') -} -legend('topright',diags_ns,lty=diags_types,pch=diags_types,col=diags_types) -title(ylab="Mean search nodes") -title(xlab=xlabel) -grid() -dev.off() - -pdf("diags-lingeling-time.pdf",width=6,height=6,useDingbats=FALSE) -plot(plotdata$timemean ~ plotdata$x,ann=FALSE,type="n",log='y',ylim=diags_timelim,xlim=diags_xlim) -for (i in c(10,11,12,13,14,15,16,17,18,19,20,21)) { - lines(plotdata$timemean[plotdata$n==i] ~ plotdata$x[plotdata$n==i], - lwd=1,lty=i-9,pch=i-9,col=i-9,type='b') -} -legend('topright',diags_ns,lty=diags_types,pch=diags_types,col=diags_types) -title(ylab="Mean time taken") -title(xlab=xlabel) -grid() -dev.off() - -# following for shiftqueens expts - -# n numdiags mininrow id filename numsols text nodes text timeout text time(s) - -filename <- "run-diags-shiftqueens-processed.txt" - -colnames <- c( - 'n', 'm', 'mininrow', 'id', - 'filename', 'sat', - 'c7', 'nodes', - 'c8', 'timeout', - 'c9', 'totaltime' - ) - -numbercols <- c('totaltime', 'nodes','sat','n','m','mininrow','timeout') - - -shiftqueensdata <- read.table(filename,col.names=colnames,header=FALSE) -sd <- data.table(shiftqueensdata) - - -sd.out <- sd[,list(x=(m)/n,psat=mean(sat),ptimeout=mean(timeout),nodesmean=mean(nodes),timemean=mean(totaltime),totaltimemean=mean(totaltime),totaltimemedian=median(totaltime),med=as.double(median(nodes)),max=max(nodes)),by=c("n","m")] -xlabel="Number of disallowed diagonals / n" - -sd3 <- sd.out[order(n,m)] -plotdata=sd3 - - - -pdf("diags-shiftqueens-prob.pdf",width=6,height=6,useDingbats=FALSE) -plot(plotdata$psat ~ plotdata$x,ann=FALSE,type="n",ylim=c(0,1),xlim=diags_xlim) -for (i in c(10,11,12,13,14,15,16,17,18,19,20,21)) { - lines(plotdata$psat[plotdata$n==i] ~ plotdata$x[plotdata$n==i],lwd=1,lty=i-9,pch=i-9,col=i-9,type='b') -} -legend('topright',diags_ns,lty=diags_types,pch=diags_types,col=diags_types) -title(ylab="Probability solution exists") -title(xlab=xlabel) -grid() -dev.off() - -pdf("diags-shiftqueens-timeoutprob.pdf",width=6,height=6,useDingbats=FALSE) -plot(plotdata$ptimeout ~ plotdata$x,ann=FALSE,type="n",ylim=c(0,1),xlim=diags_xlim) -for (i in c(10,11,12,13,14,15,16,17,18,19,20,21)) { - lines(plotdata$ptimeout[plotdata$n==i] ~ plotdata$x[plotdata$n==i],lwd=1,lty=i-9,pch=i-9,col=i-9,type='b') -} -legend('topright',diags_ns,lty=diags_types,pch=diags_types,col=diags_types) -title(ylab="Probability solution exists") -title(xlab=xlabel) -grid() -dev.off() - - -pdf("diags-shiftqueens-mean.pdf",width=6,height=6,useDingbats=FALSE) -plot(plotdata$nodesmean ~ plotdata$x,ann=FALSE,type="n",log='y',ylim=diags_meanlim,xlim=diags_xlim) -for (i in c(10,11,12,13,14,15,16,17,18,19,20,21)) { -#for (i in c(10,15,20,25,30,35,40,45,50,55,60)) { - lines(plotdata$nodesmean[plotdata$n==i] ~ plotdata$x[plotdata$n==i], - lwd=1,lty=i-9,pch=i-9,col=i-9,type='b') -} -legend('topright',diags_ns,lty=diags_types,pch=diags_types,col=diags_types) -title(ylab="Mean search nodes") -title(xlab=xlabel) -grid() -dev.off() - -pdf("diags-shiftqueens-time.pdf",width=6,height=6,useDingbats=FALSE) -plot(plotdata$timemean ~ plotdata$x,ann=FALSE,type="n",log='y',ylim=diags_timelim,xlim=diags_xlim) -for (i in c(10,11,12,13,14,15,16,17,18,19,20,21)) { - lines(plotdata$timemean[plotdata$n==i] ~ plotdata$x[plotdata$n==i], - lwd=1,lty=i-9,pch=i-9,col=i-9,type='b') -} -legend('topright',diags_ns,lty=diags_types,pch=diags_types,col=diags_types) -title(ylab="Mean time taken") -title(xlab=xlabel) -grid() -dev.off() - -# following for minion - - -filename="run-diags-minion-strong-processed.txt" - -# In the stats data the nostats exe has an id appended -# 1 N (size of board) -# 2 M (number of queens to place) -# 3 D (min number in row) -# 4 instance id -# 5 problem eprime file -# 6 instance param file -# 7 if x cse switched on -# 8 x cse heuristic -# 9 not used -# 10 minion solve time -# 11 solver total time -# 12 minion setup time -# 13 solver nodes -# 14 solver timeout bool -# 15 solver satisfiable bool -# 16 savile row time -# 17 ?? savile row clauseout -# 18 solver memout bool -# 19 savile row timeout -# 20 numsat vars -# 21 numsat clauses - -mcolnames <- c('n','m','d','id', - 'eprime', 'param','c3','c4','c5', - 'solvetime','totaltime', - 'setuptime','nodes', - 'timeout', 'sat', - 'srtime','c13', - 'srmemout','srtimeout', - 'numvars','numclauses') - -numbercols <- c('totaltime','setuptime','nodes','sat','srtime','n','m','delta') - - - -# colnames.shifttime = c('delta','n','m','id','c5','sat','c7','nodes','c9','timeout','c11','solvetime') - -miniondata <- read.table(filename,col.names=mcolnames,header=FALSE) -md <- data.table(miniondata) - -md.out <- md[,list(x=(m)/n,psat=mean(sat),ptimeout=mean(timeout),nodesmean=mean(nodes),timemean=mean(totaltime),totaltimemean=mean(totaltime+srtime),totaltimemedian=median(totaltime+srtime),med=as.double(median(nodes)),max=max(nodes)),by=c("n","m")] -md3 <- md.out[order(n,m)] -plotdata=md3 - -pdf("diags-minion-prob.pdf",width=6,height=6,useDingbats=FALSE) -plot(plotdata$psat ~ plotdata$x,ann=FALSE,type="n",ylim=c(0,1),xlim=diags_xlim) -for (i in c(10,11,12,13,14,15,16,17,18,19,20,21)) { - lines(plotdata$psat[plotdata$n==i] ~ plotdata$x[plotdata$n==i],lwd=1,lty=i-9,pch=i-9,col=i-9,type='b') -} -legend('topright',diags_ns,lty=diags_types,pch=diags_types,col=diags_types) -title(ylab="Probability that solution exists") -title(xlab=xlabel) -grid() -dev.off() - -pdf("diags-minion-timeoutprob.pdf",width=6,height=6,useDingbats=FALSE) -plot(plotdata$ptimeout ~ plotdata$x,ann=FALSE,type="n",ylim=c(0,1),xlim=diags_xlim) -for (i in c(10,11,12,13,14,15,16,17,18,19,20,21)) { - lines(plotdata$ptimeout[plotdata$n==i] ~ plotdata$x[plotdata$n==i],lwd=1,lty=i-9,pch=i-9,col=i-9,type='b') -} -legend('topright',diags_ns,lty=diags_types,pch=diags_types,col=diags_types) -title(ylab="Probability solution exists") -title(xlab=xlabel) -grid() -dev.off() - -pdf("diags-minion-mean.pdf",width=6,height=6,useDingbats=FALSE) -plot(plotdata$nodesmean ~ plotdata$x,ann=FALSE,type="n",log='y',ylim=diags_meanlim,xlim=diags_xlim) -for (i in c(10,11,12,13,14,15,16,17,18,19,20,21)) { - lines(plotdata$nodesmean[plotdata$n==i] ~ plotdata$x[plotdata$n==i], - lwd=1,lty=i-9,pch=i-9,col=i-9,type='b') -} -legend('topright',diags_ns,lty=diags_types,pch=diags_types,col=diags_types) -title(ylab="Mean search nodes") -title(xlab=xlabel) -grid() -dev.off() - -pdf("diags-minion-time.pdf",width=6,height=6,useDingbats=FALSE) -plot(plotdata$timemean ~ plotdata$x,ann=FALSE,type="n",log='y',ylim=diags_timelim,xlim=diags_xlim) -for (i in c(10,11,12,13,14,15,16,17,18,19,20,21)) { - lines(plotdata$timemean[plotdata$n==i] ~ plotdata$x[plotdata$n==i], - lwd=1,lty=i-9,pch=i-9,col=i-9,type='b') -} -legend('topright',diags_ns,lty=diags_types,pch=diags_types,col=diags_types) -title(ylab="Mean time taken") -title(xlab=xlabel) -grid() -dev.off() - -quit() - diff --git a/archive/README.md b/archive/README.md new file mode 100644 index 0000000..f31f44a --- /dev/null +++ b/archive/README.md @@ -0,0 +1,4 @@ +# Archive + +A place to store old files which are no longer directly relevant to the +project, but shouldn't be discarded quite yet diff --git a/build-notes.md b/archive/build-notes.md index c7aca09..c7aca09 100644 --- a/build-notes.md +++ b/archive/build-notes.md diff --git a/canfield-check.py b/archive/canfield-check.py index 2bfd974..2bfd974 100644 --- a/canfield-check.py +++ b/archive/canfield-check.py diff --git a/clean-build.sh b/archive/clean-build.sh index ce17b8a..ce17b8a 100755 --- a/clean-build.sh +++ b/archive/clean-build.sh diff --git a/docs/DOER-document/main.tex b/archive/docs/DOER-document/main.tex index 400c6b6..400c6b6 100644 --- a/docs/DOER-document/main.tex +++ b/archive/docs/DOER-document/main.tex diff --git a/docs/DOER-document/references.bib b/archive/docs/DOER-document/references.bib index ae852d6..ae852d6 100644 --- a/docs/DOER-document/references.bib +++ b/archive/docs/DOER-document/references.bib diff --git a/docs/project-tools.md b/archive/docs/project-tools.md index 4bbfed8..4bbfed8 100644 --- a/docs/project-tools.md +++ b/archive/docs/project-tools.md diff --git a/docs/supervisor-meetings/2017-09-12.md b/archive/docs/supervisor-meetings/2017-09-12.md index 0124022..0124022 100644 --- a/docs/supervisor-meetings/2017-09-12.md +++ b/archive/docs/supervisor-meetings/2017-09-12.md diff --git a/docs/supervisor-meetings/2017-09-19.md b/archive/docs/supervisor-meetings/2017-09-19.md index 0e39748..0e39748 100644 --- a/docs/supervisor-meetings/2017-09-19.md +++ b/archive/docs/supervisor-meetings/2017-09-19.md diff --git a/docs/supervisor-meetings/2017-09-25.md b/archive/docs/supervisor-meetings/2017-09-25.md index b7c3a6e..b7c3a6e 100644 --- a/docs/supervisor-meetings/2017-09-25.md +++ b/archive/docs/supervisor-meetings/2017-09-25.md diff --git a/docs/supervisor-meetings/2017-10-03.md b/archive/docs/supervisor-meetings/2017-10-03.md index f43b9aa..f43b9aa 100644 --- a/docs/supervisor-meetings/2017-10-03.md +++ b/archive/docs/supervisor-meetings/2017-10-03.md diff --git a/docs/supervisor-meetings/2017-10-12.md b/archive/docs/supervisor-meetings/2017-10-12.md index 6360a6d..6360a6d 100644 --- a/docs/supervisor-meetings/2017-10-12.md +++ b/archive/docs/supervisor-meetings/2017-10-12.md diff --git a/docs/supervisor-meetings/2017-10-17.md b/archive/docs/supervisor-meetings/2017-10-17.md index 99ecd47..99ecd47 100644 --- a/docs/supervisor-meetings/2017-10-17.md +++ b/archive/docs/supervisor-meetings/2017-10-17.md diff --git a/docs/supervisor-meetings/2017-10-24.md b/archive/docs/supervisor-meetings/2017-10-24.md index 80ad93f..80ad93f 100644 --- a/docs/supervisor-meetings/2017-10-24.md +++ b/archive/docs/supervisor-meetings/2017-10-24.md diff --git a/docs/supervisor-meetings/2017-10-31.md b/archive/docs/supervisor-meetings/2017-10-31.md index 2083af0..2083af0 100644 --- a/docs/supervisor-meetings/2017-10-31.md +++ b/archive/docs/supervisor-meetings/2017-10-31.md diff --git a/docs/supervisor-meetings/2017-11-07.md b/archive/docs/supervisor-meetings/2017-11-07.md index 9dae911..9dae911 100644 --- a/docs/supervisor-meetings/2017-11-07.md +++ b/archive/docs/supervisor-meetings/2017-11-07.md diff --git a/docs/supervisor-meetings/2017-11-14.md b/archive/docs/supervisor-meetings/2017-11-14.md index b112a99..b112a99 100644 --- a/docs/supervisor-meetings/2017-11-14.md +++ b/archive/docs/supervisor-meetings/2017-11-14.md diff --git a/docs/supervisor-meetings/2017-11-28.md b/archive/docs/supervisor-meetings/2017-11-28.md index 8d927ee..8d927ee 100644 --- a/docs/supervisor-meetings/2017-11-28.md +++ b/archive/docs/supervisor-meetings/2017-11-28.md diff --git a/docs/supervisor-meetings/2018-02-01.md b/archive/docs/supervisor-meetings/2018-02-01.md index bd141ba..bd141ba 100644 --- a/docs/supervisor-meetings/2018-02-01.md +++ b/archive/docs/supervisor-meetings/2018-02-01.md diff --git a/docs/supervisor-meetings/2018-02-08.md b/archive/docs/supervisor-meetings/2018-02-08.md index fd43fbe..fd43fbe 100644 --- a/docs/supervisor-meetings/2018-02-08.md +++ b/archive/docs/supervisor-meetings/2018-02-08.md diff --git a/generate-results-optimisations-off.sh b/archive/generate-results-optimisations-off.sh index 510fa50..510fa50 100755 --- a/generate-results-optimisations-off.sh +++ b/archive/generate-results-optimisations-off.sh diff --git a/optimisation-test.py b/archive/optimisation-test.py index 594b9eb..594b9eb 100644 --- a/optimisation-test.py +++ b/archive/optimisation-test.py diff --git a/real-benchmark.sh b/archive/real-benchmark.sh index 1e7f7b3..1e7f7b3 100755 --- a/real-benchmark.sh +++ b/archive/real-benchmark.sh diff --git a/repeat_deal.sh b/archive/repeat_deal.sh index f33440f..f33440f 100755 --- a/repeat_deal.sh +++ b/archive/repeat_deal.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..1a6f660 --- /dev/null +++ b/build.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +build="release" +target="solvitaire" +error=false + +if [ "$#" == 1 ]; then + if [ "$1" == "--debug" ]; then + build="debug" + elif [ "$1" == "--release" ]; then + build="release" + elif [ "$1" == "--unit-tests" ]; then + target="unit_tests" + elif [ "$1" == "--solvitaire" ]; then + target="solvitaire" + else + error=true + fi +fi + +if [ "$#" == 2 ]; then + if [ "$1" == "--debug" ]; then + build="debug" + elif [ "$1" == "--release" ]; then + build="release" + else + error=true + fi + + if [ "$2" == "--unit-tests" ]; then + target="unit_tests" + elif [ "$2" == "--solvitaire" ]; then + target="solvitaire" + else + error=true + fi +fi + +if [ "$#" -gt 2 ]; then + error=true +fi + +if [ "$error" = true ]; then + echo "Usage: ./build.sh [--release|--debug] [--solvitaire|--unit-tests]" + echo "(default args = --release --solvitaire)" + exit 1 +else + cmake --build "cmake-build-$build" -- "$target" + exit 0 +fi + diff --git a/docker-install.sh b/docker-install.sh new file mode 100755 index 0000000..18d6ab5 --- /dev/null +++ b/docker-install.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Downloads the image +docker pull thecharlesblake/solvitiare:1.0 + +# If the cmake-build-[debug/release] folders don't exist, copies pre-generated +# versions from the docker image into the current directory (so new users +# don't have to wait for a long build to complete!) +if [ ! -d "cmake-build-release" && ! -d "cmake-build-debug" ]; then + docker run -i -v ${PWD}:/.install --rm solvitaire:1.0 \ + bash -c "cp -r ../.install/* ." +fi diff --git a/enter-container.sh b/enter-container.sh new file mode 100755 index 0000000..ac0c78d --- /dev/null +++ b/enter-container.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ "$#" == 0 ]; then + docker run -it -v$(pwd):/home/Solvitaire --rm \ + thecharlesblake/solvitaire:1.0 +else + docker run -it -v$(pwd):/home/Solvitaire --rm \ + thecharlesblake/solvitaire:1.0 bash -c "$*" +fi diff --git a/solvitaire b/solvitaire new file mode 120000 index 0000000..65ad3c5 --- /dev/null +++ b/solvitaire @@ -0,0 +1 @@ +cmake-build-release/bin/solvitaire
\ No newline at end of file diff --git a/solvitaire-debug b/solvitaire-debug new file mode 120000 index 0000000..a824555 --- /dev/null +++ b/solvitaire-debug @@ -0,0 +1 @@ +cmake-build-debug/bin/solvitaire
\ No newline at end of file diff --git a/unit-tests b/unit-tests new file mode 120000 index 0000000..9234f13 --- /dev/null +++ b/unit-tests @@ -0,0 +1 @@ +cmake-build-release/bin/unit_tests
\ No newline at end of file diff --git a/unit-tests-debug b/unit-tests-debug new file mode 120000 index 0000000..a23b263 --- /dev/null +++ b/unit-tests-debug @@ -0,0 +1 @@ +cmake-build-debug/bin/unit_tests
\ No newline at end of file |
