Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "CTParser"
uuid = "32681960-a1b1-40db-9bff-a1ca817385d1"
version = "0.8.15"
version = "0.8.16-beta"
authors = ["Jean-Baptiste Caillau <jean-baptiste.caillau@univ-cotedazur.fr>"]

[deps]
Expand All @@ -12,10 +12,10 @@ Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[compat]
CTBase = "0.18"
CTBase = "0.25"
DocStringExtensions = "0.9"
MLStyle = "0.4"
OrderedCollections = "1"
Parameters = "0.12"
OrderedCollections = "1, 2"
Parameters = "0.12, 0.13"
Unicode = "1"
julia = "1.10"
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
MarkdownAST = "d0879d2d-cac2-40c8-9cee-1863dc0c7391"

[compat]
CTBase = "0.18"
CTBase = "0.25"
Documenter = "1"
Markdown = "1"
MarkdownAST = "0.1"
Expand Down
14 changes: 7 additions & 7 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[compat]
Aqua = "0.8"
BenchmarkTools = "1"
CTBase = "0.18"
CTModels = "0.10"
CUDA = "5"
ExaModels = "0.9"
CTBase = "0.25"
CTModels = "0.13"
CUDA = "5, 6"
ExaModels = "0.9, 0.11"
Interpolations = "0.16"
KernelAbstractions = "0.9"
LinearAlgebra = "1"
MadNLP = "0.9"
MadNLPGPU = "0.8"
MadNLP = "0.9, 0.10"
MadNLPGPU = "0.8, 0.10"
NLPModels = "0.21"
OrderedCollections = "1.8"
OrderedCollections = "1, 2"
Test = "1.10"
julia = "1.10"
41 changes: 20 additions & 21 deletions test/test_control_zero.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module TestControlZero
using Test: Test
using CTParser: CTParser
import CTBase.Exceptions
import CTModels.OCP
import CTModels.Init

# for the @def and @init macros
Expand Down Expand Up @@ -46,18 +45,18 @@ function test_control_zero()

Test.@testset "build() - Model without control" begin
o = get_model()
Test.@test o isa OCP.Model
Test.@test OCP.control_dimension(o) == 0
Test.@test OCP.control_name(o) == ""
Test.@test OCP.control_components(o) == String[]
Test.@test o isa CTModels.Model
Test.@test CTModels.control_dimension(o) == 0
Test.@test CTModels.control_name(o) == ""
Test.@test CTModels.control_components(o) == String[]
end

Test.@testset "build() - Model without control but with variable" begin
# build a model with a variable
ov = get_model(variable=true)
Test.@test OCP.control_dimension(ov) == 0
Test.@test OCP.variable_dimension(ov) == 1
Test.@test OCP.state_dimension(ov) == 2
Test.@test CTModels.control_dimension(ov) == 0
Test.@test CTModels.variable_dimension(ov) == 1
Test.@test CTModels.state_dimension(ov) == 2
end

# ====================================================================
Expand Down Expand Up @@ -99,8 +98,8 @@ function test_control_zero()
∂(x₂)(t) == -x₁(t)
x₁(1)^2 → min
end
Test.@test OCP.control_dimension(o) == 0
Test.@test OCP.state_dimension(o) == 2
Test.@test CTModels.control_dimension(o) == 0
Test.@test CTModels.state_dimension(o) == 2
end

# ====================================================================
Expand All @@ -115,7 +114,7 @@ function test_control_zero()
ẋ(t) == [x₂(t), -x₁(t)]
∫(x₁(t)^2 + x₂(t)^2) → min
end
Test.@test OCP.control_dimension(o1) == 0
Test.@test CTModels.control_dimension(o1) == 0

# Bolza cost
o2 = CTParser.@def begin
Expand All @@ -124,7 +123,7 @@ function test_control_zero()
ẋ(t) == [x₂(t), -x₁(t)]
x₁(0)^2 + ∫(x₂(t)^2) → min
end
Test.@test OCP.control_dimension(o2) == 0
Test.@test CTModels.control_dimension(o2) == 0
end

# ====================================================================
Expand All @@ -141,8 +140,8 @@ function test_control_zero()
x₁(1) + x₂(1) ≤ 1
x₁(1)^2 → min
end
Test.@test OCP.control_dimension(o) == 0
Test.@test OCP.state_dimension(o) == 2
Test.@test CTModels.control_dimension(o) == 0
Test.@test CTModels.state_dimension(o) == 2
end

# ====================================================================
Expand Down Expand Up @@ -170,7 +169,7 @@ function test_control_zero()
Test.@testset "Init - initial_guess without control" begin
o = get_model()
ig = CTParser.@init o begin end
u_init = OCP.control(ig)
u_init = CTModels.control(ig)
Test.@test ig isa Init.InitialGuess
Test.@test u_init isa Function
Test.@test u_init(0.5) == Float64[]
Expand All @@ -191,7 +190,7 @@ function test_control_zero()
v := 1.0
end
Test.@test ig2 isa Init.InitialGuess
Test.@test OCP.variable(ig2) == 1.0
Test.@test CTModels.variable(ig2) == 1.0
end

# ====================================================================
Expand Down Expand Up @@ -246,7 +245,7 @@ function test_control_zero()
p_data = hcat(cos.(T), -sin.(T)) # (10, 2) matrix
v_data = Float64[]

sol = OCP.build_solution(
sol = CTModels.build_solution(
o,
T,
T,
Expand All @@ -265,15 +264,15 @@ function test_control_zero()
)

# Test that control_dimension is 0
Test.@test OCP.control_dimension(sol) == 0
Test.@test CTModels.control_dimension(sol) == 0

# Test that control function returns empty vector
u_func = OCP.control(sol)
u_func = CTModels.control(sol)
Test.@test u_func(0.5) == Float64[]

# Test that solution properties are correct
Test.@test OCP.state_dimension(sol) == 2
Test.@test OCP.objective(sol) == 1.0
Test.@test CTModels.state_dimension(sol) == 2
Test.@test CTModels.objective(sol) == 1.0
end
end
end
Expand Down
Loading