22
33from compas_tno .algorithms import compute_reactions
44from compas_tno .algorithms import equilibrium_fdm
5- from compas_tno .algorithms import form_update_with_parallelisation
6- from compas_tno .solvers .solver_cvxpy import run_loadpath_from_form_CVXPY
7- from compas_tno .solvers .solver_MATLAB import run_loadpath_from_form_MATLAB
5+ from compas_tno .solvers import run_loadpath_from_form_CVXPY
86
97
10- def startingpoint_loadpath (form , problem = None , find_inds = False , solver_convex = "CVXPY" , printout = False ):
8+ def startingpoint_sag (form , boundary_force = 50.0 , ** kwargs ):
9+ """Initialize the equilibrium in a form diagram with applied loads using sag approach
10+
11+ Parameters
12+ ----------
13+ form : :class:`~compas_tno.diagrams.FormDiagram`
14+ The form diagram. Loads and support must already have been assigned
15+ boundary_force : float, optional
16+ Force density in the edges on the boundary.
17+ The default value is ``50.0``.
18+ """
19+ form .edges_attribute ("q" , min (boundary_force , - 1 * boundary_force ), list (form .edges_on_boundary ()))
20+ startingpoint_fdm (form )
21+ for key in form .vertices ():
22+ form .vertex_attribute (key , "z" , 0.0 )
23+ return form
24+
25+
26+ def startingpoint_loadpath (form , problem = None , find_inds = False , solver_convex = "CLARABEL" , printout = False , ** kwargs ):
1127 """Built-in function to optimise the loadpath considering diagram fixed projection.
12- Note: This function will select the most appropriate solver (CVX or MOSEK)
1328
1429 Parameters
1530 ----------
@@ -20,7 +35,8 @@ def startingpoint_loadpath(form, problem=None, find_inds=False, solver_convex="C
2035 find_inds : bool, optional
2136 If independents need to be found before the loadpath computation, by default False
2237 solver_convex : str, optional
23- Solver to compute the convex optimisation, by default CVXPY
38+ Solver to use, by default CLARABEL. Options are "CLARABEL", "MOSEK" or "CVXOPT".
39+ Note: "MOSEK" and "CVXOPT" are not available in the default installation of TNO.
2440 printout : bool, optional
2541 If prints about the optimisation data should appear in the screen, by default False
2642
@@ -30,22 +46,18 @@ def startingpoint_loadpath(form, problem=None, find_inds=False, solver_convex="C
3046 The class with the main matrices of the problem
3147 """
3248
33- if solver_convex == "CVX" or solver_convex == "MATLAB" :
34- if not importlib .util .find_spec ("matlab" ):
35- raise ValueError ("MATLAB/CVX not configured. Try changing the <solver_convex> attribute." )
36- problem = run_loadpath_from_form_MATLAB (form , problem = problem , find_inds = find_inds , printout = printout )
37- elif solver_convex == "CVXPY" or solver_convex == "MOSEK" :
38- if not importlib .util .find_spec ("cvxpy" ):
39- raise ValueError ("CVXPY/MOSEK not configured. Try changing the <solver_convex> attribute." )
40- problem = run_loadpath_from_form_CVXPY (form , problem = problem , find_inds = find_inds , printout = printout )
41- else :
42- raise ValueError ("Could not initilalise loadpath optimisation with {}. Try changing the <solver_convex> attribute." .format (solver_convex ))
49+ problem = run_loadpath_from_form_CVXPY (
50+ form ,
51+ problem = problem ,
52+ find_inds = find_inds ,
53+ solver_convex = solver_convex ,
54+ printout = printout ,
55+ )
4356
4457 return problem
4558
4659
47- # Use the appropiate functions at TNA here
48- def startingpoint_tna (form , plot = False ):
60+ def startingpoint_tna (form , plot = False , ** kwargs ):
4961 """Initialize the equilibrium in a form diagram with applied loads using TNA interative solver procedure (form and force diagrams are parallel)
5062
5163 Parameters
@@ -56,13 +68,15 @@ def startingpoint_tna(form, plot=False):
5668 Plots of the intermediare and final force diagrams to follow the process, by default False
5769 """
5870
59- form_update_with_parallelisation (form , plot = plot )
71+ # form_update_with_parallelisation(form, plot=plot)
6072
61- compute_reactions (form )
73+ # compute_reactions(form)
74+
75+ raise NotImplementedError ("Starting point not implemented for TNA" )
6276
6377
6478# Use the appropiate functions at TNA here
65- def startingpoint_fdm (form ):
79+ def startingpoint_fdm (form , ** kwargs ):
6680 """Initialize the equilibrium in a form diagram with applied loads using FDM approach for the q's stored in the form
6781
6882 Parameters
0 commit comments