Skip to content

Commit 7732410

Browse files
committed
Sped++
1 parent 1414fd7 commit 7732410

File tree

1 file changed

+59
-59
lines changed

1 file changed

+59
-59
lines changed

test/3_test_predictive_control.jl

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,20 +1035,20 @@ end
10351035
([0.21,0.22,0.23,0.24,0.25,0.26], [0.31,0.32,0.33,0.34,0.35,0.36]))
10361036

10371037
# TODO: delete these tests when the deprecated legacy splatting syntax will be.
1038-
gc_leg! = (LHS,_,_,_,_,_) -> (LHS[begin] = -1)
1039-
nc_leg = 1
1040-
nmpc_lin_leg = setconstraint!(
1038+
@test_nowarn gc_leg! = (LHS,_,_,_,_,_) -> (LHS[begin] = -1)
1039+
@test_nowarn nc_leg = 1
1040+
@test_nowarn nmpc_lin_leg = setconstraint!(
10411041
NonLinMPC(linmodel1, Hp=1, Hc=1, gc=gc_leg!, nc=nc_leg, oracle=false),
10421042
ymin=[-1e3, -1e3], ymax=[1e3,1e3]
10431043
)
1044-
nmpc_ms_leg = setconstraint!(
1044+
@test_nowarn nmpc_ms_leg = setconstraint!(
10451045
NonLinMPC(
10461046
nonlinmodel, Hp=1, Hc=1, gc=gc_leg!, nc=nc_leg,
10471047
oracle=false, transcription=MultipleShooting()
10481048
),
10491049
ymin=[-1e3, -1e3], ymax=[1e3,1e3]
10501050
)
1051-
nmpc_leg = NonLinMPC(nonlinmodel, Hp=1, Hc=1, oracle=false)
1051+
@test_nowarn nmpc_leg = NonLinMPC(nonlinmodel, Hp=1, Hc=1, oracle=false)
10521052

10531053
setconstraint!(nmpc_leg, umin=[-5, -9.9], umax=[100,99])
10541054
@test all((nmpc_leg.con.U0min, nmpc_leg.con.U0max) .≈ ([-5, -9.9], [100,99]))
@@ -1245,91 +1245,91 @@ end
12451245

12461246
# TODO: delete these tests when the deprecated legacy splatting syntax will be.
12471247

1248-
nmpc_leg = NonLinMPC(nonlinmodel; Hp, Hc=5, gc, nc=2Hp, p=[0; 0], oracle=false)
1249-
JuMP.set_attribute(nmpc_leg.optim, "constr_viol_tol", 1e-3)
1248+
@test_nowarn nmpc_leg = NonLinMPC(nonlinmodel; Hp, Hc=5, gc, nc=2Hp, p=[0; 0], oracle=false)
1249+
@test_nowarn JuMP.set_attribute(nmpc_leg.optim, "constr_viol_tol", 1e-3)
12501250

1251-
setconstraint!(nmpc_leg, x̂min=[-1e6,-Inf], x̂max=[+1e6,+Inf])
1252-
setconstraint!(nmpc_leg, umin=[-1e6], umax=[+1e6])
1253-
setconstraint!(nmpc_leg, Δumin=[-15], Δumax=[15])
1254-
setconstraint!(nmpc_leg, ymin=[-100], ymax=[100])
1255-
preparestate!(nmpc_leg, [0])
1251+
@test_nowarn setconstraint!(nmpc_leg, x̂min=[-1e6,-Inf], x̂max=[+1e6,+Inf])
1252+
@test_nowarn setconstraint!(nmpc_leg, umin=[-1e6], umax=[+1e6])
1253+
@test_nowarn setconstraint!(nmpc_leg, Δumin=[-15], Δumax=[15])
1254+
@test_nowarn setconstraint!(nmpc_leg, ymin=[-100], ymax=[100])
1255+
@test_nowarn preparestate!(nmpc_leg, [0])
12561256

1257-
setconstraint!(nmpc_leg, umin=[-3], umax=[4])
1258-
moveinput!(nmpc_leg, [-100])
1259-
info = getinfo(nmpc_leg)
1257+
@test_nowarn setconstraint!(nmpc_leg, umin=[-3], umax=[4])
1258+
@test_nowarn moveinput!(nmpc_leg, [-100])
1259+
@test_nowarn info = getinfo(nmpc_leg)
12601260
@test all(isapprox.(info[:U], -3; atol=1e-1))
1261-
moveinput!(nmpc_leg, [100])
1262-
info = getinfo(nmpc_leg)
1261+
@test_nowarn moveinput!(nmpc_leg, [100])
1262+
@test_nowarn info = getinfo(nmpc_leg)
12631263
@test all(isapprox.(info[:U], 4; atol=1e-1))
1264-
setconstraint!(nmpc_leg, umin=[-1e6], umax=[+1e6])
1264+
@test_nowarn setconstraint!(nmpc_leg, umin=[-1e6], umax=[+1e6])
12651265

1266-
setconstraint!(nmpc_leg, Δumin=[-1.5], Δumax=[1.25])
1267-
moveinput!(nmpc_leg, [-100])
1268-
info = getinfo(nmpc_leg)
1266+
@test_nowarn setconstraint!(nmpc_leg, Δumin=[-1.5], Δumax=[1.25])
1267+
@test_nowarn moveinput!(nmpc_leg, [-100])
1268+
@test_nowarn info = getinfo(nmpc_leg)
12691269
@test all(isapprox.(info[:ΔU], -1.5; atol=1e-1))
1270-
moveinput!(nmpc_leg, [100])
1271-
info = getinfo(nmpc_leg)
1270+
@test_nowarn moveinput!(nmpc_leg, [100])
1271+
@test_nowarn info = getinfo(nmpc_leg)
12721272
@test all(isapprox.(info[:ΔU], 1.25; atol=1e-1))
1273-
setconstraint!(nmpc_leg, Δumin=[-1e6], Δumax=[+1e6])
1273+
@test_nowarn setconstraint!(nmpc_leg, Δumin=[-1e6], Δumax=[+1e6])
12741274

1275-
setconstraint!(nmpc_leg, ymin=[-0.5], ymax=[0.9])
1276-
moveinput!(nmpc_leg, [-100])
1277-
info = getinfo(nmpc_leg)
1275+
@test_nowarn setconstraint!(nmpc_leg, ymin=[-0.5], ymax=[0.9])
1276+
@test_nowarn moveinput!(nmpc_leg, [-100])
1277+
@test_nowarn info = getinfo(nmpc_leg)
12781278
@test all(isapprox.(info[:Ŷ], -0.5; atol=1e-1))
1279-
moveinput!(nmpc_leg, [100])
1280-
info = getinfo(nmpc_leg)
1279+
@test_nowarn moveinput!(nmpc_leg, [100])
1280+
@test_nowarn info = getinfo(nmpc_leg)
12811281
@test all(isapprox.(info[:Ŷ], 0.9; atol=1e-1))
1282-
setconstraint!(nmpc_leg, ymin=[-100], ymax=[100])
1282+
@test_nowarn setconstraint!(nmpc_leg, ymin=[-100], ymax=[100])
12831283

1284-
setconstraint!(nmpc_leg, Ymin=[-0.5; fill(-100, Hp-1)], Ymax=[0.9; fill(+100, Hp-1)])
1285-
moveinput!(nmpc_leg, [-200])
1286-
info = getinfo(nmpc_leg)
1284+
@test_nowarn setconstraint!(nmpc_leg, Ymin=[-0.5; fill(-100, Hp-1)], Ymax=[0.9; fill(+100, Hp-1)])
1285+
@test_nowarn moveinput!(nmpc_leg, [-200])
1286+
@test_nowarn info = getinfo(nmpc_leg)
12871287
@test info[:Ŷ][end] -100 atol=1e-1
12881288
@test info[:Ŷ][begin] -0.5 atol=1e-1
1289-
moveinput!(nmpc_leg, [200])
1290-
info = getinfo(nmpc_leg)
1289+
@test_nowarn moveinput!(nmpc_leg, [200])
1290+
@test_nowarn info = getinfo(nmpc_leg)
12911291
@test info[:Ŷ][end] 100 atol=1e-1
12921292
@test info[:Ŷ][begin] 0.9 atol=1e-1
1293-
setconstraint!(nmpc_leg, ymin=[-100], ymax=[100])
1293+
@test_nowarn setconstraint!(nmpc_leg, ymin=[-100], ymax=[100])
12941294

1295-
setconstraint!(nmpc_leg, x̂min=[-1e-6,-Inf], x̂max=[+1e-6,+Inf])
1296-
moveinput!(nmpc_leg, [-10])
1297-
info = getinfo(nmpc_leg)
1295+
@test_nowarn setconstraint!(nmpc_leg, x̂min=[-1e-6,-Inf], x̂max=[+1e-6,+Inf])
1296+
@test_nowarn moveinput!(nmpc_leg, [-10])
1297+
@test_nowarn info = getinfo(nmpc_leg)
12981298
@test info[:x̂end][1] 0 atol=1e-1
1299-
moveinput!(nmpc_leg, [10])
1300-
info = getinfo(nmpc_leg)
1299+
@test_nowarn moveinput!(nmpc_leg, [10])
1300+
@test_nowarn info = getinfo(nmpc_leg)
13011301
@test info[:x̂end][1] 0 atol=1e-1
1302-
setconstraint!(nmpc_leg, x̂min=[-1e6,-Inf], x̂max=[1e6,+Inf])
1302+
@test_nowarn setconstraint!(nmpc_leg, x̂min=[-1e6,-Inf], x̂max=[1e6,+Inf])
13031303

1304-
nmpc_leg.p .= [1; 0]
1305-
moveinput!(nmpc_leg, [100])
1306-
info = getinfo(nmpc_leg)
1304+
@test_nowarn nmpc_leg.p .= [1; 0]
1305+
@test_nowarn moveinput!(nmpc_leg, [100])
1306+
@test_nowarn info = getinfo(nmpc_leg)
13071307
@test all(isapprox.(info[:U], 4.2; atol=1e-1))
13081308
@test all(isapprox.(info[:gc][1:Hp], 0.0; atol=1e-1))
13091309

1310-
nmpc_leg.p .= [0; 1]
1311-
moveinput!(nmpc_leg, [100])
1312-
info = getinfo(nmpc_leg)
1310+
@test_nowarn nmpc_leg.p .= [0; 1]
1311+
@test_nowarn moveinput!(nmpc_leg, [100])
1312+
@test_nowarn info = getinfo(nmpc_leg)
13131313
@test all(isapprox.(info[:Ŷ], 3.14; atol=1e-1))
13141314
@test all(isapprox.(info[:gc][Hp+1:end], 0.0; atol=1e-1))
13151315

1316-
nmpc_ms = NonLinMPC(
1316+
@test_nowarn nmpc_ms = NonLinMPC(
13171317
nonlinmodel; Hp, Hc=5, transcription=MultipleShooting(), gc, nc=2Hp, p=[0; 0]
13181318
)
1319-
JuMP.set_attribute(nmpc_ms.optim, "constr_viol_tol", 1e-3)
1319+
@test_nowarn JuMP.set_attribute(nmpc_ms.optim, "constr_viol_tol", 1e-3)
13201320

1321-
setconstraint!(nmpc_ms, x̂min=[-1e6,-Inf], x̂max=[+1e6,+Inf])
1322-
setconstraint!(nmpc_ms, ymin=[-100], ymax=[100])
1323-
preparestate!(nmpc_ms, [0])
1321+
@test_nowarn setconstraint!(nmpc_ms, x̂min=[-1e6,-Inf], x̂max=[+1e6,+Inf])
1322+
@test_nowarn setconstraint!(nmpc_ms, ymin=[-100], ymax=[100])
1323+
@test_nowarn preparestate!(nmpc_ms, [0])
13241324

1325-
setconstraint!(nmpc_ms, ymin=[-0.5], ymax=[0.9])
1326-
moveinput!(nmpc_ms, [-100])
1327-
info = getinfo(nmpc_ms)
1325+
@test_nowarn setconstraint!(nmpc_ms, ymin=[-0.5], ymax=[0.9])
1326+
@test_nowarn moveinput!(nmpc_ms, [-100])
1327+
@test_nowarn info = getinfo(nmpc_ms)
13281328
@test all(isapprox.(info[:Ŷ], -0.5; atol=1e-1))
1329-
moveinput!(nmpc_ms, [100])
1330-
info = getinfo(nmpc_ms)
1329+
@test_nowarn moveinput!(nmpc_ms, [100])
1330+
@test_nowarn info = getinfo(nmpc_ms)
13311331
@test all(isapprox.(info[:Ŷ], 0.9; atol=1e-1))
1332-
setconstraint!(nmpc_ms, ymin=[-100], ymax=[100])
1332+
@test_nowarn setconstraint!(nmpc_ms, ymin=[-100], ymax=[100])
13331333

13341334
setconstraint!(nmpc_ms, x̂min=[-1e-6,-Inf], x̂max=[+1e-6,+Inf])
13351335
moveinput!(nmpc_ms, [-10])

0 commit comments

Comments
 (0)