# Path: ipet/misc/misc.py
# FLOAT_INFINITY = 1e20
# FLOAT_LARGE = 1e15
# DEFAULT_MIN_GEOM_MEAN = 1.0
#     FLOAT_INFINITY = infinity
# def sortingKeyContext(context):
# def filenameGetContext(filename):
# def getWordAtIndex(line : str, index : int) -> str:
# def getNumberAtIndex(line : str, index : int) -> str:
# def getSoluFileProbName(probname):
# def floatPrint(number, digitsbef=16, digitsafter=9, dispchar='g'):
# def getTexName(name):
# def getCplexGap(value, referencevalue):
# def getGap(value : float, referencevalue : float, useCplexGap : bool=False) -> float:
# def listGetArithmeticMean(listofnumbers):
# def iqr(listofnumbers):
# def lQuart(listofnumbers):
# def uQuart(listofnumbers):
# def shmean(listofnumbers, shiftby=10.0):
# def gemean(listofnumbers, mingeommean=DEFAULT_MIN_GEOM_MEAN):
# def listGetGeomMean(listofnumbers, mingeommean=DEFAULT_MIN_GEOM_MEAN):
# def listGetShiftedGeometricMean(listofnumbers, shiftby=10.0):
# def getVariabilityScore(listofnumbers):
# def isInfinite(value : float) -> bool:
# def getInfinity() -> float:
# def setInfinity(infinity : float):
# def cutString(string, char='_', maxlength=-1):
# def listGetMinColWidth(listofitems):
# def strConcat(strings : list) -> str:
# def meanOrConcat(l : list):
# def saveAsXML(nodeobject, filename : str) -> None:
# def convertTimeStamp(timestamp : float) -> str:
# 
# Path: ipet/Key.py
# CONTEXT_LOGFILE = 1  # the log file of a solver which most readers are reading from
# CONTEXT_ERRFILE = 2  # the error file of a solver
# CONTEXT_SETFILE = 3  # the settings file used for solving
# CONTEXT_TRACEFILE = 5
# CONTEXT_METAFILE = 0  # the metadata
#     MINIMIZE = 1
#     MAXIMIZE = -1
# class SolverStatusCodes:
# class ProblemStatusCodes:
# class ObjectiveSenseCode:
#     def getBestStatus(*args):
#     def getWorstStatus(*args):
# def solverToProblemStatusCode(solverstatus : int) -> str:


import numpy as np
import numpy
from ipet.misc import misc
from ipet import Key
from queue import PriorityQueue
        either "id" or "name" to determine if testrun data should be accessed by name or by id
    scale : bool
        should all x-coordinates be scaled by the limit (and therefore lie in the range [0,1])? This makes
        sense for tests where different time limits apply.
    lim : tuple
        tuple of lower and upper limit for x, or None if unspecified.
    """
    # read keys from kw dictionary
    if access == "id":
        getmethod = testrun.getProblemDataById
    else:
        getmethod = testrun.getProblemDataByName

    history = getmethod(probid, historytouse)

    xaftersolve = getmethod(probid, xaftersolvekey)

    xlim = getmethod(probid, xlimitkey)

    if lim[0] is not None and lim[1] is not None and lim[1] < lim[0]:
        raise Exception("Empty integration interval [{},{}]".format(*lim))

    if xlim is None and xaftersolve is None:
        return None
    if history is None:
        history = []

    try:
        lastbound = history[-1][1]
    except:

# Path: ipet/misc/misc.py
# FLOAT_INFINITY = 1e20
# FLOAT_LARGE = 1e15
# DEFAULT_MIN_GEOM_MEAN = 1.0
#     FLOAT_INFINITY = infinity
# def sortingKeyContext(context):
# def filenameGetContext(filename):
# def getWordAtIndex(line : str, index : int) -> str:
# def getNumberAtIndex(line : str, index : int) -> str:
# def getSoluFileProbName(probname):
# def floatPrint(number, digitsbef=16, digitsafter=9, dispchar='g'):
# def getTexName(name):
# def getCplexGap(value, referencevalue):
# def getGap(value : float, referencevalue : float, useCplexGap : bool=False) -> float:
# def listGetArithmeticMean(listofnumbers):
# def iqr(listofnumbers):
# def lQuart(listofnumbers):
# def uQuart(listofnumbers):
# def shmean(listofnumbers, shiftby=10.0):
# def gemean(listofnumbers, mingeommean=DEFAULT_MIN_GEOM_MEAN):
# def listGetGeomMean(listofnumbers, mingeommean=DEFAULT_MIN_GEOM_MEAN):
# def listGetShiftedGeometricMean(listofnumbers, shiftby=10.0):
# def getVariabilityScore(listofnumbers):
# def isInfinite(value : float) -> bool:
# def getInfinity() -> float:
# def setInfinity(infinity : float):
# def cutString(string, char='_', maxlength=-1):
# def listGetMinColWidth(listofitems):
# def strConcat(strings : list) -> str:
# def meanOrConcat(l : list):
# def saveAsXML(nodeobject, filename : str) -> None:
# def convertTimeStamp(timestamp : float) -> str:
# 
# Path: ipet/Key.py
# CONTEXT_LOGFILE = 1  # the log file of a solver which most readers are reading from
# CONTEXT_ERRFILE = 2  # the error file of a solver
# CONTEXT_SETFILE = 3  # the settings file used for solving
# CONTEXT_TRACEFILE = 5
# CONTEXT_METAFILE = 0  # the metadata
#     MINIMIZE = 1
#     MAXIMIZE = -1
# class SolverStatusCodes:
# class ProblemStatusCodes:
# class ObjectiveSenseCode:
#     def getBestStatus(*args):
#     def getWorstStatus(*args):
# def solverToProblemStatusCode(solverstatus : int) -> str:


# Path: ipet/misc/integrals.py
import numpy as np
import numpy
from ipet.misc import misc
from ipet import Key
from queue import PriorityQueue

        either "id" or "name" to determine if testrun data should be accessed by name or by id
    scale : bool
        should all x-coordinates be scaled by the limit (and therefore lie in the range [0,1])? This makes
        sense for tests where different time limits apply.
    lim : tuple
        tuple of lower and upper limit for x, or None if unspecified.
    """
    # read keys from kw dictionary
    if access == "id":
        getmethod = testrun.getProblemDataById
    else:
        getmethod = testrun.getProblemDataByName

    history = getmethod(probid, historytouse)

    xaftersolve = getmethod(probid, xaftersolvekey)

    xlim = getmethod(probid, xlimitkey)

    if lim[0] is not None and lim[1] is not None and lim[1] < lim[0]:
        raise Exception("Empty integration interval [{},{}]".format(*lim))

    if xlim is None and xaftersolve is None:
        return None
    if history is None:
        history = []

    try:
        lastbound = history[-1][1]
    except:

        lastbound = misc.FLOAT_INFINITY