
destroy .bbopt
toplevel .bbopt
wm title .bbopt "GOBLIN Optimization Level"
wm resizable .bbopt 0 0
     
    frame .bbopt.solve
    frame .bbopt.bb
    checkbutton .bbopt.local \
        -text "Apply Local Search" -variable goblinMethLocal -anchor w
    frame .bbopt.candidates
    pack .bbopt.solve .bbopt.bb .bbopt.candidates .bbopt.local \
        -side top -fill x -padx 10m -pady 5m

    label .bbopt.solve.label -text "Optimization Level:" -anchor w
    radiobutton .bbopt.solve.heuristic -text "Only Heuristic Solutions" \
        -variable goblinMethSolve -value 0 -anchor w
    radiobutton .bbopt.solve.lowerBound -text "Compute Lower Bounds" \
        -variable goblinMethSolve -value 1 -anchor w
    radiobutton .bbopt.solve.exact -text "Branch and Bound" \
        -variable goblinMethSolve -value 2 -anchor w
    pack .bbopt.solve.label \
        .bbopt.solve.heuristic \
        .bbopt.solve.lowerBound \
        .bbopt.solve.exact \
        -fill x

    label .bbopt.bb.label1 -text "B&B Iterations (1000s):" \
        -anchor w
    grid .bbopt.bb.label1 -in .bbopt.bb  \
        -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news -padx 1m
    entry .bbopt.bb.iterations -textvariable goblinMaxBBIterations \
        -bg white -width 5
    grid .bbopt.bb.iterations -in .bbopt.bb \
        -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news -padx 1m
    label .bbopt.bb.label2 -text "Active B&B Nodes:" \
        -anchor w
    grid .bbopt.bb.label2 -in .bbopt.bb  \
        -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news -padx 1m
    entry .bbopt.bb.nodes -textvariable goblinMaxBBNodes \
        -bg white -width 5
    grid .bbopt.bb.nodes -in .bbopt.bb \
        -row 1 -column 1 -rowspan 1 -columnspan 1 -sticky news -padx 1m
    
    radiobutton .bbopt.candidates.disable \
        -text "Do Not Use Candidate Subgraphs" -variable goblinMethCandidates \
        -value -1 -anchor w
    frame .bbopt.candidates.frame
    pack .bbopt.candidates.disable \
        -fill x
    pack .bbopt.candidates.frame -side left -pady 1m
    label .bbopt.candidates.frame.label \
        -text "Minimum Degree in Subgraph:" \
        -anchor w
    grid .bbopt.candidates.frame.label \
        -in .bbopt.candidates.frame \
        -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news -padx 1m
    entry .bbopt.candidates.frame.entry \
        -textvariable goblinMethCandidates -bg white -width 2
    grid .bbopt.candidates.frame.entry \
        -in .bbopt.candidates.frame \
        -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news -padx 1m


frame .bbopt.buttons
    button .bbopt.buttons.done -text "Done" -command { \
        if {[QualifiedInt $goblinMethCandidates -1 50000] && \
            [QualifiedInt $goblinMaxBBIterations 1 50000] && \
            [QualifiedInt $goblinMaxBBNodes 1 50000]} {destroy .bbopt}
    }
    
    pack .bbopt.buttons.done -side left -fill x -padx 3m
     
    
pack .bbopt.buttons -padx 3m -pady 3m -side bottom
