Skip to content

Commit

Permalink
fix: Fixing chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
Agrover112 committed Sep 11, 2021
1 parent b036206 commit 8a3d146
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions final/chaining.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import sys
import os
import os
from typing import final
sys.path.append(os.getcwd())
import time
import time

from .utils.util import plot_scores, print_schedule, read_file
from .utils.ga_utils import mutation
from .base_algorithm import FlightAlgorithm
from .rs import RandomSearch
from .hc import HillClimb
from .sa import SimulatedAnnealing
from .ga import GA, ReverseGA, GAReversals
from final.utils.util import plot_scores, print_schedule, read_file
from final.utils.ga_utils import mutation
from final.base_algorithm import FlightAlgorithm
from final.rs import RandomSearch
from final.hc import HillClimb
from final.sa import SimulatedAnnealing
from final.ga import GA, ReverseGA, GAReversals

import random
from .fitness import *
from final.fitness import *

class IteratedChaining():

Expand Down Expand Up @@ -57,7 +58,9 @@ def run(self,algorithm_1, algorithm_2):
scores.append(cost)
NFE += nfe
print("Cost at {}=={}".format(i, cost))
print(algorithm_1)
elif i == self.rounds - 1:
print("I'm IN ELSE if GUYS")
final_soln, cost, scores, nfe, seed = self.choose(algorithm_2).run(self.domain, self.fitness_function, self.seed)
scores.append(cost)
NFE += nfe
Expand Down Expand Up @@ -85,7 +88,8 @@ def run(self,algorithm_1, algorithm_2):

if __name__ == '__main__':
read_file('flights.txt')
ic=IteratedChaining(rounds=10, n_obs=2, tol=90)
soln, cost, scores, nfe=ic.run('RandomSearch', 'HillClimb')
ic=IteratedChaining(rounds=1, n_obs=2, tol=90)
#soln, cost, scores, nfe=ic.run('RandomSearch', 'HillClimb')
vals=ic.run('RandomSearch', 'HillClimb')
#print_schedule(soln, 'FCO')
#plot_scores(scores, "Chaining",save_fig=False)

0 comments on commit 8a3d146

Please sign in to comment.