diff --git a/.gitignore b/.gitignore index 0c7e969..82695cb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.jl.*.cov *.jl.mem deps/deps.jl +Manifest.toml #Ipython Notebook .ipynb_checkpoints diff --git a/.travis.yml b/.travis.yml index cb0d1e0..cabcf81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,21 @@ language: julia sudo: false julia: - - 0.7 - 1.0 -matrix: - allow_failures: - - julia: 1.0 + - 1.4 notifications: email: false #script: # use the default script setting which is equivalent to the following after_success: - - julia -e 'Pkg.add("Documenter")' - - julia -e 'cd(Pkg.dir("MatchingMarkets")); ENV["DOCUMENTER_DEBUG"] = "true"; include(joinpath("docs", "make.jl"))' - - julia -e 'cd(Pkg.dir("MatchingMarkets")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder()); Codecov.submit(process_folder())' + - julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder()); Codecov.submit(process_folder())' + +jobs: + include: + - stage: Documentation + julia: 1.0 + script: julia --project=docs -e ' + using Pkg; + Pkg.develop(PackageSpec(path=pwd())); + Pkg.instantiate(); + include("docs/make.jl");' + after_success: skip diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..63d724e --- /dev/null +++ b/Project.toml @@ -0,0 +1,14 @@ +name = "MatchingMarkets" +uuid = "e68f4404-efa2-50fc-b2c2-4576a91ecd1b" + +[deps] +Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" + +[compat] +julia = "≥ 1.0.0" + +[extras] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Test"] diff --git a/REQUIRE b/REQUIRE deleted file mode 100644 index 859ad46..0000000 --- a/REQUIRE +++ /dev/null @@ -1 +0,0 @@ -julia 0.7 diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..dfa65cd --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,2 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" diff --git a/docs/make.jl b/docs/make.jl index 6ab802b..ca6c072 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,23 +1,19 @@ using Documenter, MatchingMarkets -makedocs( - modules = [MatchingMarkets], - format = :html, - sitename = "MatchingMarkets.jl", - pages = Any[ +makedocs(; + modules=[MatchingMarkets], + format=Documenter.HTML(), + pages=[ "Home" => "index.md", - "Library" => Any[ + "Library" => [ "lib/public.md", "lib/internals.md", ], - ] + ], + repo="https://github.com/oyamad/MatchingMarkets.jl/blob/{commit}{path}#L{line}", + sitename="MatchingMarkets.jl", ) -deploydocs( - repo = "github.com/oyamad/MatchingMarkets.jl.git", - branch = "gh-pages", - target = "build", - julia = "0.6", - deps = nothing, - make = nothing, +deploydocs(; + repo="github.com/oyamad/MatchingMarkets.jl", ) diff --git a/docs/src/index.md b/docs/src/index.md index fd1a505..aeb79cb 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -11,10 +11,11 @@ end ## Installation -This is an unregistered package. To install, open a `Julia` session and type +This is an unregistered package. +To install, enter Pkg mode by pressing `]` and run ```julia -Pkg.clone("https://github.com/oyamad/MatchingMarkets.jl") +add https://github.com/oyamad/MatchingMarkets.jl ``` ## Usage diff --git a/examples/examples.ipynb b/examples/examples.ipynb index 0edb8fb..8daf40c 100644 --- a/examples/examples.ipynb +++ b/examples/examples.ipynb @@ -703,25 +703,27 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [] } ], "metadata": { + "@webio": { + "lastCommId": null, + "lastKernelId": null + }, "anaconda-cloud": {}, "kernelspec": { - "display_name": "Julia 0.7.0", + "display_name": "Julia 1.4.1", "language": "julia", - "name": "julia-0.7" + "name": "julia-1.4" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", - "version": "0.7.0" + "version": "1.4.1" } }, "nbformat": 4, diff --git a/examples/random_prefs.ipynb b/examples/random_prefs.ipynb index d58af80..7c90fee 100644 --- a/examples/random_prefs.ipynb +++ b/examples/random_prefs.ipynb @@ -27,10 +27,10 @@ "data": { "text/plain": [ "4×4 Array{Int64,2}:\n", - " 2 3 2 3\n", - " 3 2 0 1\n", - " 1 1 3 0\n", - " 0 0 1 2" + " 2 3 1 2\n", + " 0 2 0 1\n", + " 3 0 2 0\n", + " 1 1 3 3" ] }, "execution_count": 3, @@ -51,11 +51,11 @@ "data": { "text/plain": [ "5×3 Array{Int64,2}:\n", - " 1 2 4\n", - " 4 0 1\n", - " 2 3 3\n", - " 3 1 2\n", - " 0 4 0" + " 2 3 1\n", + " 4 2 3\n", + " 3 4 4\n", + " 0 0 0\n", + " 1 1 2" ] }, "execution_count": 4, @@ -85,9 +85,9 @@ "data": { "text/plain": [ "4×4 Array{Int64,2}:\n", - " 3 2 1 2\n", - " 2 3 2 1\n", - " 1 1 3 3\n", + " 2 3 2 3\n", + " 1 2 1 2\n", + " 3 1 3 1\n", " 0 0 0 0" ] }, @@ -111,10 +111,10 @@ "data": { "text/plain": [ "5×3 Array{Int64,2}:\n", - " 4 3 1\n", - " 3 2 2\n", - " 2 1 4\n", - " 1 4 3\n", + " 1 2 4\n", + " 3 3 3\n", + " 4 4 1\n", + " 2 1 2\n", " 0 0 0" ] }, @@ -145,10 +145,10 @@ "data": { "text/plain": [ "4×4 Array{Int64,2}:\n", - " 1 3 3 1\n", - " 2 1 1 3\n", - " 0 0 0 2\n", - " 3 2 2 0" + " 3 2 3 3\n", + " 2 1 2 2\n", + " 1 0 1 1\n", + " 0 3 0 0" ] }, "execution_count": 9, @@ -169,11 +169,11 @@ "data": { "text/plain": [ "5×3 Array{Int64,2}:\n", - " 1 3 4\n", - " 0 0 3\n", - " 3 1 1\n", - " 2 4 2\n", - " 4 2 0" + " 4 1 3\n", + " 1 3 0\n", + " 0 0 1\n", + " 2 4 4\n", + " 3 2 2" ] }, "execution_count": 10, @@ -194,9 +194,9 @@ "data": { "text/plain": [ "3-element Array{Int64,1}:\n", + " 3\n", " 2\n", - " 1\n", - " 3" + " 2" ] }, "execution_count": 11, @@ -226,9 +226,9 @@ "data": { "text/plain": [ "4×4 Array{Int64,2}:\n", - " 3 1 2 1\n", - " 2 3 1 2\n", - " 1 2 3 3\n", + " 1 2 3 1\n", + " 2 1 1 3\n", + " 3 3 2 2\n", " 0 0 0 0" ] }, @@ -250,10 +250,10 @@ "data": { "text/plain": [ "5×3 Array{Int64,2}:\n", - " 1 3 4\n", - " 2 2 2\n", - " 3 4 1\n", - " 4 1 3\n", + " 3 3 2\n", + " 1 4 1\n", + " 4 2 4\n", + " 2 1 3\n", " 0 0 0" ] }, @@ -276,8 +276,8 @@ "text/plain": [ "3-element Array{Int64,1}:\n", " 2\n", - " 1\n", - " 1" + " 2\n", + " 2" ] }, "execution_count": 15, @@ -304,6 +304,103 @@ }, { "data": { + "text/latex": [ + "\\begin{verbatim}\n", + "random_prefs([rng, ]m, n[, ReturnCaps]; allow_unmatched=true)\n", + "\\end{verbatim}\n", + "Generate random preference order lists for two groups, say, m males and n females.\n", + "\n", + "Each male has a preference order over femals [1, ..., n] and \"unmatched\" which is represented by 0, while each female has a preference order over males [1, ..., m] and \"unmatched\" which is again represented by 0.\n", + "\n", + "The argument \\texttt{ReturnCaps} should be supplied in the context of college admissions, in which case \"males\" and \"females\" should be read as \"students\" and \"colleges\", respectively, where each college has its capacity.\n", + "\n", + "The optional \\texttt{rng} argument specifies a random number generator.\n", + "\n", + "\\section{Arguments}\n", + "\\begin{itemize}\n", + "\\item \\texttt{m::Integer} : Number of males.\n", + "\n", + "\n", + "\\item \\texttt{n::Integer} : Number of females.\n", + "\n", + "\n", + "\\item \\texttt{::Type\\{ReturnCaps\\}} : If supplied, \\texttt{caps} is also returned.\n", + "\n", + "\n", + "\\item \\texttt{;allow\\_unmatched::Bool(true)} : If false, return preference order lists of males and females where 0 is always placed in the last place, (i.e., \"unmatched\" is least preferred by every individual).\n", + "\n", + "\\end{itemize}\n", + "\\section{Returns}\n", + "\\begin{itemize}\n", + "\\item \\texttt{m\\_prefs::Matrix\\{Int\\}} : Array of shape (n+1, m), where each column contains a random permutation of 0, 1, ..., n.\n", + "\n", + "\n", + "\\item \\texttt{f\\_prefs::Matrix\\{Int\\}} : Array of shape (m+1, n), where each column contains a random permutation of 0, 1, ..., m.\n", + "\n", + "\n", + "\\item \\texttt{caps::Vector\\{Int\\}} : Vector of length n containing each female's (or college's) capacity. Returned only when \\texttt{ReturnCaps} is supplied.\n", + "\n", + "\\end{itemize}\n", + "\\section{Examples}\n", + "\\begin{verbatim}\n", + "julia> m_prefs, f_prefs = random_prefs(4, 3);\n", + "\n", + "julia> m_prefs\n", + "4x4 Array{Int64,2}:\n", + " 3 3 1 3\n", + " 0 2 3 1\n", + " 2 1 2 0\n", + " 1 0 0 2\n", + "\n", + "julia> f_prefs\n", + "5x3 Array{Int64,2}:\n", + " 1 2 4\n", + " 4 3 1\n", + " 3 4 2\n", + " 0 0 0\n", + " 2 1 3\n", + "\n", + "julia> m_prefs, f_prefs = random_prefs(4, 3, allow_unmatched=false);\n", + "\n", + "julia> m_prefs\n", + "4x4 Array{Int64,2}:\n", + " 1 3 1 2\n", + " 2 1 3 3\n", + " 3 2 2 1\n", + " 0 0 0 0\n", + "\n", + "julia> f_prefs\n", + "5x3 Array{Int64,2}:\n", + " 1 2 3\n", + " 2 3 4\n", + " 4 1 1\n", + " 3 4 2\n", + " 0 0 0\n", + "\n", + "julia> s_prefs, c_prefs, caps = random_prefs(4, 3, ReturnCaps);\n", + "\n", + "julia> s_prefs\n", + "4x4 Array{Int64,2}:\n", + " 2 1 2 1\n", + " 1 3 1 0\n", + " 3 2 3 3\n", + " 0 0 0 2\n", + "\n", + "julia> c_prefs\n", + "5x3 Array{Int64,2}:\n", + " 3 4 1\n", + " 0 1 4\n", + " 4 3 0\n", + " 1 2 3\n", + " 2 0 2\n", + "\n", + "julia> caps\n", + "3-element Array{Int64,1}:\n", + " 1\n", + " 2\n", + " 2\n", + "\\end{verbatim}\n" + ], "text/markdown": [ "```\n", "random_prefs([rng, ]m, n[, ReturnCaps]; allow_unmatched=true)\n", @@ -506,24 +603,26 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [] } ], "metadata": { + "@webio": { + "lastCommId": null, + "lastKernelId": null + }, "kernelspec": { - "display_name": "Julia 0.7.0", + "display_name": "Julia 1.4.1", "language": "julia", - "name": "julia-0.7" + "name": "julia-1.4" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", - "version": "0.7.0" + "version": "1.4.1" } }, "nbformat": 4,