Skip to content

Commit 7d6ac8d

Browse files
committed
remove nan check (at least for now)
1 parent a55adbe commit 7d6ac8d

1 file changed

Lines changed: 37 additions & 9 deletions

File tree

src/compas_tno/problems/setup.py

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,13 @@ def _apply_starting_point(form, problem, starting_point, settings):
117117
printout_loadpath = False
118118
find_inds = settings.get("find_inds", False)
119119
solver_convex = settings.get("solver_convex", "CLARABEL")
120-
startingpoint_loadpath(form, problem=problem, find_inds=find_inds, solver_convex=solver_convex, printout=printout_loadpath)
120+
startingpoint_loadpath(
121+
form,
122+
problem=problem,
123+
find_inds=find_inds,
124+
solver_convex=solver_convex,
125+
printout=printout_loadpath,
126+
)
121127
elif starting_point == "relax":
122128
equilibrium_fdm(form)
123129
startingpoint_tna(form)
@@ -173,8 +179,18 @@ def _build_variable_vector(problem, form, variables, settings, i_k, thk):
173179
bounds_x = []
174180
bounds_y = []
175181
for i in problem.fixed:
176-
bounds_x.append([form.vertex_attribute(i_k[i], "xmin"), form.vertex_attribute(i_k[i], "xmax")])
177-
bounds_y.append([form.vertex_attribute(i_k[i], "ymin"), form.vertex_attribute(i_k[i], "ymax")])
182+
bounds_x.append(
183+
[
184+
form.vertex_attribute(i_k[i], "xmin"),
185+
form.vertex_attribute(i_k[i], "xmax"),
186+
]
187+
)
188+
bounds_y.append(
189+
[
190+
form.vertex_attribute(i_k[i], "ymin"),
191+
form.vertex_attribute(i_k[i], "ymax"),
192+
]
193+
)
178194
bounds = bounds + bounds_x + bounds_y
179195

180196
# Support height variables (zb)
@@ -183,7 +199,12 @@ def _build_variable_vector(problem, form, variables, settings, i_k, thk):
183199
x0 = append(x0, zb0).reshape(-1, 1)
184200
bounds_z = []
185201
for i in problem.fixed:
186-
bounds_z.append([form.vertex_attribute(i_k[i], "lb"), form.vertex_attribute(i_k[i], "ub")])
202+
bounds_z.append(
203+
[
204+
form.vertex_attribute(i_k[i], "lb"),
205+
form.vertex_attribute(i_k[i], "ub"),
206+
]
207+
)
187208
bounds = bounds + bounds_z
188209

189210
# Thickness variable (t)
@@ -284,9 +305,9 @@ def _compute_initial_values(problem, fobj, fconstr, fgrad, fjac, x0):
284305
if fjac:
285306
jac = fjac(x0, problem)
286307

287-
if any([isnan(problem.ub[i]) for i in range(len(problem.ub))]) or any([isnan(problem.lb[i]) for i in range(len(problem.lb))]):
288-
print("Is Nan for the bounds. Optimisation can not proceed")
289-
raise ValueError("Check bounds that constraint nodes")
308+
# if any([isnan(problem.ub[i]) for i in range(len(problem.ub))]) or any([isnan(problem.lb[i]) for i in range(len(problem.lb))]):
309+
# print("Is Nan for the bounds. Optimisation can not proceed")
310+
# raise ValueError("Check bounds that constraint nodes")
290311

291312
return f0, g0, grad, jac
292313

@@ -381,7 +402,7 @@ def set_up_general_optimisation(analysis: "Analysis"):
381402
# 2. Create or get problem instance
382403
if not problem:
383404
problem = Problem.from_formdiagram(form)
384-
405+
385406
problem = _adapt_problem_to_features(form, problem, features, settings, printout)
386407

387408
# 3. Setup problem metadata
@@ -408,7 +429,14 @@ def set_up_general_optimisation(analysis: "Analysis"):
408429
# 9. Initialize q variables and update problem geometry (before adding other variables)
409430
qid = problem.q[problem.ind]
410431
problem.q = q_from_variables(qid, problem.B, problem.d)
411-
problem.X[problem.free] = xyz_from_q(problem.q, problem.P[problem.free], problem.X[problem.fixed], problem.Ci, problem.Cit, problem.Cb)
432+
problem.X[problem.free] = xyz_from_q(
433+
problem.q,
434+
problem.P[problem.free],
435+
problem.X[problem.fixed],
436+
problem.Ci,
437+
problem.Cit,
438+
problem.Cb,
439+
)
412440

413441
# 10. Verify equilibrium
414442
error = sum((problem.E.dot(problem.q) - problem.ph) ** 2)

0 commit comments

Comments
 (0)