Skip to content

Commit

Permalink
move constant to definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed Feb 9, 2024
1 parent 0d6f377 commit a4f28d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/core/definitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const NO_SERVICE_NAME_PROVIDED = ""
const CONTAINER_KEY_EMPTY_META = ""
const UPPER_BOUND = "ub"
const LOWER_BOUND = "lb"
const MAX_OPTIMIZE_TRIES = 2


# File Names definitions
const PROBLEM_SERIALIZATION_FILENAME = "operation_problem.bin"
Expand Down
5 changes: 2 additions & 3 deletions src/core/optimization_container.jl
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,6 @@ function solve_impl!(container::OptimizationContainer, system::PSY.System)
model_status = MOI.NO_SOLUTION::MOI.ResultStatusCode
conflict_status = MOI.COMPUTE_CONFLICT_NOT_CALLED

MAX_TRIES = 2
try_count = 0
while model_status != MOI.FEASIBLE_POINT::MOI.ResultStatusCode
_,
Expand All @@ -696,8 +695,8 @@ function solve_impl!(container::OptimizationContainer, system::PSY.System)
end

try_count += 1
if try_count > MAX_TRIES
@error "Optimizer returned $model_status after $MAX_TRIES optimize! attempts"
if try_count > MAX_OPTIMIZE_TRIES
@error "Optimizer returned $model_status after $MAX_OPTIMIZE_TRIES optimize! attempts"
return RunStatus.FAILED

Check warning on line 700 in src/core/optimization_container.jl

View check run for this annotation

Codecov / codecov/patch

src/core/optimization_container.jl#L697-L700

Added lines #L697 - L700 were not covered by tests
end
end
Expand Down

0 comments on commit a4f28d3

Please sign in to comment.