jmarca/initial-solution

View on GitHub

Showing 29 of 40 total issues

Function insert_nodes_for_breaks has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
Open

    def insert_nodes_for_breaks(self,travel_times):
        """Use travel time matrix, pickup and dropoff pairs to create the
        necessary dummy nodes for modeling breaks between pairs of nodes.

        """
Severity: Minor
Found in src/demand.py - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File solution_output.py has 451 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Solution output routines"""
from six.moves import xrange
from datetime import datetime, timedelta
import pandas as pd
import math
Severity: Minor
Found in src/solution_output.py - About 6 hrs to fix

    Function print_solution has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

    def print_solution(demand,
                       dist_matrix,
                       time_matrix,
                       vehicles,
                       manager,
    Severity: Minor
    Found in src/solution_output.py - About 6 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function csv_demand_output has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    def csv_demand_output(demand,
                          dist_matrix,
                          time_matrix,
                          vehicles,
                          manager,
    Severity: Minor
    Found in src/solution_output.py - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function initial_routes_no_breaks has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def initial_routes_no_breaks(demand,vehicles,time_matrix,
                       debug=False):
        # initial routes should be a list of nodes to visit, in node space
        # (not solver index space, not map space)
    
    
    Severity: Minor
    Found in src/initial_routes.py - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    File demand.py has 293 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import pandas as pd
    import numpy as np
    import breaks
    import break_node as BN
    import math
    Severity: Minor
    Found in src/demand.py - About 3 hrs to fix

      Function create_short_break_callback has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      def create_short_break_callback(travel_minutes_matrix,
                                demand,
                                period,
                                break_time):
          """create a callback function for short_breaktime.  presumes that
      Severity: Minor
      Found in src/evaluators.py - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function main has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def main():
          """Entry point of the program."""
          parser = argparse.ArgumentParser(description='Solve assignment of truck load routing problem, give hours of service rules and a specified list of origins and destinations')
          # parser.add_argument('--resume_file',type=str,dest='resumefile',
          #                     help="resume a failed solver run from this file")
      Severity: Minor
      Found in src/run_initial_routes.py - About 1 hr to fix

        Function main has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def main():
            """Entry point of the program."""
            parser = argparse.ArgumentParser(description='Solve assignment of truck load routing problem, with specified list of origins and destinations, ignoring hours of service rules')
            # parser.add_argument('--resume_file',type=str,dest='resumefile',
            #                     help="resume a failed solver run from this file")
        Severity: Minor
        Found in src/run_without_constraints.py - About 1 hr to fix

          Function __init__ has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def __init__(self,
                           odpairs,
                           time_matrix,
                           horizon,
                           pickup_time=15,
          Severity: Minor
          Found in src/demand.py - About 1 hr to fix

            Function print_solution has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def print_solution(demand,
            Severity: Major
            Found in src/solution_output.py - About 1 hr to fix

              Function create_drive_callback has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              def create_drive_callback(travel_minutes_matrix,
                                        demand,
                                        period,
                                        break_time):
                  """create a callback function for drivetime.  presumes that
              Severity: Minor
              Found in src/evaluators.py - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self,
              Severity: Major
              Found in src/break_node.py - About 1 hr to fix

                Function csv_demand_output has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def csv_demand_output(demand,
                Severity: Major
                Found in src/solution_output.py - About 1 hr to fix

                  Function csv_output has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def csv_output(demand,
                  Severity: Major
                  Found in src/solution_output.py - About 1 hr to fix

                    Function decide_next has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def decide_next(d,t,accumulators,od):
                        # decide where to go next
                        # first, can get to goal?
                        if goal_okay(d,t,accumulators,od):
                            return move_to_goal(d,t,accumulators,od)
                    Severity: Minor
                    Found in src/initial_routes.py - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function print_initial_solution has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def print_initial_solution(demand,
                    Severity: Major
                    Found in src/solution_output.py - About 1 hr to fix

                      Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def __init__(self,
                      Severity: Major
                      Found in src/demand.py - About 50 mins to fix

                        Function break_constraint has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def break_constraint(self,
                        Severity: Major
                        Found in src/demand.py - About 50 mins to fix

                          Function model_run has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def model_run(d,t,v,base_value,
                          Severity: Major
                          Found in src/model_run.py - About 50 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language