
destroy .methopt
toplevel .methopt
wm geometry .methopt 280x540
wm resizable .methopt 0 0

proc DisplayBasicOptions {} {
    wm title .methopt "GOBLIN Method Options"

    destroy .methopt.buttons
    frame .methopt.buttons
    button .methopt.buttons.done -text "Done" -command { \
        destroy .methopt
    }
    
    button .methopt.buttons.prev -text "<" -relief groove -command {}
    
    button .methopt.buttons.next -text ">" -command { \
        DisplayNetworkFlowOptions
    }
    
    pack .methopt.buttons.prev .methopt.buttons.next .methopt.buttons.done \
        -side left -fill x -padx 3m
     
    pack .methopt.buttons -padx 3m -pady 3m -side bottom

    destroy .methopt.options
    frame .methopt.options
    pack .methopt.options -fill both -padx 10m -pady 4m

    frame .methopt.options.search
    frame .methopt.options.tree
    frame .methopt.options.1tree
    frame .methopt.options.maxFlow
    pack .methopt.options.search .methopt.options.tree .methopt.options.1tree \
        .methopt.options.maxFlow -side top -fill x -pady 5m
        
    label .methopt.options.search.label -text "Shortest Paths:" -anchor w
    radiobutton .methopt.options.search.fifo -text "FIFO Label Correcting" \
        -variable goblinMethSearch -value 0 -anchor w
    radiobutton .methopt.options.search.dijkstra -text "Dijkstra" \
        -variable goblinMethSearch -value 1 -anchor w
    radiobutton .methopt.options.search.bellman -text "Bellman/Ford" \
        -variable goblinMethSearch -value 2 -anchor w
    radiobutton .methopt.options.search.bfs -text "BFS" \
        -variable goblinMethSearch -value 3 -anchor w
    pack .methopt.options.search.label \
        .methopt.options.search.fifo \
        .methopt.options.search.dijkstra \
        .methopt.options.search.bellman \
        .methopt.options.search.bfs \
        -fill x
        
    label .methopt.options.tree.label -text "Minimum Spanning Trees:" -anchor w
    radiobutton .methopt.options.tree.prim -text "Prim" \
        -variable goblinMethMinTree -value 0 -anchor w
    radiobutton .methopt.options.tree.enhanced -text "Enhanced Prim" \
        -variable goblinMethMinTree -value 1 -anchor w
    radiobutton .methopt.options.tree.kruskal -text "Kruskal" \
        -variable goblinMethMinTree -value 2 -anchor w
    pack .methopt.options.tree.label \
        .methopt.options.tree.prim \
        .methopt.options.tree.enhanced \
        .methopt.options.tree.kruskal \
        -fill x

    checkbutton .methopt.options.1tree.check \
        -text "Compute 1-Trees" -variable goblinMeth1Tree -anchor w
    pack .methopt.options.1tree.check -fill x

    label .methopt.options.maxFlow.label -text "Maximum st-Flows:" -anchor w
    radiobutton .methopt.options.maxFlow.successive -text "Successive Augmentation" \
        -variable goblinMethMaxFlow -value 0 -anchor w
    radiobutton .methopt.options.maxFlow.dinic -text "Dinic" \
        -variable goblinMethMaxFlow -value 1 -anchor w
    radiobutton .methopt.options.maxFlow.fifo -text "Push/Relabel (FIFO)" \
        -variable goblinMethMaxFlow -value 2 -anchor w
    radiobutton .methopt.options.maxFlow.highest -text "Push/Relabel (Highest Label)" \
        -variable goblinMethMaxFlow -value 3 -anchor w
    radiobutton .methopt.options.maxFlow.scaling -text "Capacity Scaling" \
        -variable goblinMethMaxFlow -value 4 -anchor w
    pack .methopt.options.maxFlow.label \
        .methopt.options.maxFlow.successive \
        .methopt.options.maxFlow.dinic \
        .methopt.options.maxFlow.fifo \
        .methopt.options.maxFlow.highest \
        .methopt.options.maxFlow.scaling \
        -fill x
}        


proc DisplayNetworkFlowOptions {} {
    wm title .methopt "GOBLIN Min-Cost Flow Options"

    destroy .methopt.buttons
    frame .methopt.buttons
    button .methopt.buttons.done -text "Done" -command { \
        destroy .methopt
    }
    
    button .methopt.buttons.prev -text "<" -command { \
        DisplayBasicOptions
    }
    
    button .methopt.buttons.next -text ">" -command { \
        DisplayMatchingOptions
    }
    
    pack .methopt.buttons.prev .methopt.buttons.next .methopt.buttons.done \
        -side left -fill x -padx 3m
     
    pack .methopt.buttons -padx 3m -pady 3m -side bottom

    destroy .methopt.options
    frame .methopt.options
    pack .methopt.options -fill both -padx 10m -pady 4m

    frame .methopt.options.minCFlow
    frame .methopt.options.minCCirc
    frame .methopt.options.checkButtons
    pack .methopt.options.minCFlow \
        .methopt.options.minCCirc .methopt.options.checkButtons -side top -fill x -pady 5m
        
    label .methopt.options.minCFlow.label -text "Min Cost st-Flows:" -anchor w
    radiobutton .methopt.options.minCFlow.revised -text "Revised SAP" \
        -variable goblinMethMinCFlow -value 0 -anchor w
    radiobutton .methopt.options.minCFlow.sap -text "Successive Augmentation" \
        -variable goblinMethMinCFlow -value 1 -anchor w
    radiobutton .methopt.options.minCFlow.transform -text "Transform to b-flow" \
        -variable goblinMethMinCFlow -value 3 -anchor w
    pack .methopt.options.minCFlow.label \
        .methopt.options.minCFlow.sap \
        .methopt.options.minCFlow.revised \
        .methopt.options.minCFlow.transform \
        -fill x
        
    label .methopt.options.minCCirc.label -text "Min Cost b-Flows:" -anchor w
    radiobutton .methopt.options.minCCirc.klein -text "Klein" \
        -variable goblinMethMinCCirc -value 0 -anchor w
    radiobutton .methopt.options.minCCirc.scaling -text "Cost Scaling" \
        -variable goblinMethMinCCirc -value 1 -anchor w
    radiobutton .methopt.options.minCCirc.tighten -text "Enhanced Cost Scaling" \
        -variable goblinMethMinCCirc -value 2 -anchor w
    radiobutton .methopt.options.minCCirc.mean -text "Minimum Mean Cycles" \
        -variable goblinMethMinCCirc -value 3 -anchor w
    radiobutton .methopt.options.minCCirc.transform -text "Transform to st-Flow" \
        -variable goblinMethMinCCirc -value 4 -anchor w
    pack .methopt.options.minCCirc.label \
        .methopt.options.minCCirc.klein \
        .methopt.options.minCCirc.scaling \
        .methopt.options.minCCirc.tighten \
        .methopt.options.minCCirc.mean \
        .methopt.options.minCCirc.transform \
        -fill x

    checkbutton .methopt.options.checkButtons.failSave \
        -text "Check reduced cost optimality" -variable goblinMethFailSave -anchor w
    pack .methopt.options.checkButtons.failSave -fill x
}
        
     
proc DisplayMatchingOptions {} {
    wm title .methopt "GOBLIN Matching Options"

    destroy .methopt.buttons
    frame .methopt.buttons
    button .methopt.buttons.done -text "Done" -command { \
        destroy .methopt
    }
    
    button .methopt.buttons.prev -text "<" -command { \
        DisplayNetworkFlowOptions
    }
    
    button .methopt.buttons.next -text ">" -command { \
        DisplayTSPOptions
    }
    
    pack .methopt.buttons.prev .methopt.buttons.next .methopt.buttons.done \
        -side left -fill x -padx 3m
     
    pack .methopt.buttons -padx 3m -pady 3m -side bottom

    destroy .methopt.options
    frame .methopt.options
    pack .methopt.options -fill both -padx 10m -pady 4m

    frame .methopt.options.maxBalFlow
    frame .methopt.options.bns
    frame .methopt.options.checkButtons
    pack .methopt.options.maxBalFlow .methopt.options.bns \
        .methopt.options.checkButtons -side top -fill x -pady 5m
        
    label .methopt.options.maxBalFlow.label -text "Non-Weighted Matching:" -anchor w
    radiobutton .methopt.options.maxBalFlow.successive -text "Successive Augmentation" \
        -variable goblinMethMaxBalFlow -value 0 -anchor w
    radiobutton .methopt.options.maxBalFlow.phase -text "Phase Ordered Augmentation" \
        -variable goblinMethMaxBalFlow -value 1 -anchor w
    radiobutton .methopt.options.maxBalFlow.look -text "... with Lookahead Operations" \
        -variable goblinMethMaxBalFlow -value 2 -anchor w
    radiobutton .methopt.options.maxBalFlow.look2 -text "... with Simple Augmentations" \
        -variable goblinMethMaxBalFlow -value 3 -anchor w
    radiobutton .methopt.options.maxBalFlow.scaling -text "Capacity Scaling" \
        -variable goblinMethMaxBalFlow -value 4 -anchor w
    radiobutton .methopt.options.maxBalFlow.maxflow -text "Start with Maximum Flow" \
        -variable goblinMethMaxBalFlow -value 5 -anchor w
    pack .methopt.options.maxBalFlow.label \
        .methopt.options.maxBalFlow.successive \
        .methopt.options.maxBalFlow.phase \
        .methopt.options.maxBalFlow.look \
        .methopt.options.maxBalFlow.look2 \
        .methopt.options.maxBalFlow.scaling \
        .methopt.options.maxBalFlow.maxflow \
        -fill x
        
    label .methopt.options.bns.label -text "Balanced Network Search:" -anchor w
    radiobutton .methopt.options.bns.exact -text "Exact Search" \
        -variable goblinMethMaxBalFlow -value 0 -anchor w
    radiobutton .methopt.options.bns.dfs1 -text "Depth First Heuristics 1" \
        -variable goblinMethMaxBalFlow -value 1 -anchor w
    radiobutton .methopt.options.bns.dfs2 -text "Depth First Heuristics 2" \
        -variable goblinMethMaxBalFlow -value 2 -anchor w
    radiobutton .methopt.options.bns.bfs -text "Breadth First Heuristics" \
        -variable goblinMethMaxBalFlow -value 3 -anchor w
    pack .methopt.options.bns.label \
        .methopt.options.bns.exact \
        .methopt.options.bns.dfs1 \
        .methopt.options.bns.dfs2 \
        .methopt.options.bns.bfs \
        -fill x
        
    label .methopt.options.checkButtons.label -text "Weighted Matching:" -anchor w
    checkbutton .methopt.options.checkButtons.enhanced \
        -text "Start with Min Cost Flow" \
        -variable goblinMethMinCBalFlow -anchor w
    checkbutton .methopt.options.checkButtons.explicit \
        -text "Explicit Reduced Length Labels" \
        -variable goblinMethModLength -anchor w
    pack .methopt.options.checkButtons.label \
        .methopt.options.checkButtons.enhanced \
        .methopt.options.checkButtons.explicit -fill x
}
        
     
proc DisplayTSPOptions {} {
    wm title .methopt "GOBLIN NP-Hard Problems"

    destroy .methopt.buttons
    frame .methopt.buttons
    button .methopt.buttons.done -text "Done" -command { \
        destroy .methopt
    }
    
    button .methopt.buttons.prev -text "<" -command { \
        DisplayMatchingOptions
    }
    
    button .methopt.buttons.next -text ">" -relief groove -command {}
    
    pack .methopt.buttons.prev .methopt.buttons.next .methopt.buttons.done \
        -side left -fill x -padx 3m
     
    pack .methopt.buttons -padx 3m -pady 3m -side bottom

    destroy .methopt.options
    frame .methopt.options
    pack .methopt.options -fill both -padx 10m -pady 4m

    frame .methopt.options.tsp
    frame .methopt.options.colour
    pack .methopt.options.tsp \
        .methopt.options.colour -side top -fill x -pady 5m

    label .methopt.options.tsp.label -text "TSP Heuristics:" -anchor w
    radiobutton .methopt.options.tsp.random -text "Random Tour" \
        -variable goblinMethTSP -value 0 -anchor w
    radiobutton .methopt.options.tsp.insert -text "Farthest Insertion" \
        -variable goblinMethTSP -value 1 -anchor w
    radiobutton .methopt.options.tsp.tree -text "Tree Approximation" \
        -variable goblinMethTSP -value 2 -anchor w
    radiobutton .methopt.options.tsp.christofides -text "Christofides" \
        -variable goblinMethTSP -value 3 -anchor w
    pack .methopt.options.tsp.label \
        .methopt.options.tsp.random \
        .methopt.options.tsp.insert \
        .methopt.options.tsp.tree \
        .methopt.options.tsp.christofides \
        -fill x
    
    label .methopt.options.colour.label \
        -text "Node Colouring:" \
        -anchor w
    radiobutton .methopt.options.colour.stop \
        -text "Stop when feasible" -variable goblinMethColour \
        -value 0 -anchor w
    radiobutton .methopt.options.colour.exhaustive \
        -text "Exhaustive Search" -variable goblinMethColour \
        -value 1 -anchor w
    pack .methopt.options.colour.label \
        .methopt.options.colour.stop \
        .methopt.options.colour.exhaustive \
        -fill x
}


DisplayBasicOptions
