예제 #1
0
파일: MethodDOE.py 프로젝트: butakun/duh
 def __init__(self, spec):
     Method.__init__(self)
     plan = ExperimentPlan(Context.SimulationChain)
     print "MethodDOE: ", spec
     plan.Import(open(spec["Plan"]))
     self.Plan = plan
     #self._Event = threading.Event()
     #self._Event.set()
     self._Sem = threading.Semaphore(0)
예제 #2
0
    def __init__(self, spec):
        Method.__init__(self)
        plan = ExperimentPlan(Context.SimulationChain)
        print "MethodDOE: ", spec
        plan.Import(open(spec["Plan"]))
        self.Plan = plan

        if spec.has_key("InfillCriteriaFunction"):
            self.InfillCriteriaFunction = spec["InfillCriteriaFunction"]
        else:
            self.InfillCriteriaFunction = AdaptiveDOECriteria.SimpleLOO
        self.MaxIterations = spec["Iterations"]
        self.NewSitesPerIteration = spec["NewSitesPerIteration"]

        self._Sem = threading.Semaphore(0)
예제 #3
0
파일: MethodOpti.py 프로젝트: butakun/duh
    def __init__(self, spec):
        Method.__init__(self)

        self.Chromosome = Factory.Chromosome(Context.SimulationChain)
        self.ResEval = ChainResponseEvaluator()
        self.ResEval.Start()

        self.PenEval = Factory.CreatePenaltyEvaluator(spec)
        self.FitnessEval = EA.FitnessEvaluator()

        optiConfig = spec["OptimizerConfig"]
        popSize = optiConfig["PopulationSize"]
        self.OptimizerConfig = optiConfig

        postIterCallback = lambda gen, pop: self.PostIteration(gen, pop)

        self.BestExperiment = None

        if spec["Optimizer"] == "GA":
            self.Optimizer = EA.MonoObjectiveGA(self.Chromosome, self.ResEval,
                                                self.PenEval, self.FitnessEval,
                                                popSize, 2)
            self.Optimizer.PostIterationCallback = postIterCallback
            self.HistoryFile = open("%s.history.dat" % Context.Name, "w")
        elif spec["Optimizer"] == "SurrogateGA":
            Context.Database.Import(open(optiConfig["DOE"]))
            pop = Factory.PopulationFromPlan(self.Chromosome, Context.Database)
            self.Optimizer = EA.MonoObjectiveSurrogateGA(
                self.Chromosome, self.ResEval, self.PenEval, self.FitnessEval,
                pop)
        elif spec["Optimizer"] == "ParetoGA":
            self.Optimizer = EA.SPEA2(self.Chromosome, self.ResEval,
                                      self.PenEval,
                                      optiConfig["PopulationSize"],
                                      optiConfig["ArchiveSize"])
        elif spec["Optimizer"] == "ParetoSurrogateGA":
            Context.Database.Import(open(optiConfig["DOE"]))
            pop = Factory.PopulationFromPlan(self.Chromosome, Context.Database)
            self.Optimizer = EA.ParetoSurrogateGA(
                self.Chromosome, self.ResEval, self.PenEval, pop, popSize,
                optiConfig["ArchiveSize"], optiConfig["Update"],
                optiConfig["UpdateTruncation"])