Skip to content

Commit 57cba3f

Browse files
authored
Bug fixes (#10)
Shifted incrementation of _iteration_count to match current version of EAGO, added Reexport to deps, re-ran README examples.
1 parent b9536ed commit 57cba3f

File tree

4 files changed

+28
-27
lines changed

4 files changed

+28
-27
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
name = "SourceCodeMcCormick"
22
uuid = "a7283dc5-4ecf-47fb-a95b-1412723fc960"
33
authors = ["Robert Gottlieb <[email protected]>"]
4-
version = "0.4.0"
4+
version = "0.4.1"
55

66
[deps]
77
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
88
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
99
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1010
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
1111
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
12+
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1213
SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b"
1314
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
1415

@@ -17,6 +18,7 @@ CUDA = "5"
1718
DocStringExtensions = "0.8 - 0.9"
1819
Graphs = "1"
1920
IfElse = "0.1.0 - 0.1.1"
21+
Reexport = "~1"
2022
SymbolicUtils = "3"
2123
Symbolics = "6"
2224
julia = "1.10"

README.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -524,15 +524,15 @@ Running this code (after an initial compilation run) generates the following out
524524
---------------------------------------------------------------------------------------------------------------------------------
525525
| Iteration # | Nodes | Lower Bound | Upper Bound | Gap | Ratio | Timer | Time Left |
526526
---------------------------------------------------------------------------------------------------------------------------------
527-
| 10 | 47818 | -8.337E-01 | -7.048E-01 | 1.289E-01 | 1.546E-01 | 0.74 | 3599.26 |
528-
| 20 | 117316 | -7.703E-01 | -7.048E-01 | 6.549E-02 | 8.503E-02 | 1.47 | 3598.53 |
529-
| 30 | 162052 | -7.608E-01 | -7.048E-01 | 5.604E-02 | 7.365E-02 | 1.90 | 3598.10 |
530-
| 40 | 177018 | -7.473E-01 | -7.048E-01 | 4.254E-02 | 5.693E-02 | 2.38 | 3597.62 |
531-
| 50 | 161712 | -7.411E-01 | -7.048E-01 | 3.632E-02 | 4.901E-02 | 3.24 | 3596.76 |
532-
| 60 | 128062 | -7.293E-01 | -7.048E-01 | 2.453E-02 | 3.363E-02 | 4.10 | 3595.90 |
533-
| 70 | 73936 | -7.211E-01 | -7.048E-01 | 1.631E-02 | 2.262E-02 | 5.03 | 3594.97 |
534-
| 80 | 11916 | -7.180E-01 | -7.048E-01 | 1.321E-02 | 1.841E-02 | 5.59 | 3594.41 |
535-
| 83 | 4560 | -7.051E-01 | -7.048E-01 | 3.648E-04 | 5.173E-04 | 5.64 | 3594.36 |
527+
| 10 | 47818 | -8.337E-01 | -7.048E-01 | 1.289E-01 | 1.546E-01 | 0.47 | 3599.53 |
528+
| 20 | 117316 | -7.703E-01 | -7.048E-01 | 6.549E-02 | 8.503E-02 | 0.83 | 3599.17 |
529+
| 30 | 162052 | -7.608E-01 | -7.048E-01 | 5.604E-02 | 7.365E-02 | 1.26 | 3598.74 |
530+
| 40 | 177018 | -7.473E-01 | -7.048E-01 | 4.254E-02 | 5.693E-02 | 1.74 | 3598.26 |
531+
| 50 | 161712 | -7.411E-01 | -7.048E-01 | 3.632E-02 | 4.901E-02 | 2.62 | 3597.38 |
532+
| 60 | 128062 | -7.293E-01 | -7.048E-01 | 2.453E-02 | 3.363E-02 | 3.17 | 3596.83 |
533+
| 70 | 73936 | -7.211E-01 | -7.048E-01 | 1.631E-02 | 2.262E-02 | 3.76 | 3596.24 |
534+
| 80 | 11916 | -7.180E-01 | -7.048E-01 | 1.321E-02 | 1.841E-02 | 4.36 | 3595.64 |
535+
| 82 | 4560 | -7.051E-01 | -7.048E-01 | 3.648E-04 | 5.173E-04 | 4.42 | 3595.58 |
536536
---------------------------------------------------------------------------------------------------------------------------------
537537
538538
Relative Tolerance Achieved
@@ -550,13 +550,13 @@ Solution:
550550
p[8] = 0.9999999998842802
551551
```
552552

553-
Using the subgradient-free method, and processing 8192 nodes per iteration, this problem converged in 83
554-
iterations (roughly 679,936 nodes explored), with a total time of 5.64 seconds. These times were obtained
553+
Using the subgradient-free method, and processing 8192 nodes per iteration, this problem converged in 82
554+
iterations (roughly 671,744 nodes explored), with a total time of 4.42 seconds. These times were obtained
555555
on a workstation with an Intel i7-9850H processor and an NVIDIA Quadro T2000 GPU. Using a GPU with a
556556
greater capacity for double-precision floating point calculations will, of course, improve the overall
557557
performance of the algorithm, but even with a fairly "typical" GPU such as this, relatively competitive
558558
speed can be obtained. As compared to the base version of EAGO (which makes use of subgradients), this
559-
example ran roughly 9x faster.
559+
example ran roughly 11x faster.
560560

561561
It is also important to note that, because a subgradient-free method was used, the lower bounds for any
562562
individual branch-and-bound node are not as tight as those that can be obtained using subgradient-based
@@ -662,16 +662,15 @@ Running this code (after an initial compilation run) generates the following out
662662
---------------------------------------------------------------------------------------------------------------------------------
663663
| Iteration # | Nodes | Lower Bound | Upper Bound | Gap | Ratio | Timer | Time Left |
664664
---------------------------------------------------------------------------------------------------------------------------------
665-
| 10 | 16280 | -7.754E-01 | -7.048E-01 | 7.067E-02 | 9.113E-02 | 0.59 | 3599.41 |
666-
| 20 | 59342 | -7.353E-01 | -7.048E-01 | 3.055E-02 | 4.154E-02 | 1.16 | 3598.84 |
667-
| 30 | 46048 | -7.108E-01 | -7.048E-01 | 5.983E-03 | 8.418E-03 | 1.82 | 3598.18 |
668-
| 40 | 2240 | -7.058E-01 | -7.048E-01 | 9.852E-04 | 1.396E-03 | 2.30 | 3597.70 |
669-
| 41 | 2240 | -7.058E-01 | -7.048E-01 | 9.852E-04 | 1.396E-03 | 2.30 | 3597.70 |
665+
| 10 | 16280 | -7.754E-01 | -7.048E-01 | 7.067E-02 | 9.113E-02 | 0.45 | 3599.55 |
666+
| 20 | 59342 | -7.353E-01 | -7.048E-01 | 3.055E-02 | 4.154E-02 | 1.09 | 3598.91 |
667+
| 30 | 46048 | -7.108E-01 | -7.048E-01 | 5.983E-03 | 8.418E-03 | 1.85 | 3598.15 |
668+
| 40 | 2240 | -7.058E-01 | -7.048E-01 | 9.852E-04 | 1.396E-03 | 2.33 | 3597.67 |
670669
---------------------------------------------------------------------------------------------------------------------------------
671670
672671
Absolute Tolerance Achieved
673672
Optimal Solution Found at Node 1
674-
Lower Bound: -0.7057619894307734
673+
Lower Bound: -0.7057619894307733
675674
Upper Bound: -0.7047768067379733
676675
Solution:
677676
p[1] = -0.9999999998903418
@@ -688,7 +687,7 @@ As in the previous examples, these results were generated using an Intel i7-9850
688687
Quadro T2000 GPU. Effectively, ParBB is running precisely the same lower-bounding routine as the base
689688
version of the global solver EAGO, except that the routine is being performed in parallel on a GPU
690689
rather than serially on the CPU. This example converges in 40 iterations of at most 8192 nodes per iteration,
691-
for a total of roughly 327,680 nodes explored, and reaches its solution in 2.30 seconds. As compared to the
690+
for a total of roughly 327,680 nodes explored, and reaches its solution in 2.33 seconds. As compared to the
692691
base version of EAGO, this implementation of ParBB solves the problem roughly 22x faster. As in the previous
693692
subsection, it should be noted that a GPU with better double-precision floating-point calculation throughput
694693
would yield even faster results.

examples/ParBB/subroutines.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ function solve_gpu!(m::EAGO.GlobalOptimizer)
3131
# Identify the extension
3232
ext = EAGO._ext(m)
3333

34-
# Set counts to 1
35-
m._iteration_count = 1
34+
# Set node count to 1
3635
m._node_count = 1
3736

3837
# Prepare to run branch-and-bound
@@ -54,6 +53,9 @@ function solve_gpu!(m::EAGO.GlobalOptimizer)
5453
# Run branch and bound; terminate when the stack is empty or when some
5554
# tolerance or limit is hit
5655
while !EAGO.termination_check(m)
56+
57+
# Update iteration counter
58+
m._iteration_count += 1
5759

5860
# Garbage collect every gc_freq iterations
5961
if mod(m._iteration_count, EAGO._ext(m).gc_freq)==0
@@ -105,7 +107,6 @@ function solve_gpu!(m::EAGO.GlobalOptimizer)
105107
m._time_left = m._parameters.time_limit - m._run_time
106108
EAGO.log_iteration!(m)
107109
EAGO.print_iteration!(m, false)
108-
m._iteration_count += 1
109110
end
110111
EAGO.print_iteration!(m, true)
111112

src/SourceCodeMcCormick.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
module SourceCodeMcCormick
33

4-
using Symbolics
4+
using Reexport
5+
@reexport using Symbolics
56
using SymbolicUtils.Code
67
using IfElse
78
using DocStringExtensions
@@ -51,8 +52,6 @@ export McCormickIntervalTransform, IntervalTransform
5152
export apply_transform, all_evaluators, convex_evaluator, extract_terms,
5253
genvar, genparam, get_name, factor, binarize!, pull_vars, shrink_eqs,
5354
grad, shrink_grad!, convex_subgradient, all_subgradients, grad_transform!,
54-
levels, eqn_edges, eval_generator, grad_eval_generator, fgen_cv, fgen_cvgrad,
55-
fgen, fgen2
56-
export @variables, Num
55+
levels, eqn_edges, eval_generator, grad_eval_generator, fgen
5756

5857
end

0 commit comments

Comments
 (0)