Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Timo Winklbauer
Test Voila
Commits
0dbd4d68
Commit
0dbd4d68
authored
Oct 15, 2021
by
Timo Winklbauer
Browse files
Upload New File
parent
05d3f0a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Voilatest.ipynb
0 → 100644
View file @
0dbd4d68
%% Cell type:code id:2be7bb71 tags:
```
python
import
ipywidgets
as
widgets
import
pandas
as
pd
import
numpy
as
np
import
copy
import
sympy
as
sp
from
sympy
import
sympify
import
ipysheet
from
ipysheet
import
sheet
,
cell
from
ipysheet
import
column
,
row
M
=
sp
.
symbols
(
'M'
)
```
%% Cell type:code id:19d328c7 tags:
```
python
def
get_pivotzeile
(
copy_tableau
,
pivot_spalte
):
# soll original Tableau nicht ändern
copy_tableau
=
copy
.
deepcopy
(
copy_tableau
)
# wähle Ressourcenverbrauchskoeffizienten der Pivotspalte
pivot_spalte_values
=
copy_tableau
.
iloc
[
copy_tableau
.
index
.
difference
([
0
,
1
,
(
anzahl_zeilen
-
1
),
(
anzahl_zeilen
-
2
)]),
pivot_spalte
]
# wähle Menge der Restriktionen
quantity
=
copy_tableau
.
iloc
[
copy_tableau
.
index
.
difference
([
0
,
1
,
(
anzahl_zeilen
-
1
),
(
anzahl_zeilen
-
2
)]),
2
]
#verhinden von teilen durch negative Zahlen und 0
pivot_spalte_values
.
mask
(
pivot_spalte_values
<=
0
,
np
.
nan
,
inplace
=
True
)
#Hilfsmatrix zum ermitteln der Pivotspalte
copy_tableau
=
quantity
/
pivot_spalte_values
#übergabe der Zeilenid mit dem kleinsten Wert
return
copy_tableau
.
astype
(
float
).
idxmin
(
skipna
=
True
)
def
get_pivotspalte
(
copy_tableau
,
symbol
):
# soll original Tableau nicht ändern
copy_tableau
=
copy
.
deepcopy
(
copy_tableau
)
#Schleife über alle Spalten
for
column
in
copy_tableau
:
#nur Zeilen mit Ressourcenverbrauchskoeffizienten werden angesehen
if
column
!=
0
and
column
!=
1
and
column
!=
2
:
#zum Berechnen der größten cj-zj Zeile muss wenn nötig M durch ansatzweise unendlich ersetzt werden
if
isinstance
(
tableau
.
iloc
[
-
1
,
column
],
sp
.
Basic
):
# Filtern der Felder mit M
copy_tableau
.
iloc
[
-
1
,
column
]
=
copy_tableau
.
iloc
[
-
1
,
column
].
subs
(
M
,
9999
)
copy_tableau
.
iloc
[
-
1
,
column
]
=
int
(
copy_tableau
.
iloc
[
-
1
,
column
])
#bestimmen des Spaltenid, welche den größten Wert enthält
pivot_spalte
=
copy_tableau
.
iloc
[
-
1
,
3
:].
astype
(
float
).
idxmax
(
axis
=
0
)
return
pivot_spalte
#-----------------------------------------------------------------------------
def
update_simplex_tableau
(
copy_tableau
,
pivot_zeile
,
pivot_spalte
):
#Pivotelelement wird auf Wert 1 gebracht indem man die Zeile durch das Pivotelement teilt
copy_tableau
.
iloc
[
pivot_zeile
,
2
:]
=
copy_tableau
.
iloc
[
pivot_zeile
,
2
:]
/
copy_tableau
.
iloc
[
pivot_zeile
,
pivot_spalte
]
#neue Basisvariable wird durch alte getauscht
copy_tableau
=
update_pivotzeile
(
copy_tableau
,
pivot_zeile
,
pivot_spalte
)
#aktualisiere die restlichen Restritkionsmengen und die Ressourenverbrauchskoeffizienten
copy_tableau
=
update_basis_variables
(
copy_tableau
,
pivot_zeile
,
pivot_spalte
)
return
copy_tableau
def
update_pivotzeile
(
copy_tableau
,
alte_basis_var
,
neue_basis_var
):
#aktualisiere den cj Wert der neuen Basisvariable
copy_tableau
.
iloc
[
alte_basis_var
,
0
]
=
copy_tableau
.
iloc
[
0
,
neue_basis_var
]
#aktualisiere den Namen der neuen Basisvariable
copy_tableau
.
iloc
[
alte_basis_var
,
1
]
=
copy_tableau
.
iloc
[
1
,
neue_basis_var
]
return
copy_tableau
def
update_basis_variables
(
copy_tableau
,
pivot_zeile
,
pivot_spalte
):
for
index
in
copy_tableau
.
index
:
#wähle jede Zeile der gleich bleibenden Basisvariablen und bringen die Pivotspalte auf 0
if
index
!=
pivot_zeile
and
index
!=
0
and
index
!=
1
and
index
!=
anzahl_zeilen
-
1
and
index
!=
anzahl_zeilen
-
2
:
copy_tableau
.
iloc
[
index
,
copy_tableau
.
columns
.
difference
([
0
,
1
],
sort
=
False
)]
=
copy_tableau
.
iloc
[
index
,
copy_tableau
.
columns
.
difference
([
0
,
1
],
sort
=
False
)]
-
((
copy_tableau
.
iloc
[
pivot_zeile
,
copy_tableau
.
columns
.
difference
([
0
,
1
],
sort
=
False
)]
*
copy_tableau
.
iloc
[
index
,
pivot_spalte
]))
#print(type(pd.to_numeric(copy_tableau.iloc[index, copy_tableau.columns.difference([0, 1], sort=False)], downcast="float")))
#print(copy_tableau.iloc[index, copy_tableau.columns.difference([0, 1], sort=False)])
return
copy_tableau
#----------------------------------------------------------------------------
def
get_cj_zj
(
copy_tableau
):
#print(anzahl_zeilen)
anzahl_zeilen
=
len
(
copy_tableau
.
index
)
#berechne Zeile zj
for
column
in
range
(
0
,
len
(
copy_tableau
.
columns
)):
#print(column)
if
column
!=
0
and
column
!=
1
:
cj_basisvar
=
copy_tableau
.
iloc
[
copy_tableau
.
index
.
difference
([
0
,
1
,
anzahl_zeilen
-
1
,
anzahl_zeilen
-
2
],
sort
=
False
),
0
]
restr_var
=
copy_tableau
.
iloc
[
copy_tableau
.
index
.
difference
([
0
,
1
,
anzahl_zeilen
-
1
,
anzahl_zeilen
-
2
],
sort
=
False
),
column
]
temp
=
cj_basisvar
*
restr_var
#print(temp)
copy_tableau
.
iloc
[
-
2
,
column
]
=
temp
.
sum
()
#berechne Zeile cj-zj
copy_tableau
.
iloc
[
-
1
,
copy_tableau
.
columns
.
difference
([
0
,
1
,
2
],
sort
=
False
)]
=
copy_tableau
.
iloc
[
0
,
copy_tableau
.
columns
.
difference
([
0
,
1
,
2
],
sort
=
False
)]
-
copy_tableau
.
iloc
[
-
2
,
copy_tableau
.
columns
.
difference
([
0
,
1
,
2
],
sort
=
False
)]
return
copy_tableau
#Berechne maximalen cj-zj Wert
def
get_max_cj_zj
(
copy_tableau
):
copy_tableau
=
copy
.
deepcopy
(
copy_tableau
)
for
column
in
copy_tableau
:
if
column
!=
0
and
column
!=
1
and
column
!=
2
:
if
isinstance
(
tableau
.
iloc
[
-
1
,
column
],
sp
.
Basic
):
copy_tableau
.
iloc
[
-
1
,
column
]
=
copy_tableau
.
iloc
[
-
1
,
column
].
subs
(
M
,
9999
)
copy_tableau
.
iloc
[
-
1
,
column
]
=
int
(
copy_tableau
.
iloc
[
-
1
,
column
])
max_value
=
copy_tableau
.
iloc
[
-
1
,
3
:].
astype
(
float
).
max
(
axis
=
0
)
return
max_value
#Prüfe auf Ausführbarkeit
def
check_infeasibility
(
last_tableau
,
liste_meldungen
,
finished
):
#Wenn in der finalen Lösungsmenge ein M ist, ist auch eine künstliche Variable in der Lösung
#prüfe ob M vorhanden ist und ob eine Lösung gefunden wurde
if
isinstance
(
last_tableau
.
iloc
[
-
2
,
2
],
sp
.
Basic
)
and
finished
:
liste_meldungen
.
append
(
"Spezialfall: Unausführbarkeit (Infeasibility) -> Falls ein optimales Tableau eine künstliche Variable enthält, ist das Problem unlösbar („infeasible“)."
)
#Prüfe auf unbeschraenkten Lösungsraum
def
check_unbeschraenkter_loesungsraum
(
check
,
liste_meldungen
):
#Wenn die Pivotzeile keine Zahl enthält wurde konnte kein Wert berechnet werden
if
np
.
isnan
(
check
):
liste_meldungen
.
append
(
"Spezialfall: Unbeschränkter Lösungsraum -> keine zulässige Pivotzeile => Lösungsraum unbeschränkt."
)
return
True
else
:
return
False
def
on_value_change
(
change
):
with
output
:
#Leere Anzeigebereich
output
.
clear_output
()
#Ausgabe x.Tableau
display
(
widgets
.
Label
(
value
=
str
(
change
[
'new'
]
+
1
)
+
".Tableau"
))
#Ausgabe Tableau
display
(
list_tableaus
[
change
[
'new'
]].
style
.
hide_index
().
hide_columns
())
#Alle zum Tableau gehörigen Meldungen werden ausgegeben
for
message
in
range
(
len
(
Meldungen
[
change
[
'new'
]])):
display
(
widgets
.
Label
(
value
=
Meldungen
[
change
[
'new'
]][
message
]))
```
%% Cell type:code id:9c33fd3e tags:
```
python
out
=
widgets
.
Output
()
anz_restriktionen
=
widgets
.
Dropdown
(
options
=
list
(
map
(
str
,
range
(
0
,
6
))),
value
=
'0'
,
description
=
'Restriktionen:'
,
disabled
=
False
,
)
anz_var
=
widgets
.
Dropdown
(
options
=
list
(
map
(
str
,
range
(
1
,
6
))),
value
=
'1'
,
description
=
'echte Variablen:'
,
disabled
=
False
,
)
anz_schlupf_var
=
widgets
.
Dropdown
(
options
=
list
(
map
(
str
,
range
(
0
,
6
))),
value
=
'0'
,
description
=
'Schlupfvariablen:'
,
disabled
=
False
,
)
anz_kuenstl_var
=
widgets
.
Dropdown
(
options
=
list
(
map
(
str
,
range
(
0
,
6
))),
value
=
'0'
,
description
=
'künstliche Variablen:'
,
disabled
=
False
,
)
sum_var
=
int
(
anz_var
.
value
)
+
int
(
anz_schlupf_var
.
value
)
+
int
(
anz_kuenstl_var
.
value
)
button
=
widgets
.
Button
(
description
=
"Erzeuge Eingabetableau!"
)
def
on_restr_change
(
change
):
with
out
:
if
change
[
'new'
]
!=
'0'
:
anz_var
.
options
=
list
(
map
(
str
,
range
(
1
,
int
(
change
[
'new'
])
+
1
,)))
anz_schlupf_var
.
options
=
list
(
map
(
str
,
range
(
0
,
int
(
change
[
'new'
])
+
1
)))
anz_kuenstl_var
.
options
=
list
(
map
(
str
,
range
(
0
,
int
(
change
[
'new'
])
+
1
)))
anz_var
.
layout
.
visibility
=
"visible"
anz_schlupf_var
.
layout
.
visibility
=
"visible"
anz_kuenstl_var
.
layout
.
visibility
=
"visible"
button
.
layout
.
visibility
=
"visible"
else
:
anz_var
.
layout
.
visibility
=
"hidden"
anz_schlupf_var
.
layout
.
visibility
=
"hidden"
anz_kuenstl_var
.
layout
.
visibility
=
"hidden"
def
create_tableau
(
button
):
print
(
"Hat geklappt"
)
anz_restriktionen
.
observe
(
on_restr_change
,
names
=
'value'
)
button
.
on_click
(
create_tableau
)
display
(
out
)
anz_restriktionen
.
layout
.
visibility
=
"visible"
anz_var
.
layout
.
visibility
=
"hidden"
anz_schlupf_var
.
layout
.
visibility
=
"hidden"
anz_kuenstl_var
.
layout
.
visibility
=
"hidden"
button
.
layout
.
visibility
=
"hidden"
with
out
:
display
(
anz_restriktionen
)
display
(
anz_var
)
display
(
anz_schlupf_var
)
display
(
anz_kuenstl_var
)
display
(
button
)
```
%%%% Output: display_data
%% Cell type:code id:0a7ed254 tags:
```
python
list_var
=
[]
sum_var
=
int
(
anz_var
.
value
)
+
int
(
anz_schlupf_var
.
value
)
+
int
(
anz_kuenstl_var
.
value
)
spalte
=
3
reihe_basis_var
=
2
input_table
=
ipysheet
.
sheet
(
rows
=
2
+
float
(
anz_restriktionen
.
value
),
columns
=
sum_var
+
3
,
row_headers
=
False
,
column_headers
=
False
)
M
=
sp
.
symbols
(
'M'
)
tableau
=
"globale Variable"
def
start_simplex
(
button
):
copy_tableau
=
ipysheet
.
to_dataframe
(
input_table
)
copy_tableau
=
copy_tableau
.
apply
(
pd
.
to_numeric
,
errors
=
'ignore'
,
downcast
=
'float'
)
copy_tableau
.
columns
=
range
(
0
,
sum_var
+
3
)
cj
=
[]
cj_zj
=
[]
for
column
in
range
(
0
,
len
(
copy_tableau
.
columns
)):
if
column
==
0
:
cj
.
append
(
np
.
nan
)
cj_zj
.
append
(
np
.
nan
)
elif
column
==
1
:
cj
.
append
(
"cj"
)
cj_zj
.
append
(
"cj-zj"
)
elif
column
==
2
:
cj
.
append
(
0
)
cj_zj
.
append
(
np
.
nan
)
else
:
cj
.
append
(
0
)
cj_zj
.
append
(
0
)
copy_tableau
.
loc
[
len
(
copy_tableau
.
index
)]
=
cj
copy_tableau
.
loc
[
len
(
copy_tableau
.
index
)]
=
cj_zj
copy_tableau
.
replace
(
'-M'
,
-
M
,
inplace
=
True
)
for
row
in
copy_tableau
.
index
:
for
column
in
copy_tableau
.
columns
:
try
:
copy_tableau
.
loc
[
row
][
column
]
=
int
(
copy_tableau
.
loc
[
row
][
column
])
except
Exception
:
pass
get_cj_zj
(
copy_tableau
)
global
tableau
tableau
=
copy_tableau
print
(
copy_tableau
)
def
update_table
(
table
):
input_table
=
table
[
'new'
]
for
row
in
range
(
0
,
input_table
.
rows
):
for
column
in
range
(
0
,
input_table
.
columns
):
cell
(
row
,
column
,
"..."
,
background_color
=
'yellow'
).
observe
(
update_table
)
cell
(
0
,
0
,
""
,
read_only
=
True
,
background_color
=
'grey'
)
cell
(
0
,
1
,
""
,
read_only
=
True
,
background_color
=
'grey'
)
cell
(
0
,
2
,
""
,
read_only
=
True
,
background_color
=
'grey'
)
#Befülle Reihe mit Beschreibung
cell
(
1
,
0
,
"cj"
,
read_only
=
True
,
font_weight
=
'bold'
,
background_color
=
"white"
)
cell
(
1
,
1
,
"Basisvariable"
,
read_only
=
True
,
font_weight
=
'bold'
,
background_color
=
"white"
)
cell
(
1
,
2
,
"Quantity"
,
read_only
=
True
,
font_weight
=
'bold'
,
background_color
=
"white"
)
for
anz
in
range
(
1
,
int
(
anz_var
.
value
)
+
1
):
var_name
=
"x"
+
str
(
anz
)
list_var
.
append
(
cell
(
1
,
spalte
,
var_name
,
ready_only
=
True
,
font_weight
=
'bold'
,
background_color
=
"white"
))
spalte
+=
1
for
anz
in
range
(
1
,
int
(
anz_schlupf_var
.
value
)
+
1
):
var_name
=
"s"
+
str
(
anz
)
cell
(
0
,
spalte
,
0
,
read_only
=
True
,
background_color
=
"white"
)
list_var
.
append
(
cell
(
1
,
spalte
,
var_name
,
read_only
=
True
,
font_weight
=
'bold'
,
background_color
=
"white"
))
spalte
+=
1
for
anz
in
range
(
1
,
int
(
anz_kuenstl_var
.
value
)
+
1
):
cell
(
0
,
spalte
,
"-M"
,
read_only
=
True
,
background_color
=
"white"
)
var_name
=
"a"
+
str
(
anz
)
list_var
.
append
(
cell
(
1
,
spalte
,
var_name
,
read_only
=
True
,
font_weight
=
'bold'
,
background_color
=
"white"
))
spalte
+=
1
start_basisvar
=
list_var
[(
len
(
list_var
)
-
int
(
anz_restriktionen
.
value
)):]
start_basisvar
.
sort
(
key
=
lambda
x
:
x
.
value
)
for
row
in
range
(
2
,
input_table
.
rows
):
cell
(
row
,
1
,
start_basisvar
[
row
-
2
].
value
,
read_only
=
True
,
font_weight
=
'bold'
,
background_color
=
"white"
)
#cell(row, start_basisvar[row-2].column, 1 )
if
"a"
in
start_basisvar
[
row
-
2
].
value
:
cell
(
row
,
0
,
'-M'
,
read_only
=
True
,
background_color
=
"white"
)
if
"s"
in
start_basisvar
[
row
-
2
].
value
:
cell
(
row
,
0
,
0
,
read_only
=
True
,
background_color
=
"white"
)
#if "x" in start_basisvar[row-2].value:
display
(
input_table
)
simplex_start
=
widgets
.
Button
(
description
=
"Starte Simplex"
)
display
(
simplex_start
)
simplex_start
.
on_click
(
start_simplex
)
# example
#0 300 200 0 0 -M -M
#1 cj Basisvariable Quantity x1 x2 s1 s2 a1 a2
#2 -M a1 60 2 2 0 0 1 0
#3 -M a2 80 2 8 -1 0 0 1
#4 0 s2 40 1 0 0 1 0 0
#5 NaN cj -140*M -4*M -10*M M 0 -M -M
#6 NaN cj-zj NaN 4*M + 300 10*M + 200 -M 0 0 0
```
%%%% Output: display_data
%%%% Output: display_data
%% Cell type:code id:a6201ceb tags:
```
python
# wird benutzt um cj von künstlichen Variablen zu berechnen
M
=
sp
.
symbols
(
'M'
)
# NumPy-Array erstellen
#data = np.array([[np.nan, np.nan, np.nan, 5, 4, 0, -M],
# ["cj","Basisvariable", "Quantity", "x1", "x2", "s1", "a1"],
# [0, "s1",120, 3, 4, 1, 0],
# [0,"a1", 40, 2, 1, 0, 1],
# [np.nan,"zj", 0, 0, 0, 0, 0],
# [np.nan,"cj-zj", np.nan, 5, 4, 0, -M]] )
#Matrix welche die Standardform des Simplex Algorithmuses enthält
data
=
np
.
array
([[
np
.
nan
,
np
.
nan
,
np
.
nan
,
300
,
200
,
0
,
0
,
-
M
,
-
M
],
[
"cj"
,
"Basisvariable"
,
"Quantity"
,
"x1"
,
"x2"
,
"s1"
,
"s2"
,
"a1"
,
"a2"
],
[
-
M
,
"a1"
,
60
,
2
,
2
,
0
,
0
,
1
,
0
],
[
-
M
,
"a2"
,
80
,
2
,
8
,
-
1
,
0
,
0
,
1
],
[
0
,
"s2"
,
40
,
1
,
0
,
0
,
1
,
0
,
0
],
[
np
.
nan
,
"zj"
,
-
140
*
M
,
-
4
*
M
,
-
10
*
M
,
M
,
0
,
-
M
,
-
M
],
[
np
.
nan
,
"cj-zj"
,
np
.
nan
,
300
+
4
*
M
,
200
+
10
*
M
,
-
M
,
0
,
0
,
0
]]
)
#überführen in ein anderes Format (mehr Möglichkeiten)
tableau
=
pd
.
DataFrame
(
data
=
data
)
print
(
tableau
)
```
%%%% Output: stream
0 1 2 3 4 5 6 7 8
0 NaN NaN NaN 300 200 0 0 -M -M
1 cj Basisvariable Quantity x1 x2 s1 s2 a1 a2
2 -M a1 60 2 2 0 0 1 0
3 -M a2 80 2 8 -1 0 0 1
4 0 s2 40 1 0 0 1 0 0
5 NaN zj -140*M -4*M -10*M M 0 -M -M
6 NaN cj-zj NaN 4*M + 300 10*M + 200 -M 0 0 0
%% Cell type:code id:8eda1a9a tags:
```
python
anzahl_zeilen
=
len
(
tableau
.
index
)
counter
=
0
#Zähler für die Anzahl an Iterationen bis abgebrochen wird
counter_limit
=
10
#Limit das der Zähler erreichen darf
list_tableaus
=
[
copy
.
deepcopy
(
tableau
.
fillna
(
''
))]
# Anfangstableau wird in eine liste kopiert
Meldungen
=
[]
# Liste für die Fehlermeldung wird erzeugt
ende
=
False
#Überprüfung ob der Simplex ein Ergebnis gefunden hat
#Solange cj-zj noch einen positiven Wert hat, wird der Simplex Algorithmus ausgeführt
while
get_max_cj_zj
(
tableau
)
>
0
:
Meldungen
.
append
([])
#erzeuge eine Liste für Meldunge (bezieht sich auf vorheriges Tableau)
Pivotspalte
=
get_pivotspalte
(
tableau
,
M
)
Pivotzeile
=
get_pivotzeile
(
tableau
,
Pivotspalte
)
if
check_unbeschraenkter_loesungsraum
(
Pivotzeile
,
Meldungen
[
counter
]):
#wenn der Lösungsraum unbeschränkt ist, wird abgebrochen
break
update_simplex_tableau
(
tableau
,
Pivotzeile
,
Pivotspalte
)
tableau
=
get_cj_zj
(
tableau
)
tableau
=
tableau
.
fillna
(
''
)
#alle unnötigen Felder werden geleert
list_tableaus
.
append
(
copy
.
deepcopy
(
tableau
))
#füge das neue Tableau wieder in die Liste hinzu
counter
+=
1
if
counter
==
counter_limit
:
break
if
get_max_cj_zj
(
tableau
)
<=
0
:
#Überprüfung ob ein Ergebnis gefunden wurde
ende
=
True
#Meldungen für das letzte Tableau
Meldungen
.
append
([])
# kontrolliere Lösbarkeit
check_infeasibility
(
list_tableaus
[
-
1
],
Meldungen
[
-
1
],
ende
)
#for iteration in range(len(list_tableaus)):
# print(list_tableaus[iteration])
# print("")
# for auswahl in range(len(Meldungen[iteration])):
# print(Meldungen[iteration][auswahl])
```
%% Cell type:code id:1226e84c tags:
```
python
#Erzeuge Anzeigefeld
output
=
widgets
.
Output
()
#Erzeuge Widgets
slider
=
widgets
.
IntSlider
(
value
=
0
,
min
=
0
,
max
=
len
(
list_tableaus
)
-
1
,
step
=
1
,
description
=
'Iteration:'
,
disabled
=
False
,
continuous_update
=
True
,
orientation
=
'horizontal'
,
readout
=
True
,
readout_format
=
'd'
)
#Display Widgets
display
(
output
)
display
(
slider
)
#Befülle Anzeigefeld
with
output
:
#Definiere Anfangsausgabe
display
(
widgets
.
Label
(
value
=
"1.Tableau"
))
display
(
list_tableaus
[
0
].
style
.
hide_index
().
hide_columns
())
for
message
in
range
(
len
(
Meldungen
[
0
])):
display
(
widgets
.
Label
(
value
=
Meldungen
[
0
][
message
]))
#Control Changes on Widget
#Wird nur bei Änderung des Sliders ausgeführt
def
on_value_change
(
change
):
with
output
:
#Leere Anzeigebereich
output
.
clear_output
()
#Ausgabe x.Tableau
display
(
widgets
.
Label
(
value
=
str
(
change
[
'new'
])
+
".Tableau"
))
#Ausgabe Tableau
display
(
list_tableaus
[
change
[
'new'
]].
style
.
hide_index
().
hide_columns
())
#Alle zum Tableau gehörigen Meldungen werden ausgegeben
for
message
in
range
(
len
(
Meldungen
[
change
[
'new'
]])):
display
(
widgets
.
Label
(
value
=
Meldungen
[
change
[
'new'
]][
message
]))
#ändere Ausgabe mit dem Slider
slider
.
observe
(
on_value_change
,
names
=
'value'
)
#widgets.interact(on_value_change, slider, message_list, tableau_list )
```
%%%% Output: display_data
%%%% Output: display_data
%% Cell type:code id:aaf209ad tags:
```
python
```
%%%% Output: stream
Collecting voila
Using cached voila-0.2.16-py3-none-any.whl (1.6 MB)
Requirement already satisfied: nbconvert<7,>=6.0.0 in c:\users\timo\anaconda3\lib\site-packages (from voila) (6.1.0)
Requirement already satisfied: nbclient<0.6,>=0.4.0 in c:\users\timo\anaconda3\lib\site-packages (from voila) (0.5.3)
Requirement already satisfied: jupyter-server<2.0.0,>=0.3.0 in c:\users\timo\appdata\roaming\python\python38\site-packages (from voila) (1.11.0)
Requirement already satisfied: jupyter-client<7,>=6.1.3 in c:\users\timo\anaconda3\lib\site-packages (from voila) (6.1.12)
Requirement already satisfied: python-dateutil>=2.1 in c:\users\timo\anaconda3\lib\site-packages (from jupyter-client<7,>=6.1.3->voila) (2.8.2)
Requirement already satisfied: traitlets in c:\users\timo\anaconda3\lib\site-packages (from jupyter-client<7,>=6.1.3->voila) (5.0.5)
Requirement already satisfied: pyzmq>=13 in c:\users\timo\anaconda3\lib\site-packages (from jupyter-client<7,>=6.1.3->voila) (22.2.1)
Requirement already satisfied: tornado>=4.1 in c:\users\timo\anaconda3\lib\site-packages (from jupyter-client<7,>=6.1.3->voila) (6.1)
Requirement already satisfied: jupyter-core>=4.6.0 in c:\users\timo\anaconda3\lib\site-packages (from jupyter-client<7,>=6.1.3->voila) (4.7.1)
Requirement already satisfied: pywin32>=1.0 in c:\users\timo\anaconda3\lib\site-packages (from jupyter-core>=4.6.0->jupyter-client<7,>=6.1.3->voila) (228)
Requirement already satisfied: nbformat in c:\users\timo\anaconda3\lib\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (5.1.3)
Requirement already satisfied: argon2-cffi in c:\users\timo\anaconda3\lib\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (20.1.0)
Requirement already satisfied: prometheus-client in c:\users\timo\anaconda3\lib\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (0.11.0)
Requirement already satisfied: anyio<4,>=3.1.0 in c:\users\timo\appdata\roaming\python\python38\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (3.3.1)
Requirement already satisfied: Send2Trash in c:\users\timo\anaconda3\lib\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (1.5.0)
Requirement already satisfied: requests-unixsocket in c:\users\timo\appdata\roaming\python\python38\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (0.2.0)
Requirement already satisfied: jinja2 in c:\users\timo\anaconda3\lib\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (2.11.3)
Requirement already satisfied: terminado>=0.8.3 in c:\users\timo\anaconda3\lib\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (0.9.4)
Requirement already satisfied: websocket-client in c:\users\timo\appdata\roaming\python\python38\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (1.2.1)
Requirement already satisfied: ipython-genutils in c:\users\timo\anaconda3\lib\site-packages (from jupyter-server<2.0.0,>=0.3.0->voila) (0.2.0)
Requirement already satisfied: sniffio>=1.1 in c:\users\timo\anaconda3\lib\site-packages (from anyio<4,>=3.1.0->jupyter-server<2.0.0,>=0.3.0->voila) (1.2.0)
Requirement already satisfied: idna>=2.8 in c:\users\timo\anaconda3\lib\site-packages (from anyio<4,>=3.1.0->jupyter-server<2.0.0,>=0.3.0->voila) (3.2)
Requirement already satisfied: nest-asyncio in c:\users\timo\anaconda3\lib\site-packages (from nbclient<0.6,>=0.4.0->voila) (1.5.1)
Requirement already satisfied: async-generator in c:\users\timo\anaconda3\lib\site-packages (from nbclient<0.6,>=0.4.0->voila) (1.10)
Requirement already satisfied: bleach in c:\users\timo\anaconda3\lib\site-packages (from nbconvert<7,>=6.0.0->voila) (4.0.0)
Requirement already satisfied: mistune<2,>=0.8.1 in c:\users\timo\anaconda3\lib\site-packages (from nbconvert<7,>=6.0.0->voila) (0.8.4)
Requirement already satisfied: jupyterlab-pygments in c:\users\timo\anaconda3\lib\site-packages (from nbconvert<7,>=6.0.0->voila) (0.1.2)
Requirement already satisfied: testpath in c:\users\timo\anaconda3\lib\site-packages (from nbconvert<7,>=6.0.0->voila) (0.5.0)
Requirement already satisfied: entrypoints>=0.2.2 in c:\users\timo\anaconda3\lib\site-packages (from nbconvert<7,>=6.0.0->voila) (0.3)
Requirement already satisfied: pandocfilters>=1.4.1 in c:\users\timo\anaconda3\lib\site-packages (from nbconvert<7,>=6.0.0->voila) (1.4.3)
Requirement already satisfied: pygments>=2.4.1 in c:\users\timo\anaconda3\lib\site-packages (from nbconvert<7,>=6.0.0->voila) (2.10.0)
Requirement already satisfied: defusedxml in c:\users\timo\anaconda3\lib\site-packages (from nbconvert<7,>=6.0.0->voila) (0.7.1)
Requirement already satisfied: MarkupSafe>=0.23 in c:\users\timo\anaconda3\lib\site-packages (from jinja2->jupyter-server<2.0.0,>=0.3.0->voila) (2.0.1)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in c:\users\timo\anaconda3\lib\site-packages (from nbformat->jupyter-server<2.0.0,>=0.3.0->voila) (3.2.0)
Requirement already satisfied: six>=1.11.0 in c:\users\timo\anaconda3\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->jupyter-server<2.0.0,>=0.3.0->voila) (1.16.0)
Requirement already satisfied: setuptools in c:\users\timo\anaconda3\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->jupyter-server<2.0.0,>=0.3.0->voila) (52.0.0.post20210125)
Requirement already satisfied: attrs>=17.4.0 in c:\users\timo\anaconda3\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->jupyter-server<2.0.0,>=0.3.0->voila) (21.2.0)
Requirement already satisfied: pyrsistent>=0.14.0 in c:\users\timo\anaconda3\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->jupyter-server<2.0.0,>=0.3.0->voila) (0.17.3)
Requirement already satisfied: pywinpty>=0.5 in c:\users\timo\anaconda3\lib\site-packages (from terminado>=0.8.3->jupyter-server<2.0.0,>=0.3.0->voila) (0.5.7)
Requirement already satisfied: cffi>=1.0.0 in c:\users\timo\anaconda3\lib\site-packages (from argon2-cffi->jupyter-server<2.0.0,>=0.3.0->voila) (1.14.6)
Requirement already satisfied: pycparser in c:\users\timo\anaconda3\lib\site-packages (from cffi>=1.0.0->argon2-cffi->jupyter-server<2.0.0,>=0.3.0->voila) (2.20)
Requirement already satisfied: webencodings in c:\users\timo\anaconda3\lib\site-packages (from bleach->nbconvert<7,>=6.0.0->voila) (0.5.1)
Requirement already satisfied: packaging in c:\users\timo\anaconda3\lib\site-packages (from bleach->nbconvert<7,>=6.0.0->voila) (21.0)
Requirement already satisfied: pyparsing>=2.0.2 in c:\users\timo\anaconda3\lib\site-packages (from packaging->bleach->nbconvert<7,>=6.0.0->voila) (2.4.7)
Requirement already satisfied: urllib3>=1.8 in c:\users\timo\anaconda3\lib\site-packages (from requests-unixsocket->jupyter-server<2.0.0,>=0.3.0->voila) (1.26.6)
Requirement already satisfied: requests>=1.1 in c:\users\timo\anaconda3\lib\site-packages (from requests-unixsocket->jupyter-server<2.0.0,>=0.3.0->voila) (2.26.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\timo\anaconda3\lib\site-packages (from requests>=1.1->requests-unixsocket->jupyter-server<2.0.0,>=0.3.0->voila) (2021.5.30)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\timo\anaconda3\lib\site-packages (from requests>=1.1->requests-unixsocket->jupyter-server<2.0.0,>=0.3.0->voila) (2.0.4)
Installing collected packages: voila
Successfully installed voila-0.2.16
%% Cell type:code id:fb903cb8 tags:
```
python
jupyter
nbextension
install
voila
--
sys
-
prefix
--
py
```
%%%% Output: error
File "C:\Users\Timo\AppData\Local\Temp/ipykernel_15124/1674201210.py", line 1
jupyter nbextension install voila --sys-prefix --py
^
SyntaxError: invalid syntax
%% Cell type:code id:f0169722 tags:
```
python
jupyter
nbextension
enable
voila
--
sys
-
prefix
--
py
```
%%%% Output: error
File "C:\Users\Timo\AppData\Local\Temp/ipykernel_15124/20501520.py", line 1
jupyter nbextension enable voila --sys-prefix --py
^
SyntaxError: invalid syntax
%% Cell type:code id:946530b8 tags:
```
python
``
`
%%
Cell
type
:
code
id
:
407
ba3ae
tags
:
```
python
```
%% Cell type:code id:0a799cfe tags:
```
python
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment