<!DOCTYPE html>
<html lang="en">
<head>
  <title>Collapsing Superstring Conjecture</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Latest compiled and minified CSS -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    
  <!-- jQuery library -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

  <!-- Latest compiled JavaScript -->
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

  <!-- Lightbox -->
  <link href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" rel="stylesheet">

  <!-- Google web font css -->
  <link href='https://fonts.googleapis.com/css?family=Raleway:400,300,600,700' rel='stylesheet' type='text/css'>
    
  <link rel="stylesheet" href="static/style.css">
</head>
<body>


    <div class="container-fluid">
        <h1>Collapsing Superstring Conjecture</h1>
        
        <!-- divider section -->
        <div class="container">
            <div class="row">
                <div class="col-sm-12">
                    <hr>
                </div>
            </div>
        </div>
        
        <!-- input section -->
        <div class="row">
            <div class="col-md-7">
                <form role="form" method='POST' action=''>
                    <div class="col-md-10">
                        <div class="form-group">
                            <textarea class="span12" style="min-width:100%" rows="5" placeholder="Input Strings" name="strings" class="form-control" id="strings-box" autofocus>{{ input_strings }}</textarea>
                        </div>
                        <span class="error" >{{ error }}</span>
                    </div>
                    <div class="col-md-2">
                        <button type="submit" style="width:100%" name='compute-button' value="compute" class="btn btn-default">Compute</button>
                        <button type="submit" style="width:100%" name='random-button' value="reset" class="btn btn-default">Random</button>
                        <button type="submit" style="width:100%" name='reset-button' value="generate" class="btn btn-default">Clear</button>
                    </div>
                </form>
            </div>
            <div class="col-md-5">
                <p style="text-align:left;">Optimal Solution is of length {{  exact_sol|length  }}:</p>
                <p style="text-align:left;">{{  exact_sol  }}</p>
                <p style="text-align:left;">Greedy Hierarchical Solution is of length {{  hier_sol|length  }}:</p>
                <p style="text-align:left;">{{ hier_sol }}</p>
            </div>
        </div>
        
        <!-- divider section -->
        <div class="container">
            <div class="row">
                <div class="col-sm-12">
                    <hr>
                </div>
            </div>
        </div>
        
        <!-- main section -->
        <div class="row">
            <div class="col-md-4">
                <!--<center>-->
                    <h4>Greedy Hierarchical Solution</h4> 
                    <span class="hint">
                        <a  href="#" data-toggle="tooltip" data-placement="bottom" title="This part shows the greedy hierarchical algorithm in action. It processes nodes from top to bottom and for each node ensures that it is balanced and that it is connected to the rest of the graph. We conjecture that this algorithm is 2-approximate.">?</a>
                    </span>
                <!--</center>-->
                
                  <!-- Carousel -->
                  <div id="carouselHier" class="carousel" data-interval="false" data-ride="carousel">
                    <!-- Indicators -->
            
                    <ol class="carousel-indicators">
                      {% for i in range(hier|length) %}
                      <li data-target="#carouselHier" data-slide-to="{{ i }}" {% if loop.index == hier|length %}class="active"{% endif %}></li>
                      {% endfor %}
                    </ol>

                    <!-- Wrapper for slides -->
                    <div class="carousel-inner">
                      {% for (pic, desc) in hier %}
                      <div class="item {% if loop.index == hier|length %}active{% endif %}">
                        <a href="{{ pic }}" data-toggle="lightbox" data-gallery="hier-gallery" data-title="Greedy Hierarchical Solution" data-footer="{{ desc }}"> 
                            <img class="img-responsive center-block" src="{{ pic }}" alt="Greedy Hierarchical Solution" class="img-fluid" />
                            <div class="carousel-caption">
                                <p>{{ desc }}</p>
                            </div>
                        </a>
                      </div>
                      {% endfor %}
                    </div>

                    <!-- Left and right controls -->
                    <a class="left carousel-control" href="#carouselHier" data-slide="prev">
                      <span class="glyphicon glyphicon-chevron-left"></span>
                      <span class="sr-only">Previous</span>
                    </a>
                    <a class="right carousel-control" href="#carouselHier" data-slide="next">
                      <span class="glyphicon glyphicon-chevron-right"></span>
                      <span class="sr-only">Next</span>
                    </a>
                  </div>
                <div class="spacer"></div>    
            </div>
            
            
            <div class="col-md-4">
                <!--<center>-->
                  <h4> Doubled Optimal Solution </h4>
                  <span class="hint">
                        <a  href="#" data-toggle="tooltip" data-placement="bottom" title="This part shows the collapsing algorithm applied to an optimal solution in action. It takes an optimal solution, doubles it, and then starts collapsing pairs of edges. We conjecture that in the end it gets exactly the same result as the greedy hierarchical algorithm (this would imply that the greedy hierarchical algorithm is 2-approximate).">?</a>
                  </span>
                <!--</center>-->
                  <!-- Carousel -->
                  <div id="carouselExact" class="carousel" data-interval="false">
                    <!-- Indicators -->
            
                    <ol class="carousel-indicators">
                      {% for i in range(exact|length) %}
                      <li data-target="#carouselExact" data-slide-to="{{ i }}" {% if loop.index == 2 %}class="active"{% endif %}></li>
                      {% endfor %}
                    </ol>

                    <!-- Wrapper for slides -->
                    <div class="carousel-inner">
                      {% for (pic, desc) in exact %}
                      <div class="item {% if loop.index == 2 %}active{% endif %}">
                        <a href="{{ pic }}" data-toggle="lightbox" data-gallery="exact-gallery" data-title="Doubled Optimal Solution" data-footer="{{ desc }}"> 
                            <img class="img-responsive center-block" src="{{ pic }}" alt="Doubled Optimal Solution" class="img-fluid" />
                            <div class="carousel-caption">
                                <p>{{ desc }}</p>
                            </div>
                        </a>
                      </div>
                      {% endfor %}
                    </div>

                    <!-- Left and right controls -->
                    <a class="left carousel-control" href="#carouselExact" data-slide="prev">
                      <span class="glyphicon glyphicon-chevron-left"></span>
                      <span class="sr-only">Previous</span>
                    </a>
                    <a class="right carousel-control" href="#carouselExact" data-slide="next">
                      <span class="glyphicon glyphicon-chevron-right"></span>
                      <span class="sr-only">Next</span>
                    </a>
                  </div>
                <div class="spacer"></div>    
                <div class="buffer"></div>
            </div>
            
            <div class="col-md-4">
                <!--<center>-->
                  <h4> Doubled Trivial Solution </h4>
                  <span class="hint">
                        <a href="#" data-toggle="tooltip" data-placement="bottom" title="This part shows the collapsing algorithm applied to the &quot;naive&quot; solution in action. It first overlaps the input strings in exactly the same order as given in the input (which we call the naive solution), doubles it, and then starts collapsing pairs of edges. We conjecture that even this algorithm returns the same result as the greedy hierarchical algorithm (this would imply that the greedy hierarchical algorithm is 2-approximate).">?</a>
                  </span>
                <!--</center>-->
                  <!-- Carousel -->
                  <div id="carouselTrivial" class="carousel" data-interval="false">
                    <!-- Indicators -->
            
                    <ol class="carousel-indicators">
                      {% for i in range(trivial|length) %}
                      <li data-target="#carouselTrivial" data-slide-to="{{ i }}" {% if loop.index == 2 %}class="active"{% endif %}></li>
                      {% endfor %}
                    </ol>

                    <!-- Wrapper for slides -->
                    <div class="carousel-inner">
                      {% for (pic, desc) in trivial %}
                      <div class="item {% if loop.index == 2 %}active{% endif %}">
                        <a href="{{ pic }}" data-toggle="lightbox" data-gallery="trivial-gallery" data-title="Doubled Trivial Solution" data-footer="{{ desc }}"> 
                            <img class="img-responsive center-block" src="{{ pic }}" alt="Doubled Trivial Solution" class="img-fluid" />
                            <div class="carousel-caption">
                                <p>{{ desc }}</p>
                            </div>
                        </a>
                      </div>
                      {% endfor %}
                    </div>

                    <!-- Left and right controls -->
                    <a class="left carousel-control" href="#carouselTrivial" data-slide="prev">
                      <span class="glyphicon glyphicon-chevron-left"></span>
                      <span class="sr-only">Previous</span>
                    </a>
                    <a class="right carousel-control" href="#carouselTrivial" data-slide="next">
                      <span class="glyphicon glyphicon-chevron-right"></span>
                      <span class="sr-only">Next</span>
                    </a>
                  </div>
                <div class="spacer"></div>
            </div>
        </div>
        
        <!-- divider section -->
        <div class="container">
            <div class="row">
                <div class="col-sm-12">
                    <hr>
                </div>
            </div>
        </div>
        
        <!-- footer -->
        <footer class="page-footer font-small blue pt-4">
            <div class="container-fluid text-center text-md-left">
                <div class="row">
                    <p style="color:#aaa;">
                        Formal treatment of the Collapsing Superstring Conjecture on <a href="https://arxiv.org/abs/1809.08669">arXiv</a><br/>
                        Python code on <a href="https://github.com/alexanderskulikov/greedy-superstring-conjecture">github</a><br/>
                        For large instances we use the <a href="http://www.math.uwaterloo.ca/tsp/concorde.html">Concorde</a> Traveling Salesman Solver <br/>
                        and <a href="https://www.math.uwaterloo.ca/~bico/qsopt/">QSopt</a> Linear Programming Solver
                    </p>
                </div>
            </div>
        </footer>
    </div>
    
<script src="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.min.js"></script>
    
<script type="text/javascript">
$(document).on('click', '[data-toggle="lightbox"]', function(event) {
            event.preventDefault();
            $(this).ekkoLightbox();
        });
</script>
    
<script>
$(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip();   
});
</script>
</body>
</html>