Skip to content
Snippets Groups Projects
Commit 5ddbad81 authored by Steinmann's avatar Steinmann
Browse files

rewritten flow into parameter not variable!!

parent 0528b858
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Formulieren der Optimierungsgleichung in pymoo Formulieren der Optimierungsgleichung in pymoo
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Es gilt die Kontinuitätsgleichung: Es gilt die Kontinuitätsgleichung:
$ \Sigma \dot{V}_k(t) = O$ $ \Sigma \dot{V}_k(t) = O$
und die aus der Topologie resultierende Inzidenzmatrix $A_i$ und die aus der Topologie resultierende Inzidenzmatrix $A_i$
sowie die aus dem Pumpenkennfeld folgende Beziehung: sowie die aus dem Pumpenkennfeld folgende Beziehung:
$\Delta p=\alpha_1 Q^2+\alpha_2 Q n+\alpha_3 n^2 : n \in \{0\} \cup [n_{\mathrm{min}},n_{\mathrm{max}}] $ $\Delta p=\alpha_1 Q^2+\alpha_2 Q n+\alpha_3 n^2 : n \in \{0\} \cup [n_{\mathrm{min}},n_{\mathrm{max}}] $
$P=\beta_1 Q^3+\beta_2 Q^2 n+\beta_3 Q n^2+\beta_4n^3+\beta_5$ $P=\beta_1 Q^3+\beta_2 Q^2 n+\beta_3 Q n^2+\beta_4n^3+\beta_5$
und die beziehung für den Druckverlust an den Ventilen: und die beziehung für den Druckverlust an den Ventilen:
$\Delta p_{\mathrm{loss}} = - \frac{1}{2} \varrho \zeta \left(\frac{Q}{A}\right)^2 = -l Q^2 :l\in [l_{\mathrm{min}}:\infty )$ $\Delta p_{\mathrm{loss}} = - \frac{1}{2} \varrho \zeta \left(\frac{Q}{A}\right)^2 = -l Q^2 :l\in [l_{\mathrm{min}}:\infty )$
nun soll für einen Gegebenen Volumenstrom $Q$ eine Optimale Drehzahl bestimmt werden, welche die Pumpenlesitung minimiert. nun soll für einen Gegebenen Volumenstrom $Q$ eine Optimale Drehzahl bestimmt werden, welche die Pumpenlesitung minimiert.
$$ $$
\begin{align*} \begin{align*}
\mathrm{min} \sum_{p \in \mathcal{P}} Po_{p} \\ \mathrm{min} \sum_{p \in \mathcal{P}} Po_{p} \\
Q_{p,i} \geq \sum_{strang} Q_v + \sum_{strang} Q_p \\ Q_{p,i} \geq \sum_{strang} Q_v + \sum_{strang} Q_p \\
Q_p , n\epsilon [n_{min},n_{max}] \\ Q_p , n\epsilon [n_{min},n_{max}] \\
\overrightarrow{n} = (1,n,n^2,n^3)^T \\ \overrightarrow{n} = (1,n,n^2,n^3)^T \\
min P = A \overrightarrow{n} \\ min P = A \overrightarrow{n} \\
-n\leq n_{min} \\ -n\leq n_{min} \\
n\leq n_{max} n\leq n_{max}
\end{align*} \end{align*}
$$ $$
Förderhöhe als constraint continuität fomulieren pro strang Förderhöhe als constraint continuität fomulieren pro strang
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
!pip install pyomo !pip install pyomo
``` ```
%% Output %% Output
Defaulting to user installation because normal site-packages is not writeable Defaulting to user installation because normal site-packages is not writeable
Collecting pyomo Collecting pyomo
Downloading Pyomo-6.8.2-py3-none-any.whl.metadata (8.0 kB) Downloading Pyomo-6.8.2-py3-none-any.whl.metadata (8.0 kB)
Collecting ply (from pyomo) Collecting ply (from pyomo)
Downloading ply-3.11-py2.py3-none-any.whl.metadata (844 bytes) Downloading ply-3.11-py2.py3-none-any.whl.metadata (844 bytes)
Downloading Pyomo-6.8.2-py3-none-any.whl (3.7 MB) Downloading Pyomo-6.8.2-py3-none-any.whl (3.7 MB)
---------------------------------------- 0.0/3.7 MB ? eta -:--:-- ---------------------------------------- 0.0/3.7 MB ? eta -:--:--
---------------------------- ----------- 2.6/3.7 MB 12.6 MB/s eta 0:00:01 ---------------------------- ----------- 2.6/3.7 MB 12.6 MB/s eta 0:00:01
---------------------------------------- 3.7/3.7 MB 11.6 MB/s eta 0:00:00 ---------------------------------------- 3.7/3.7 MB 11.6 MB/s eta 0:00:00
Downloading ply-3.11-py2.py3-none-any.whl (49 kB) Downloading ply-3.11-py2.py3-none-any.whl (49 kB)
Installing collected packages: ply, pyomo Installing collected packages: ply, pyomo
Successfully installed ply-3.11 pyomo-6.8.2 Successfully installed ply-3.11 pyomo-6.8.2
[notice] A new release of pip is available: 24.3.1 -> 25.0 [notice] A new release of pip is available: 24.3.1 -> 25.0
[notice] To update, run: C:\Users\Victor\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip [notice] To update, run: C:\Users\Victor\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
#Pump-Powercurve and Pump-Hightcurve #Pump-Powercurve and Pump-Hightcurve
import regression_own import regression_own
(LR_H,LR_P)=regression_own.regress_pump() (LR_H,LR_P)=regression_own.regress_pump()
``` ```
%% Output %% Output
R^20.9998289611292903 R^20.9998289611292903
R^20.9994449560888792 R^20.9994449560888792
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
#Graph constroctor #Graph constroctor
#Alle Ventile sind direkt mit der Quelle/Senke Verbunden #Alle Ventile sind direkt mit der Quelle/Senke Verbunden
import multiDiGraph as gr import multiDiGraph as gr
nodes =['source','pump1','pump2','valveA','valveB','valveC'] nodes =['source','pump1','pump2','valveA','valveB','valveC']
graph = gr.construct_graph('source',('source','pump1',0.),('pump1','pump2',0.),('pump2','valveA',0.),('pump2','valveB',0.), graph = gr.construct_graph('source',('source','pump1',0.),('pump1','pump2',0.),('pump2','valveA',0.),('pump2','valveB',0.),
('pump1','valveC',0.),('valveA','source',4.),('valveB','source',4.),('valveC','source',4.)) ('pump1','valveC',0.),('valveA','source',4.),('valveB','source',4.),('valveC','source',4.))
#ist das notwendig?!? #ist das notwendig?!?
for node in graph.nodes: for node in graph.nodes:
#definieren der Drehzahl für jede Pumpe im graphen #definieren der Drehzahl für jede Pumpe im graphen
#inizieren des Durchflusses für jedes Ventil im Graphen #inizieren des Durchflusses für jedes Ventil im Graphen
if 'pump' in node: if 'pump' in node:
graph.nodes[node]['n']=750/3600 graph.nodes[node]['n']=750/3600
else: else:
graph.nodes[node]['n']=None graph.nodes[node]['n']=None
graph.nodes[node]['flow']=0. graph.nodes[node]['flow']=0.
if 'valve' in node: if 'valve' in node:
graph.nodes[node]['flow']= graph[node]['source'][0]['weight'] graph.nodes[node]['flow']= graph[node]['source'][0]['weight']
for node in graph.nodes: for node in graph.nodes:
#Berechnen des Durchflusses im Knoten #Berechnen des Durchflusses im Knoten
if 'valve' in node: if 'valve' in node:
continue continue
for inF in graph.predecessors(node): for inF in graph.predecessors(node):
graph.nodes[node]['flow'] += graph[inF][node][0]['weight'] graph.nodes[node]['flow'] += graph[inF][node][0]['weight']
#Berechnen des Durchflusses der abgehenden Kanten #Berechnen des Durchflusses der abgehenden Kanten
tempF=graph.nodes[node]['flow'] tempF=graph.nodes[node]['flow']
SC=0 SC=0
for outF in graph.successors(node): for outF in graph.successors(node):
if 'valve' in outF: if 'valve' in outF:
graph[node][outF][0]['weight']=graph.nodes[outF]['flow'] graph[node][outF][0]['weight']=graph.nodes[outF]['flow']
tempF=tempF - graph.nodes[outF]['flow'] tempF=tempF - graph.nodes[outF]['flow']
else: else:
SC+=1 SC+=1
for outF in graph.successors(node): for outF in graph.successors(node):
if SC!=0. and not'valve' in outF: if SC!=0. and not'valve' in outF:
graph[node][outF][0]['weight']=tempF/SC graph[node][outF][0]['weight']=tempF/SC
else:continue else:continue
``` ```
%% Output %% Output
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import networkx as nx import networkx as nx
Mtrx= nx.incidence_matrix(graph,nodes,oriented=True) Mtrx= nx.incidence_matrix(graph,nodes,oriented=True)
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import networkx as nx import networkx as nx
def create_dict(GR:nx.multidigraph): def create_dict(GR:nx.multidigraph):
data={None:{'nodes':{}, data={None:{'nodes':{},
'pumps':{}, 'pumps':{},
'valves':{}, 'valves':{},
} }
} }
for node in GR.nodes: for node in GR.nodes:
data[None]['nodes'][node]=None data[None]['nodes'][node]=None
data[None]['Q'][node]=GR.nodes[node]['flow'] data[None]['Q'][node]=GR.nodes[node]['flow']
if 'pump' in node: if 'pump' in node:
data[None]['pumps'][node]=None data[None]['pumps'][node]=None
data[None]['n'][node]=0. data[None]['n'][node]=0.
if 'valve' in node: if 'valve' in node:
data[None]['valves'][node]=None data[None]['valves'][node]=None
return data return data
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Durchfluss aus Incidenzmatrix beerechnen Durchfluss aus Incidenzmatrix beerechnen
$-l Q^2 = \alpha_1 Q^2+\alpha_2 Q n+\alpha_3 n^2$ $-l Q^2 = \alpha_1 Q^2+\alpha_2 Q n+\alpha_3 n^2$
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
#defining abstract modell for given Network #defining abstract modell for given Network
import pyomo.environ as pyo import pyomo.environ as pyo
from pyomo.dataportal import DataPortal
import numpy as np import numpy as np
from sklearn.linear_model import LinearRegression from sklearn.linear_model import LinearRegression
modell = pyo.AbstractModel() modell = pyo.AbstractModel()
#notwendige Mengen zur Berechnung der Constraints #notwendige Mengen zur Berechnung der Constraints
modell.nodes = pyo.Set() modell.nodes = pyo.Set()
modell.pumps = pyo.Set() modell.pumps = pyo.Set()
modell.valves = pyo.Set() modell.valves = pyo.Set()
modell.Q_valve=pyo.Param(modell.valves) modell.Q_valve=pyo.Param(modell.valves)
modell.Q = pyo.Param(modell.nodes)
#Optimierungsvariable #Optimierungsvariable
modell.n = pyo.Var(modell.pumps,bounds=(750/3600,1)) modell.n = pyo.Var(modell.pumps,bounds=(750/3600,1))
modell.Q = pyo.Var(modell.nodes,bounds=(0.,10.))
#expressions for constraints: #expressions for constraints:
def PumpFlow(modell,pump): def PumpFlow(modell,pump):
return pyo.summation(np.array([modell.Q[pump]**2, modell.n[pump]*modell.Q[pump], modell.n[pump]**2]),LR_H.coef_,index=[0,1,2]) return pyo.summation(np.array([modell.Q[pump]**2, modell.n[pump]*modell.Q[pump], modell.n[pump]**2]),LR_H.coef_,index=[0,1,2])
def Pump_delivery_req(modell,pump): def Pump_delivery_req(modell,pump):
return PumpFlow(modell,pump) ==pyo.summation(modell.Q,index=graph.successors(pump)) return PumpFlow(modell,pump) ==modell.Q[pump]
def valve_req_rule(modell,valve): def valve_req_rule(modell,valve):
return modell.Q[valve]>=modell.Q_valve[valve] return modell.Q[valve]>=modell.Q_valve[valve]
def continuity_inflow(modell,node): def continuity_inflow(modell,node):
return modell.Q[node]==pyo.summation(modell.Q, index=graph.successors(node)) return modell.Q[node]==pyo.summation(modell.Q, index=graph.successors(node))
def continuity_outflow(modell,node): def continuity_outflow(modell,node):
return modell.Q[node]==pyo.summation(modell.Q,index=graph.predecessors(node)) return modell.Q[node]==pyo.summation(modell.Q,index=graph.predecessors(node))
#Objective #Objective
def PumpPower(modell): def PumpPower(modell,pump):
return sum(np.dot( return pyo.summation(
np.array( np.array([modell.Q[pump]**3, (modell.Q[pump]**2)*modell.n[pump], modell.Q[pump]*modell.n[pump]**2, modell.n[pump]**3, 1.]),
[modell.Q[i]**3,(modell.Q[i]**2)*modell.n[i],modell.Q[i]*modell.n[i]**2,modell.n[i]**3] LR_P.coef_, index=[0,1,2,3,4])
),LR_P.coef_ modell.Power_Objective = pyo.Objective(modell.pumps,rule=PumpPower,sense=pyo.minimize)
) for i in modell.pumps)
modell.Power_Objective = pyo.Objective(rule=PumpPower,sense=pyo.minimize)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Frage: gibt es nur eine Lösung für Drehzahl? Frage: gibt es nur eine Lösung für Drehzahl?
Bsp. Optimierung nach Dezentraler Pumpe um modell zu prüfen Bsp. Optimierung nach Dezentraler Pumpe um modell zu prüfen
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from pyomo.opt import SolverFactory from pyomo.opt import SolverFactory
TestData={ TestData={
None:{ None:{
'nodes':[key for key in graph.nodes.keys()], 'nodes':[key for key in graph.nodes.keys()],
'pumps':[key for key in graph.nodes.keys() if 'pump' in key], 'pumps':[key for key in graph.nodes.keys() if 'pump' in key],
'valves':[key for key in graph.nodes.keys() if 'valve' in key], 'valves':[key for key in graph.nodes.keys() if 'valve' in key],
'Q_valve':{'valveA':1.,'valveB':1.,'valveC':1.}, 'Q':[graph.nodes[key]['flow']for key in graph.nodes.keys()]
} }
} }
print(TestData)
opt = pyo.SolverFactory('scipampl', executable=r'C:\Program Files\SCIPOptSuite 9.2.1\bin\scip.exe') opt = pyo.SolverFactory('scipampl', executable=r'C:\Program Files\SCIPOptSuite 9.2.1\bin\scip.exe')
instance = modell.create_instance(TestData) instance = modell.create_instance(TestData)
instance.Flow_constraint=pyo.Constraint(instance.valves,rule=valve_req_rule) #instance.Flow_constraint=pyo.Constraint(instance.valves,rule=valve_req_rule)
instance.pump_Flow_constraint=pyo.Constraint(instance.pumps,rule=Pump_delivery_req) instance.pump_Flow_constraint=pyo.Constraint(instance.pumps,rule=Pump_delivery_req)
#instance.flow_constraint=pyo.Constraint(instance.nodes,rule=continuity_inflow) #instance.flow_constraint=pyo.Constraint(instance.nodes,rule=continuity_inflow)
#instance.flow_constraint=pyo.Constraint(instance.nodes,rule=continuity_outflow) #instance.flow_constraint=pyo.Constraint(instance.nodes,rule=continuity_outflow)
result=opt.solve(instance, tee=True) result=opt.solve(instance, tee=True)
print(result) print(result)
instance.n.pprint() instance.n.pprint()
instance.Q.pprint() instance.Q.pprint()
``` ```
%% Output %% Output
SCIP version 9.2.1 [precision: 8 byte] [memory: block] [mode: optimized] [LP solver: Soplex 7.1.3] [GitHash: 0d2d3c7c2d] {None: {'nodes': ['source', 'pump1', 'pump2', 'valveA', 'valveB', 'valveC'], 'pumps': ['pump1', 'pump2'], 'valves': ['valveA', 'valveB', 'valveC'], 'Q': [12.0, 12.0, 8.0, 4.0, 4.0, 4.0]}}
Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB) WARNING: Failed to create solver with name 'scipampl': Failed to set
executable for solver asl. File with name=C:\Program Files\SCIPOptSuite
External libraries: 9.2.1\bin\scip.exe either does not exist or it is not executable. To skip this
Soplex 7.1.3 Linear Programming Solver developed at Zuse Institute Berlin (soplex.zib.de) [GitHash: 60fd96f2] validation, call set_executable with validate=False.
CppAD 20180000.0 Algorithmic Differentiation of C++ algorithms developed by B. Bell (github.com/coin-or/CppAD) Traceback (most recent call last):
TinyCThread 1.2 small portable implementation of the C11 threads API (tinycthread.github.io) File "C:\Users\Steinmann\AppData\Roaming\Python\Python312\site-packages\pyomo\opt\base\solvers.py", line 162, in __call__
MPIR 3.0.0 Multiple Precision Integers and Rationals Library developed by W. Hart (mpir.org) opt = self._cls[_implicit_solvers[mode]](**kwds)
ZIMPL 3.6.2 Zuse Institute Mathematical Programming Language developed by T. Koch (zimpl.zib.de) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AMPL/MP 690e9e7 AMPL .nl file reader library (github.com/ampl/mp) File "C:\Users\Steinmann\AppData\Roaming\Python\Python312\site-packages\pyomo\solvers\plugins\solvers\ASL.py", line 46, in __init__
PaPILO 2.4.1 parallel presolve for integer and linear optimization (github.com/scipopt/papilo) (built with TBB) [GitHash: 11974394] SystemCallSolver.__init__(self, **kwds)
Nauty 2.8.8 Computing Graph Automorphism Groups by Brendan D. McKay (users.cecs.anu.edu.au/~bdm/nauty) File "C:\Users\Steinmann\AppData\Roaming\Python\Python312\site-packages\pyomo\opt\solver\shellcmd.py", line 66, in __init__
sassy 1.1 Symmetry preprocessor by Markus Anders (github.com/markusa4/sassy) self.set_executable(name=executable, validate=validate)
Ipopt 3.14.16 Interior Point Optimizer developed by A. Waechter et.al. (github.com/coin-or/Ipopt) File "C:\Users\Steinmann\AppData\Roaming\Python\Python312\site-packages\pyomo\opt\solver\shellcmd.py", line 115, in set_executable
raise ValueError(
user parameter file <scip.set> not found - using default parameters ValueError: Failed to set executable for solver asl. File with name=C:\Program Files\SCIPOptSuite 9.2.1\bin\scip.exe either does not exist or it is not executable. To skip this validation, call set_executable with validate=False.
read problem <C:\Users\Victor\AppData\Local\Temp\tmpfcunk5gi.pyomo.nl> ERROR: Rule failed when initializing variable for Var Q with index None:
============ AssertionError:
ERROR: Constructing component 'Q' from data=[12.0, 12.0, 8.0, 4.0, 4.0, 4.0]
original problem has 8 variables (0 bin, 0 int, 0 impl, 8 cont) and 6 constraints failed:
AssertionError:
solve problem
============= ---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
presolving: Cell In[21], line 14
(round 1, fast) 0 del vars, 3 del conss, 0 add conss, 11 chg bounds, 0 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 0 clqs 12 print(TestData)
(0.0s) symmetry computation started: requiring (bin +, int +, cont +), (fixed: bin -, int -, cont -) 13 opt = pyo.SolverFactory('scipampl', executable=r'C:\Program Files\SCIPOptSuite 9.2.1\bin\scip.exe')
(0.0s) symmetry computation finished: 1 generators found (max: 1500, log10 of symmetry group size: 0.0) (symcode time: 0.00) ---> 14 instance = modell.create_instance(TestData)
dynamic symmetry handling statistics: 15 instance.Flow_constraint=pyo.Constraint(instance.valves,rule=valve_req_rule)
orbitopal reduction: no components 16 instance.pump_Flow_constraint=pyo.Constraint(instance.pumps,rule=Pump_delivery_req)
orbital reduction: no components File ~\AppData\Roaming\Python\Python312\site-packages\pyomo\core\base\PyomoModel.py:734, in Model.create_instance(self, filename, data, name, namespace, namespaces, profile_memory, report_timing, **kwds)
lexicographic reduction: no permutations 731 if None not in _namespaces:
handled 1 out of 1 symmetry components 732 _namespaces.append(None)
(round 2, exhaustive) 0 del vars, 3 del conss, 1 add conss, 11 chg bounds, 0 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 0 clqs --> 734 instance.load(data, namespaces=_namespaces, profile_memory=profile_memory)
presolving (3 rounds: 3 fast, 2 medium, 2 exhaustive): 736 #
0 deleted vars, 3 deleted constraints, 0 added constraints, 11 tightened bounds, 0 added holes, 0 changed sides, 0 changed coefficients 737 # Indicate that the model is concrete/constructed
0 implications, 0 cliques 738 #
presolved problem has 8 variables (0 bin, 0 int, 0 impl, 8 cont) and 4 constraints 739 instance._constructed = True
1 constraints of type <linear> File ~\AppData\Roaming\Python\Python312\site-packages\pyomo\core\base\PyomoModel.py:771, in Model.load(self, arg, namespaces, profile_memory)
3 constraints of type <nonlinear> 769 msg = "Cannot load model model data from with object of type '%s'"
Presolving Time: 0.00 770 raise ValueError(msg % str(type(arg)))
--> 771 self._load_model_data(dp, namespaces, profile_memory=profile_memory)
time | node | left |LP iter|LP it/n|mem/heur|mdpt |vars |cons |rows |cuts |sepa|confs|strbr| dualbound | primalbound | gap | compl. File ~\AppData\Roaming\Python\Python312\site-packages\pyomo\core\base\PyomoModel.py:823, in Model._load_model_data(self, modeldata, namespaces, **kwds)
0.0s| 1 | 0 | 22 | - | 914k | 0 | 25 | 4 | 36 | 0 | 0 | 0 | 0 |-3.474607e+01 | -- | Inf | unknown 820 if component.ctype is Model:
L 0.0s| 1 | 0 | 22 | - | subnlp| 0 | 25 | 4 | 36 | 0 | 0 | 0 | 0 |-3.474607e+01 | 1.151406e+01 | Inf | unknown 821 continue
0.0s| 1 | 0 | 22 | - | 914k | 0 | 25 | 4 | 36 | 0 | 0 | 0 | 0 |-3.474607e+01 | 1.151406e+01 | Inf | unknown --> 823 self._initialize_component(
0.0s| 1 | 0 | 22 | - | 914k | 0 | 25 | 4 | 36 | 0 | 0 | 0 | 0 |-3.474607e+01 | 1.151406e+01 | Inf | unknown 824 modeldata, namespaces, component_name, profile_memory
0.0s| 1 | 0 | 26 | - | 920k | 0 | 25 | 4 | 39 | 3 | 1 | 0 | 0 |-1.963132e+01 | 1.151406e+01 | Inf | unknown 825 )
0.0s| 1 | 0 | 26 | - | 920k | 0 | 25 | 4 | 39 | 3 | 1 | 0 | 0 |-1.963132e+01 | 1.151406e+01 | Inf | unknown 827 # Note: As is, connectors are expanded when using command-line pyomo but not calling model.create(...) in a Python script.
0.0s| 1 | 0 | 30 | - | 935k | 0 | 25 | 4 | 42 | 6 | 2 | 0 | 0 |-1.885311e+01 | 1.151406e+01 | Inf | unknown 828 # John says this has to do with extension points which are called from commandline but not when writing scripts.
0.0s| 1 | 0 | 33 | - | 939k | 0 | 25 | 4 | 45 | 9 | 3 | 0 | 0 |-1.766937e+01 | 1.151406e+01 | Inf | unknown 829 # Uncommenting the next two lines switches this (command-line fails because it tries to expand connectors twice)
0.0s| 1 | 0 | 33 | - | 939k | 0 | 25 | 4 | 45 | 9 | 3 | 0 | 0 |-1.766937e+01 | 1.151406e+01 | Inf | unknown 830 # connector_expander = ConnectorExpander()
0.0s| 1 | 0 | 36 | - | 939k | 0 | 25 | 4 | 47 | 11 | 4 | 0 | 0 |-1.728948e+01 | 1.151406e+01 | Inf | unknown 831 # connector_expander.apply(instance=self)
0.0s| 1 | 0 | 37 | - | 941k | 0 | 25 | 4 | 48 | 12 | 5 | 0 | 0 |-1.712829e+01 | 1.151406e+01 | Inf | unknown 833 if profile_memory >= 2 and pympler_available:
0.0s| 1 | 0 | 38 | - | 941k | 0 | 25 | 4 | 49 | 13 | 6 | 0 | 0 |-1.701866e+01 | 1.151406e+01 | Inf | unknown File ~\AppData\Roaming\Python\Python312\site-packages\pyomo\core\base\PyomoModel.py:871, in Model._initialize_component(self, modeldata, namespaces, component_name, profile_memory)
0.0s| 1 | 0 | 39 | - | 943k | 0 | 25 | 4 | 50 | 14 | 7 | 0 | 0 |-1.701746e+01 | 1.151406e+01 | Inf | unknown 863 logger.debug(
0.0s| 1 | 0 | 41 | - | 951k | 0 | 25 | 4 | 52 | 16 | 8 | 0 | 0 |-1.695801e+01 | 1.151406e+01 | Inf | unknown 864 "Constructing %s '%s' on %s from data=%s",
0.0s| 1 | 0 | 332 | - | 957k | 0 | 25 | 4 | 52 | 16 | 9 | 0 | 0 | 1.150982e+01 | 1.151406e+01 | 0.04%| unknown 865 declaration.__class__.__name__,
time | node | left |LP iter|LP it/n|mem/heur|mdpt |vars |cons |rows |cuts |sepa|confs|strbr| dualbound | primalbound | gap | compl. (...)
0.0s| 1 | 0 | 334 | - | 957k | 0 | 25 | 4 | 54 | 18 | 10 | 0 | 0 | 1.150982e+01 | 1.151406e+01 | 0.04%| unknown 868 str(data),
0.0s| 1 | 0 | 346 | - | 957k | 0 | 25 | 4 | 37 | 20 | 11 | 0 | 0 | 1.151405e+01 | 1.151406e+01 | 0.00%| unknown 869 )
0.0s| 1 | 0 | 346 | - | 957k | 0 | 25 | 4 | 20 | 20 | 11 | 0 | 0 | 1.151405e+01 | 1.151406e+01 | 0.00%| unknown 870 try:
0.0s| 1 | 0 | 347 | - | 957k | 0 | 25 | 4 | 21 | 21 | 12 | 0 | 0 | 1.151406e+01 | 1.151406e+01 | 0.00%| unknown --> 871 declaration.construct(data)
L 0.0s| 1 | 0 | 347 | - | subnlp| 0 | 25 | 4 | 21 | 21 | 13 | 0 | 0 | 1.151406e+01 | 1.151406e+01 | 0.00%| unknown 872 except:
0.0s| 1 | 0 | 347 | - | 958k | 0 | 25 | 4 | 21 | 21 | 13 | 0 | 0 | 1.151406e+01 | 1.151406e+01 | 0.00%| unknown 873 err = sys.exc_info()[1]
* 0.0s| 1 | 0 | 347 | - | LP | 0 | 25 | 4 | 21 | 21 | 14 | 0 | 0 | 1.151406e+01 | 1.151406e+01 | 0.00%| unknown File ~\AppData\Roaming\Python\Python312\site-packages\pyomo\core\base\var.py:735, in Var.construct(self, data)
732 index = None
SCIP Status : problem is solved [optimal solution found] 733 try:
Solving Time (sec) : 0.00 734 # We do not (currently) accept data for constructing Variables
Solving Nodes : 1 --> 735 assert data is None
Primal Bound : +1.15140564709997e+01 (3 solutions) 737 if not self.index_set().isfinite() and self._dense:
Dual Bound : +1.15140564709997e+01 738 # Note: if the index is not finite, then we cannot
Gap : 0.00 % 739 # iterate over it. This used to be fatal; now we
740 # just warn
Problem: 741 logger.warning(
- Lower bound: -inf 742 "Var '%s' indexed by a non-finite set, but declared "
Upper bound: inf 743 "with 'dense=True'. Reverting to 'dense=False' as "
Number of objectives: 1 (...)
Number of constraints: 0 746 "'dense=False'" % (self.name,)
Number of variables: 7 747 )
Sense: unknown AssertionError:
Solver:
- Status: ok
Message: optimal solution found
Termination condition: optimal
Id: 0
Error rc: 0
Time: 0.3383963108062744
Solution:
- number of solutions: 0
number of solutions displayed: 0
n : Size=2, Index=pumps
Key : Lower : Value : Upper : Fixed : Stale : Domain
pump1 : 0.20833333333333334 : 0.34519801810114614 : 1 : False : False : Reals
pump2 : 0.20833333333333334 : 0.4881837415314729 : 1 : False : False : Reals
Q : Size=6, Index=nodes
Key : Lower : Value : Upper : Fixed : Stale : Domain
pump1 : 0.0 : 0.0 : 10.0 : False : False : Reals
pump2 : 0.0 : 0.0 : 10.0 : False : False : Reals
source : 0.0 : None : 10.0 : False : True : Reals
valveA : 0.0 : 1.0 : 10.0 : False : False : Reals
valveB : 0.0 : 1.0 : 10.0 : False : False : Reals
valveC : 0.0 : 1.0 : 10.0 : False : False : Reals
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment