Skip to content

Commit

Permalink
More Actions (#3)
Browse files Browse the repository at this point in the history
* More actions

* Format files
  • Loading branch information
AlCap23 authored Nov 30, 2023
1 parent 1c9f422 commit 47e165e
Show file tree
Hide file tree
Showing 11 changed files with 288 additions and 177 deletions.
7 changes: 7 additions & 0 deletions .github/Dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
File renamed without changes.
18 changes: 18 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

name: CompatHelper
on:
schedule:
- cron: '00 00 * * *'
workflow_dispatch:
jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
run: >
julia -e 'using CompatHelper; CompatHelper.main(; subdirs = ["", "docs"])'
42 changes: 42 additions & 0 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: format-check

on:
push:
branches:
- 'master'
- 'release-'
tags: '*'
pull_request:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
julia-arch: [x86]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v4
- name: Install JuliaFormatter and format
# This will use the latest version by default but you can set the version like so:
#
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
julia -e 'using JuliaFormatter; format(".", verbose=true)'
- name: Format check
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
end'
15 changes: 15 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: TagBot
on:
issue_comment:
types:
- created
workflow_dispatch:
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
8 changes: 3 additions & 5 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ push!(LOAD_PATH, joinpath(@__DIR__, ".."))

using DynamicOED

makedocs(
modules = [DynamicOED],
makedocs(modules = [DynamicOED],
sitename = "DynamicOED.jl",
remotes = nothing,
draft = false,
Expand All @@ -16,6 +15,5 @@ makedocs(
"Lotka-Volterra" => "examples/lotka.md",
],
"Theory" => "theory.md",
"API" => "api.md"
]
)
"API" => "api.md",
])
12 changes: 5 additions & 7 deletions src/problem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,12 @@ function get_initial_variables(prob::OEDProblem)
generate_initial_variables(prob.system, prob.timegrid)
end


function Optimization.OptimizationProblem(prob::OEDProblem,
AD::Optimization.ADTypes.AbstractADType,
u0::ComponentVector = get_initial_variables(prob), p = SciMLBase.NullParameters();
integer_constraints::Bool = false,
constraints = nothing, variable_type::Type{T} = Float64,
kwargs...) where {T}

AD::Optimization.ADTypes.AbstractADType,
u0::ComponentVector = get_initial_variables(prob), p = SciMLBase.NullParameters();
integer_constraints::Bool = false,
constraints = nothing, variable_type::Type{T} = Float64,
kwargs...) where {T}
u0 = T.(u0)
p = !isa(p, SciMLBase.NullParameters) ? T.(p) : p

Expand Down
2 changes: 1 addition & 1 deletion src/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function compute_local_information_gain(Qs::AbstractVector)
n_h = size(first(Qs), 1)
map(1:n_h) do i
map(Qs) do Qi
(Qi[i:i,:]'Qi[i:i,:])
(Qi[i:i, :]'Qi[i:i, :])
end
end
end
Expand Down
5 changes: 2 additions & 3 deletions test/references/1D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ oed = structural_simplify(oed)
integer_constraints = false)
res = solve(opt_prob, optimizer)

@test isapprox(res.u[1:end-1],
@test isapprox(res.u[1:(end - 1)],
[0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0],
atol = 1e-5,
rtol = 1e-1)
Expand Down Expand Up @@ -95,8 +95,7 @@ end
integer_constraints = true)
res = solve(opt_prob, optimizer)


@test isapprox(res.u[1:end-1],
@test isapprox(res.u[1:(end - 1)],
[0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0],
atol = 1e-5,
rtol = 1e-1)
Expand Down
Loading

0 comments on commit 47e165e

Please sign in to comment.