Пример #1
0
def runGALE(iterationsP, minBP, maxBP):
  from galeForModel import GALE  
  from galeForModel import distFromHellScore
  from modelForGALE import IPMDFC
  import utility 
  modelObj=IPMDFC()
  galeOutput = GALE(modelObj, iterationsP)
  #print("Final gale out put ", galeOutput) 
  for item in galeOutput: 
    print("item length is " , len(item))   
    print("item is ", item)
    objectivevals = modelObj.solve(item)
    print("objective values are ", objectivevals)
    fromHellScore = distFromHellScore(objectivevals)
    print("Distance from hell score is: ", fromHellScore)
    finalScore = utility.getNormalizedScoreForGale(minBP, maxBP, fromHellScore)
    print("Final score (after normalization ...)", finalScore)
Пример #2
0
def runGALE(iterationsP, minBP, maxBP):
    from galeForModel import GALE
    from galeForModel import distFromHellScore
    from modelForGALE import IPMDFC
    import utility
    modelObj = IPMDFC()
    galeOutput = GALE(modelObj, iterationsP)
    #print("Final gale out put ", galeOutput)
    for item in galeOutput:
        print("item length is ", len(item))
        print("item is ", item)
        objectivevals = modelObj.solve(item)
        print("objective values are ", objectivevals)
        fromHellScore = distFromHellScore(objectivevals)
        print("Distance from hell score is: ", fromHellScore)
        finalScore = utility.getNormalizedScoreForGale(minBP, maxBP,
                                                       fromHellScore)
        print("Final score (after normalization ...)", finalScore)
Пример #3
0
  for cc in collect: final.extend(cc)
  ret = gale0( modelObjP ,new=final,pop=len(final))
  #print('Time Taken: ', time()-t)
  # true = DTLZ2(n_dec=30, n_obj=3).get_pareto()
  #m = measure(model=DTLZ2(n_dec=30, n_obj=3))
  #conv = m.convergence(ret)
  #print("Convergence:",conv)
  # set_trace()
  return ret
  
def distFromHellScore(objListParam):
  import math  
  square = lambda val: math.pow(val,2)
  sq_root = lambda val: math.sqrt(val)
  dist_from_hell =0
  for f in objListParam:
    dist_from_hell += square(f)
  dist_from_hell = sq_root(dist_from_hell)
  return dist_from_hell  

if __name__=="__main__":
  iterations = 100
  modelObj=IPMDFC()
  galeOutput = GALE(modelObj, iterations)
  #print("Final gale out put ", galeOutput) 
  for item in galeOutput: 
    print("item length is " , len(item))   
    print("item is ", item)
    objectivevals = modelObj.solve(item)
    print("objective values are ", objectivevals)
    print("Distance from hell score is: ", distFromHellScore(objectivevals))
Пример #4
0
    # true = DTLZ2(n_dec=30, n_obj=3).get_pareto()
    #m = measure(model=DTLZ2(n_dec=30, n_obj=3))
    #conv = m.convergence(ret)
    #print("Convergence:",conv)
    # set_trace()
    return ret


def distFromHellScore(objListParam):
    import math
    square = lambda val: math.pow(val, 2)
    sq_root = lambda val: math.sqrt(val)
    dist_from_hell = 0
    for f in objListParam:
        dist_from_hell += square(f)
    dist_from_hell = sq_root(dist_from_hell)
    return dist_from_hell


if __name__ == "__main__":
    iterations = 100
    modelObj = IPMDFC()
    galeOutput = GALE(modelObj, iterations)
    #print("Final gale out put ", galeOutput)
    for item in galeOutput:
        print("item length is ", len(item))
        print("item is ", item)
        objectivevals = modelObj.solve(item)
        print("objective values are ", objectivevals)
        print("Distance from hell score is: ",
              distFromHellScore(objectivevals))