Skip to content

Commit e4a369a

Browse files
committed
Format
1 parent e89fa06 commit e4a369a

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

src/batch.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fully independent.
3434
- `nnzj_per_scenario::Int` : Jacobian nonzeros per scenario
3535
- `nnzh_per_scenario::Int` : Hessian nonzeros per scenario
3636
"""
37-
struct BatchExaModel{T, VT <: AbstractVector{T}, M <: ExaModel{T, VT}} <: NLPModels.AbstractNLPModel{T,VT}
37+
struct BatchExaModel{T, VT <: AbstractVector{T}, M <: ExaModel{T, VT}} <: NLPModels.AbstractNLPModel{T, VT}
3838
model::M
3939
ns::Int
4040
nv::Int

src/two_stage.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Evaluates all scenarios in ONE kernel launch.
4646
- Global variable layout: [v₁; v₂; ...; vₛ; d]
4747
- Global constraint layout: [c₁; c₂; ...; cₛ]
4848
"""
49-
struct TwoStageExaModel{T, VT <: AbstractVector{T}, M <: ExaModel{T, VT}} <: NLPModels.AbstractNLPModel{T,VT}
49+
struct TwoStageExaModel{T, VT <: AbstractVector{T}, M <: ExaModel{T, VT}} <: NLPModels.AbstractNLPModel{T, VT}
5050
model::M
5151
ns::Int
5252
nv::Int

test/BatchTest/BatchTest.jl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ using ExaModels
55
import NLPModels
66
import NLPModels: obj, cons!, cons_nln!, grad!, jac_coord!, hess_coord!, jac_structure!, hess_structure!
77
import ExaModels: num_scenarios, num_vars_per_scenario, num_constraints_per_scenario, total_vars,
8-
total_cons, set_scenario_parameters!, set_all_scenario_parameters!, var_indices,
9-
cons_block_indices, grad_indices,
10-
extract_vars!, extract_cons_block!,
11-
global_var_index, global_con_index, get_model
8+
total_cons, set_scenario_parameters!, set_all_scenario_parameters!, var_indices,
9+
cons_block_indices, grad_indices,
10+
extract_vars!, extract_cons_block!,
11+
global_var_index, global_con_index, get_model
1212

1313
import NLPModelsIpopt: ipopt
1414

1515
function runtests()
16-
@testset "BatchExaModel" begin
16+
return @testset "BatchExaModel" begin
1717

1818
@testset "Construction and dimensions" begin
1919
ns, nv = 3, 2
@@ -379,11 +379,11 @@ function runtests()
379379
# Each scenario's variable should equal its parameter
380380
for (i, θ) in enumerate(θ_vals)
381381
v_sol = x_sol[var_indices(model, i)]
382-
@test v_sol[1] θ atol = 1e-5
382+
@test v_sol[1] θ atol = 1.0e-5
383383
end
384384

385385
# Optimal objective should be 0
386-
@test result.objective 0.0 atol = 1e-8
386+
@test result.objective 0.0 atol = 1.0e-8
387387
end
388388

389389
@testset "Ipopt solver - multiple variables per scenario" begin
@@ -416,12 +416,12 @@ function runtests()
416416
x_sol = result.solution
417417

418418
# Scenario 1: v = [1, 3]
419-
@test x_sol[var_indices(model, 1)] [1.0, 3.0] atol = 1e-5
419+
@test x_sol[var_indices(model, 1)] [1.0, 3.0] atol = 1.0e-5
420420

421421
# Scenario 2: v = [2, 2]
422-
@test x_sol[var_indices(model, 2)] [2.0, 2.0] atol = 1e-5
422+
@test x_sol[var_indices(model, 2)] [2.0, 2.0] atol = 1.0e-5
423423

424-
@test result.objective 0.0 atol = 1e-8
424+
@test result.objective 0.0 atol = 1.0e-8
425425
end
426426

427427
@testset "Variable bounds with start values" begin
@@ -431,7 +431,8 @@ function runtests()
431431

432432
v_start_vals = [0.1, 0.2, 0.3, 0.4] # ns * nv = 4 values
433433

434-
model = BatchExaModel(nv, ns, θ_sets;
434+
model = BatchExaModel(
435+
nv, ns, θ_sets;
435436
v_start = v_start_vals,
436437
v_lvar = 0.0,
437438
v_uvar = 10.0

0 commit comments

Comments
 (0)