Skip to content

Commit

Permalink
scoretest no longer uses deap
Browse files Browse the repository at this point in the history
  • Loading branch information
Immudzen committed Aug 17, 2021
1 parent 39c9280 commit 01a0f12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CADETMatch.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ProjectTypeGuids>{888888a0-9f3d-457c-b088-3a5042f75d52}</ProjectTypeGuids>
<LaunchProvider>Standard Python launcher</LaunchProvider>
<InterpreterId>CondaEnv|CondaEnv|pymoo_devel</InterpreterId>
<CommandLineArguments>"F:\ryzen_pymoo_unsga3\search\multistart\dextran.json" 12</CommandLineArguments>
<CommandLineArguments>"F:\ryzen_pymoo_unsga3\search\scoretest\dextran.json" 12</CommandLineArguments>
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging>
<SuppressConfigureTestFrameworkPrompt>true</SuppressConfigureTestFrameworkPrompt>
<InterpreterArguments>
Expand Down
38 changes: 6 additions & 32 deletions CADETMatch/search/scoretest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def run(cache, tools, creator):
path = Path(cache.settings["resultsDirBase"], cache.settings["csv"])
with path.open("a", newline="") as csvfile:
writer = csv.writer(csvfile, delimiter=",", quoting=csv.QUOTE_ALL)
pop = cache.toolbox.population(n=0)
sim_start = generation_start = time.time()
result_data = {
"input": [],
Expand All @@ -34,14 +33,15 @@ def run(cache, tools, creator):
"confidence": [],
}

population = []
if "seeds" in cache.settings:
seed_pop = [
pop.Individual(
[f(v) for f, v in zip(cache.settings["transform"], sublist)]
)
for sublist in cache.settings["seeds"]
]
pop.extend(seed_pop)
population.extend(seed_pop)

if cache.metaResultsOnly:
hof = pareto.DummyFront()
Expand All @@ -59,10 +59,9 @@ def run(cache, tools, creator):
similar=pareto.similar, similar_fit=pareto.similar_fit_meta(cache)
)

invalid_ind = [ind for ind in pop if not ind.fitness.valid]
stalled, stallWarn, progressWarn = util.eval_population(
cache,
invalid_ind,
population,
writer,
csvfile,
hof,
Expand All @@ -74,7 +73,7 @@ def run(cache, tools, creator):
progress.writeProgress(
cache,
-1,
pop,
population,
hof,
meta_hof,
grad_hof,
Expand All @@ -85,7 +84,7 @@ def run(cache, tools, creator):
)

if cache.settings.get("condTest", None):
for ind in invalid_ind:
for ind in population:
J = jacobian.jac(ind, cache)
multiprocessing.get_logger().info("%s %s", ind, J)

Expand Down Expand Up @@ -125,29 +124,4 @@ def setupDEAP(
base,
tools,
):
"setup the DEAP variables"
creator.create(
"Individual",
pop.Individual
)

creator.create(
"IndividualMeta",
pop.Individual
)
cache.toolbox.register(
"individualMeta", util.initIndividual, creator.IndividualMeta, cache
)

cache.toolbox.register(
"individual",
util.generateIndividual,
creator.Individual,
len(cache.MIN_VALUE),
cache.MIN_VALUE,
cache.MAX_VALUE,
cache,
)
cache.toolbox.register(
"population", tools.initRepeat, list, cache.toolbox.individual
)
pass

0 comments on commit 01a0f12

Please sign in to comment.