Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into dev
  • Loading branch information
dshaw150 authored and dshaw150 committed Jan 8, 2019
2 parents 51ab756 + 835cd52 commit dd3828a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions GASTOp.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# Parse input paramters from init.txt file
init_file_path = 'gastop-config/struct_making_test_init2.txt'


config = utilities.init_file_parser(init_file_path)

pop_size = config['ga_params']['pop_size']
Expand Down
1 change: 1 addition & 0 deletions gastop/genalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def run(self, num_generations=None, progress_fitness=None, progress_truss=None,
pool.join()

self.population.sort(key=lambda x: x.fitness_score)

progress.progress_monitor(current_gen, self.population)

self.update_population() # Determine which members to
Expand Down
7 changes: 6 additions & 1 deletion gastop/truss.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ def plot(self, domain=None, loads=None, fixtures=None,

if load_scale is None and loads is not None:
load_scale = size_scale/np.abs(loads).max()/5

if ax is None:
fig = plt.figure()
ax = fig.gca(projection='3d')
Expand All @@ -240,6 +239,8 @@ def plot(self, domain=None, loads=None, fixtures=None,
ax.set_ylabel('Y [m]', fontsize=14, labelpad=10)
ax.set_zlabel('Z [m]', fontsize=14, labelpad=10)
ax.tick_params(labelsize='small')
ax.view_init(30, -45)


if domain is not None:
ax.set_xlim(domain[:, 0])
Expand All @@ -266,10 +267,14 @@ def plot(self, domain=None, loads=None, fixtures=None,
ax.quiver(nodes[:, 0], nodes[:, 1], nodes[:, 2],
loads[:, 0, 0], loads[:, 1, 0], loads[:, 2, 0],
length=load_scale, pivot='tip', color='r')
load_nodes = nodes[loads[:, :, 0].any(axis=1)]
ax.scatter(load_nodes[:, 0], load_nodes[:, 1], load_nodes[:, 2],
color='red', marker='o', depthshade=False, s=100)

if fixtures is not None:
fix_nodes = nodes[fixtures[:, :, 0].any(axis=1)]
ax.scatter(fix_nodes[:, 0], fix_nodes[:, 1], fix_nodes[:, 2],
color='green', marker='o', depthshade=False, s=100)
if prog == 0: # only shows it if not being called within ProgMon
plt.show()
plt.gcf().savefig('final_result.png')

0 comments on commit dd3828a

Please sign in to comment.