SlideShare a Scribd company logo
Conrad Calmez
Christoph Matthies
Robert Lehmann
Pybelsberg
© 2006 by Jeremy Quinn, https://www.flickr.com/photos/sharkbait/314820030
1
a = pt(100, 100)
b = pt(200, 200)
always {
a.dist(b) == 200
}
a.setX(50)
a.dist(b) # => 200
babelsberg-js
© 2006 by Jeremy Quinn, https://www.flickr.com/photos/sharkbait/314820030
https://github.com/timfel/babelsberg-js
2
a = pt(100, 100)
b = pt(200, 200)
always {
a.dist(b) == 200
}
a.setX(50)
a.dist(b) # => 200
© 2006 by Jeremy Quinn, https://www.flickr.com/photos/sharkbait/314820030
babelsberg-js
3
a = Point(100, 100)
b = Point(200, 200)
@always
def constraint():
return a.dist(b) == 200
a.x = 50
a.dist(b) # => 200
pybelsberg
© 2006 by Jeremy Quinn, https://www.flickr.com/photos/sharkbait/314820030
4
100
200
100
200
141.42
a
b
5
p = Problem()
p.a_x = p.a_y = 100; p.b_x = p.b_y = 200
constraint = …
p.always(constraint)
print(dist((p.a_x, p.a_y), (p.b_x, p.b_y)))
# => 200
Boilerplate
6
p = Problem()
p.a_x = p.a_y = 100; p.b_x = p.b_y = 200
constraint = …
p.always(constraint)
print(dist((p.a_x, p.a_y), (p.b_x, p.b_y)))
# => 200
Boilerplate
?
7
100
200
100
200
a.x
f(a.x) = √(a.x−b.x)² + (a.y−b.y)²
8
a
b
100
200
100
200
a.x
f(a.x) = √(a.x−b.x)² + (a.y−b.y)²
f(a.x) = 200
9
a
b
100
200
100
200
a.x
f(a.x) = √(a.x−b.x)² + (a.y−b.y)²
f(a.x) = 200
f
10
a
b
100
200
100
200
a.x
f(a.x) = √(a.x−b.x)² + (a.y−b.y)²
f(a.x) = 200
g(a.x) = f(a.x) − 200 = 0
11
a
b
100
200
100
200
a.x
200
26.79
12
a
b
def constraint(a_x, a_y, b_x, b_y):
return dist((a_x, a_y), (b_x, b_y)) — 200
1
Defining the constraint
actually: f(a.x, a.y, b.x, b.y) = √(a.x−b.x)² + (a.y−b.y)²
13
Satisfying constraints
● Finding values to satisfy constraints is
solving equations.
● Solving equations means finding the
root of polynomials.
dist((a_x, a_y), (b_x, b_y)) — 200)
14
def constraint(a_x, a_y, b_x, b_y):
return dist((a_x, a_y), (b_x, b_y)) — 200
def constraint(a_x, a_y, b_x, b_y):
return dist((a_x, a_y), (b_x, b_y)) == 200
2
Define constraints naturally
15
class Expr(object):
def __add__(self, other):
return Expr('+', self, other)
def __eq__(self, other):
return Expr('=', self, other)
…
def to_eval(self):
return self.left.to_eval() + self.operator 
+ self.right.to_eval()
Remember performed operations
16
def constraint(a_x, a_y, b_x, b_y):
return dist((a_x, a_y), (b_x, b_y)) == 200
3
No explicit declaration of parameters
17
def foo():
x
foo()
# => NameError: global name 'x' is not defined
Variables in functions
18
class Namespace(dict):
def __getattr__(self, key):
print("getattr", key)
def foo():
a + b
ns = Namespace()
proxy = types.FunctionType(foo.__code__, ns)
proxy()
# => ???
Execute function in different global scope
19
Execute function in different global scope
class Namespace(dict):
def __getattr__(self, key):
print("getattr", key)
def foo():
a + b
ns = Namespace()
proxy = types.FunctionType(foo.__code__, ns)
proxy()
# => getattr a
# => getattr b
20
2.7.6
case LOAD_GLOBAL:
w = GETITEM(names, oparg);
x = PyDict_GetItem(f->f_globals, w);
PUSH(x);
3.3.5
TARGET(LOAD_GLOBAL)
w = GETITEM(names, oparg);
if (PyDict_CheckExact(f->f_globals)) {
…
} else {
/* Slow-path if globals or builtins is not a dict */
x = PyObject_GetItem(f->f_globals, w);
…
}
PUSH(x);
CPython: Python/ceval.c
21
def constraint():
return dist((a_x, a_y), (b_x, b_y)) == 200
a_x = 50
print(a_x, a_y, b_x, b_y)
# => 50 100 200 -32.14
print(dist(a_x, a_y), (b_x, b_y)))
# => 200
4
Work with global variables
22
TARGET(STORE_FAST)
v = POP();
// SETLOCAL(oparg, v);
PyObject *tmp = fastlocals[i];
fastlocals[i] = value;
Py_XDECREF(tmp);
FAST_DISPATCH();
CPython: Python/ceval.c
no Python protocol is used -- GAME OVER
23
class Namespace(dict):
def __setattr__(self, key):
print("setattr", key)
def foo():
global a
a = 2
ns = Namespace()
proxy = types.FunctionType(foo.__code__, ns)
proxy()
# => no output ☹
Function globals can be overridden?
24
TARGET(STORE_GLOBAL) {
PyObject *name = GETITEM(names, oparg);
PyObject *v = POP();
int err;
err = PyDict_SetItem(f->f_globals, name, v);
Py_DECREF(v);
if (err != 0)
goto error;
DISPATCH();
}
GAME OVER -- bug, see ticket #1402289
CPython: Python/ceval.c
25
class in_constrained(constraint):
a_x = 50
Use class as scope
26
class Namespace(dict):
def __setitem__(self, key, val):
print("setitem", key, val)
class Meta(type):
def __prepare__(self, obj):
return Namespace()
class Object(metaclass=Meta):
x = 2
# => setitem __module__ __main__
# => setitem __qualname__ Object
# => setitem x 2
Use class as scope
27
class Namespace(dict):
def __setitem__(self, key, val):
print("setitem", key, val)
class Meta(type):
def __prepare__(self, obj):
return Namespace()
class Object(metaclass=Meta):
x = 2
# => setitem __module__ __main__
# => setitem __qualname__ Object
# => setitem x 2
Use class as scope
Stamp © 2012 Stuart Miles, FreeDigitalPhotos.net, http://www.freedigitalphotos.net/images/Other_Metaphors_and__g307-Reject_Stamp_p86053.html
28
a = Point(100, 100)
b = Point(200, 200)
@always
def point_distance_constraint():
return a.dist(b) == 200
a.x = 50
# a.__setattr__('x', 50) ~› solve()
a.dist(b) # => 200
5
Catch instance variables
29
class A(object):
pass
def setattr(self, name, value):
print("setattr", name, value)
a = A()
a.__setattr__ = setattr
a.x = 10
# no output ☹
Notice instance variable assignment
30
3.3.5
int PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value)
{
PyTypeObject *tp = Py_TYPE(v);
int err;
Py_INCREF(name);
if (tp->tp_setattr != NULL) {
err = (*tp->tp_setattr)(v, name_str, value);
Py_DECREF(name);
return err;
}
…
return -1;
}
CPython: Objects/object.
c
31
class A(object):
pass
def setattr(self, name, value):
print("setattr", name, value)
a = A()
type(a).__setattr__ = setattr
a.x = 10
# => setattr x 10
Use type
32
always:
a.dist(b) == 200
6
Source code transforms
33
import codecs
def decode(text):
return u'x=5n' + text.decode('utf8')
codecs.register('babelsberg', decode)
# encoding: babelsberg
print(x) # => 5
Custom encoding
*
* not the actual codecs API 34
## main.py ☹
import custom_codec
import demo
## demo.py
# encoding: babelsberg
print(x) # => 5
Custom encoding, caveat
depends on
35
## main.py ☹
import custom_codec
import demo
## demo.py
# encoding: babelsberg
print(x) # => 5
Custom encoding, caveat
36
<demo>
a = Point(100.0, 100.0)
b = Point(200.0, 200.0)
@always
def constant_distance():
yield a.distance(b) == 200
assert_almost_equals(a.distance(b), 200)
a.x = 50
assert_almost_equals(a.distance(b), 200)
37
0 LOAD_GLOBAL 0 (a)
3 LOAD_ATTR 1 (dist)
6 LOAD_GLOBAL 2 (b)
9 CALL_FUNCTION 1
12 LOAD_CONST 1 (200)
15 COMPARE_OP 2 (==)
18 POP_TOP
19 LOAD_CONST 0 (None)
22 RETURN_VALUE
a = Point(100, 100)
b = Point(200, 200)
@always
def constant_distance():
a.dist(b) == 200
patch(obj):
for each instance variable of obj:
remember original value
replace with wrapped valuea.x, a.y, b.x, b.y
38
constraint = constant_distance()
for all remembered instance variables:
solver.add(instance_variable == value)
solver.add(constraint)
solver.solve()
(= 200 (sqrt
(+
(**
(- a.x b.x)
2)
(**
(- a.y b.y)
2)
)))
39
pybelsberg.py
Python
Theorem Solver
?
40
SciPy
41
scipy.optimize.fsolve(
func, #A function that takes at least one argument.
x0, #The starting estimate for the roots of func(x) = 0.
args=(), #Any extra arguments to func.
fprime=None, #A function to compute the Jacobian of func with derivatives across the rows.
By default, the Jacobian will be estimated.
full_output=0, #If True, return optional outputs.
col_deriv=0, #Specify whether the Jacobian function computes derivatives down the columns
(faster, because there is no transpose operation).
xtol=1.49012e-08, #The calculation will terminate if the relative error between two
consecutive iterates is at most xtol
maxfev=0, #The maximum number of calls to the function. If zero, then 100*(N+1) is the maximum
where N is the number of elements in x0.
band=None, #If set to a two-sequence containing the number of sub- and super-diagonals within
the band of the Jacobi matrix, the Jacobi matrix is considered banded (only for fprime=None).
epsfcn=None, #A suitable step length for the forward-difference approximation of the
Jacobian (for fprime=None). If epsfcn is less than the machine precision, it is assumed that the relative
errors in the functions are of the order of the machine precision.
42
scipy.optimize.fsolve
constraint = lambda args: [
math.sqrt(
(args[0]-args[1])**2
+ (args[2]-args[3])**2
) - 200
]*4
fsolve(constraint, [1, 1, 1, 1])
# => (array([ 201., 1., 1., 1.])
starting values
43
scipy.optimize.fsolve
● Requires transformation
○ “Return the roots of the (non-linear) equations defined by
func(x) = 0”
○ Cannot access instance variables
○ Function value must be closer to 0 if the parameters are
closer to the solution
○ x = y → x - y = 0 x > y → x - y if x - y > 0 else 0
● Requires starting estimate
○ Hard to determine best value for user-defined equations
44
Z3
45
Z3 theorem prover
● Developed by Microsoft Research http://z3.codeplex.com/
● General-purpose solver (not only for finding roots)
● Many built-in theories
○ linear arithmetic, nonlinear arithmetic, bitvectors, arrays,
datatypes, quantifiers
● Python bindings
○ already does ASTs
46
from z3 import *
a_x, a_y = Real('a.x'), Real('a.y')
b_x, b_y = Real('b.x'), Real('b.y')
s = Solver()
s.add(a_x == 100, …)
s.add(sqrt((a_x-b_x)**2 + (a_y-b_y)**2) == 200)
print(s.check()) # => sat
print(s.model()) # => [a.x = 26.79, a.y = 100, …]
Z3 theorem prover
47
Z3 theorem prover
● Quality of life improvement
○ Try to minimize the amount of variables that are
changed by the solver due to a constraint
48
Add all constraints
● Put a rollback point (“push” in Z3 lingo)
● Add all current variables (eg. from Point constructor, example
a = Point(50, 100)) as “soft constraints”
○ ie., boolnew
→ a.x = 50
● Solver tells us which implications are wrong (were
invalidated to satisfy constraints)
● We remove these from future runs, so that these variables
are preferably modified
Z3 theorem prover
49
s.add(sqrt((a.x - b.x)**2 … == 200)
s.push()
s.add(a.x == 100, a.y == 100, b.x == 50, b.y == 50)
s.check() # => unsat, a.x
s.pop()
s.add(a.x == 100, a.y == 100, …)
s.check() # => sat
transaction
50
© 2008 by “GillyBerlin”, flickr.com/photos/gillyberlin/2531057541 (CC BY 2.0)
● Constraint-based programming with object-oriented
Python
● Leverage same advanced solver as Babelsberg/JS
● Quality of life improvements for the programmer
51
Ad

More Related Content

What's hot (20)

Introducción a Elixir
Introducción a ElixirIntroducción a Elixir
Introducción a Elixir
Svet Ivantchev
 
TensorFlow Tutorial
TensorFlow TutorialTensorFlow Tutorial
TensorFlow Tutorial
NamHyuk Ahn
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
UC San Diego
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 redux
Eleanor McHugh
 
Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge
O T
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
ikdysfm
 
Google TensorFlow Tutorial
Google TensorFlow TutorialGoogle TensorFlow Tutorial
Google TensorFlow Tutorial
台灣資料科學年會
 
Groovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony CodeGroovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony Code
stasimus
 
Futures e abstração - QCon São Paulo 2015
Futures e abstração - QCon São Paulo 2015Futures e abstração - QCon São Paulo 2015
Futures e abstração - QCon São Paulo 2015
Leonardo Borges
 
Python speleology
Python speleologyPython speleology
Python speleology
Andrés J. Díaz
 
Python 내장 함수
Python 내장 함수Python 내장 함수
Python 내장 함수
용 최
 
Python decorators (中文)
Python decorators (中文)Python decorators (中文)
Python decorators (中文)
Yiwei Chen
 
Optics with monocle - Modeling the part and the whole
Optics with monocle - Modeling the part and the wholeOptics with monocle - Modeling the part and the whole
Optics with monocle - Modeling the part and the whole
Ilan Godik
 
PythonOOP
PythonOOPPythonOOP
PythonOOP
Veera Pendyala
 
Slides
SlidesSlides
Slides
Mohamed Mustaq Ahmed
 
TensorFlow
TensorFlowTensorFlow
TensorFlow
jirimaterna
 
Gentlest Introduction to Tensorflow
Gentlest Introduction to TensorflowGentlest Introduction to Tensorflow
Gentlest Introduction to Tensorflow
Khor SoonHin
 
Internal workshop es6_2015
Internal workshop es6_2015Internal workshop es6_2015
Internal workshop es6_2015
Miguel Ruiz Rodriguez
 
Python For Data Science Cheat Sheet
Python For Data Science Cheat SheetPython For Data Science Cheat Sheet
Python For Data Science Cheat Sheet
Karlijn Willems
 
Collection v3
Collection v3Collection v3
Collection v3
Sunil OS
 
Introducción a Elixir
Introducción a ElixirIntroducción a Elixir
Introducción a Elixir
Svet Ivantchev
 
TensorFlow Tutorial
TensorFlow TutorialTensorFlow Tutorial
TensorFlow Tutorial
NamHyuk Ahn
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
UC San Diego
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 redux
Eleanor McHugh
 
Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge
O T
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
ikdysfm
 
Groovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony CodeGroovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony Code
stasimus
 
Futures e abstração - QCon São Paulo 2015
Futures e abstração - QCon São Paulo 2015Futures e abstração - QCon São Paulo 2015
Futures e abstração - QCon São Paulo 2015
Leonardo Borges
 
Python 내장 함수
Python 내장 함수Python 내장 함수
Python 내장 함수
용 최
 
Python decorators (中文)
Python decorators (中文)Python decorators (中文)
Python decorators (中文)
Yiwei Chen
 
Optics with monocle - Modeling the part and the whole
Optics with monocle - Modeling the part and the wholeOptics with monocle - Modeling the part and the whole
Optics with monocle - Modeling the part and the whole
Ilan Godik
 
Gentlest Introduction to Tensorflow
Gentlest Introduction to TensorflowGentlest Introduction to Tensorflow
Gentlest Introduction to Tensorflow
Khor SoonHin
 
Python For Data Science Cheat Sheet
Python For Data Science Cheat SheetPython For Data Science Cheat Sheet
Python For Data Science Cheat Sheet
Karlijn Willems
 
Collection v3
Collection v3Collection v3
Collection v3
Sunil OS
 

Viewers also liked (18)

Routledge H
Routledge HRoutledge H
Routledge H
International Chair on Interventional Cardiology and Transradial Approach
 
Frodsham 4 6-14
Frodsham 4 6-14Frodsham 4 6-14
Frodsham 4 6-14
CJH47
 
Gilchrist IC - AIMRADIAL 2013 - Outpatient in the US
Gilchrist IC - AIMRADIAL 2013 - Outpatient in the USGilchrist IC - AIMRADIAL 2013 - Outpatient in the US
Gilchrist IC - AIMRADIAL 2013 - Outpatient in the US
International Chair on Interventional Cardiology and Transradial Approach
 
Los navegadores más usados
Los navegadores más usadosLos navegadores más usados
Los navegadores más usados
marcejesus
 
You want to learn spanish
You want to learn spanishYou want to learn spanish
You want to learn spanish
firststepargentina
 
ELABORACIÓN DE UNA BANDERA
ELABORACIÓN DE UNA BANDERA ELABORACIÓN DE UNA BANDERA
ELABORACIÓN DE UNA BANDERA
e1quimica
 
Articles technologies
Articles technologiesArticles technologies
Articles technologies
barallor
 
Creation & Nature
Creation & NatureCreation & Nature
Creation & Nature
Academy for Christian Thought
 
Narrativa dic
Narrativa dicNarrativa dic
Narrativa dic
Jocelyn Nuñez Aguilar
 
Secuencia didactica
Secuencia didacticaSecuencia didactica
Secuencia didactica
PUBLICACION ENLINEA
 
¿Qué es un modelo de negocio?
¿Qué es un modelo de negocio?¿Qué es un modelo de negocio?
¿Qué es un modelo de negocio?
Omar Vite
 
Transporte de sustancias a través de las membranas celulares
Transporte de sustancias a través de las membranas celularesTransporte de sustancias a través de las membranas celulares
Transporte de sustancias a través de las membranas celulares
Mi Pediatra
 
Bertrand OF 201111
Bertrand OF 201111Bertrand OF 201111
Bertrand OF 201111
International Chair on Interventional Cardiology and Transradial Approach
 
Charla Higiene Postural.
Charla Higiene Postural.Charla Higiene Postural.
Charla Higiene Postural.
Ana C.C.
 
Spaulding C - AIMRADIAL 2013 - Heparin and radial
Spaulding C - AIMRADIAL 2013 - Heparin and radialSpaulding C - AIMRADIAL 2013 - Heparin and radial
Spaulding C - AIMRADIAL 2013 - Heparin and radial
International Chair on Interventional Cardiology and Transradial Approach
 
04 aimradial2016 fri T Tokarek/Z Siudak
04 aimradial2016 fri T Tokarek/Z Siudak04 aimradial2016 fri T Tokarek/Z Siudak
04 aimradial2016 fri T Tokarek/Z Siudak
International Chair on Interventional Cardiology and Transradial Approach
 
“Getting to Yes” - Principled Negotiation
“Getting to Yes” - Principled Negotiation“Getting to Yes” - Principled Negotiation
“Getting to Yes” - Principled Negotiation
Floris Barthel
 
Frodsham 4 6-14
Frodsham 4 6-14Frodsham 4 6-14
Frodsham 4 6-14
CJH47
 
Los navegadores más usados
Los navegadores más usadosLos navegadores más usados
Los navegadores más usados
marcejesus
 
ELABORACIÓN DE UNA BANDERA
ELABORACIÓN DE UNA BANDERA ELABORACIÓN DE UNA BANDERA
ELABORACIÓN DE UNA BANDERA
e1quimica
 
Articles technologies
Articles technologiesArticles technologies
Articles technologies
barallor
 
¿Qué es un modelo de negocio?
¿Qué es un modelo de negocio?¿Qué es un modelo de negocio?
¿Qué es un modelo de negocio?
Omar Vite
 
Transporte de sustancias a través de las membranas celulares
Transporte de sustancias a través de las membranas celularesTransporte de sustancias a través de las membranas celulares
Transporte de sustancias a través de las membranas celulares
Mi Pediatra
 
Charla Higiene Postural.
Charla Higiene Postural.Charla Higiene Postural.
Charla Higiene Postural.
Ana C.C.
 
“Getting to Yes” - Principled Negotiation
“Getting to Yes” - Principled Negotiation“Getting to Yes” - Principled Negotiation
“Getting to Yes” - Principled Negotiation
Floris Barthel
 
Ad

Similar to Pybelsberg — Constraint-based Programming in Python (20)

Java VS Python
Java VS PythonJava VS Python
Java VS Python
Simone Federici
 
Week 3-Using functions Week 3-Using functions
Week 3-Using functions Week 3-Using functionsWeek 3-Using functions Week 3-Using functions
Week 3-Using functions Week 3-Using functions
Aman970290
 
python language programming presentation
python language  programming presentationpython language  programming presentation
python language programming presentation
lbisht2
 
Faster Python, FOSDEM
Faster Python, FOSDEMFaster Python, FOSDEM
Faster Python, FOSDEM
Victor Stinner
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
Fwdays
 
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 AutumnGoptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Masashi Shibata
 
Chapter 02 functions -class xii
Chapter 02   functions -class xiiChapter 02   functions -class xii
Chapter 02 functions -class xii
Praveen M Jigajinni
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
OSU Open Source Lab
 
A Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsA Few of My Favorite (Python) Things
A Few of My Favorite (Python) Things
Michael Pirnat
 
Machine-level Composition of Modularized Crosscutting Concerns
Machine-level Composition of Modularized Crosscutting ConcernsMachine-level Composition of Modularized Crosscutting Concerns
Machine-level Composition of Modularized Crosscutting Concerns
saintiss
 
ML Assignment help.pptx
ML Assignment help.pptxML Assignment help.pptx
ML Assignment help.pptx
Robinjk
 
An overview of Python 2.7
An overview of Python 2.7An overview of Python 2.7
An overview of Python 2.7
decoupled
 
Google Go For Ruby Hackers
Google Go For Ruby HackersGoogle Go For Ruby Hackers
Google Go For Ruby Hackers
Eleanor McHugh
 
First-Class Patterns
First-Class PatternsFirst-Class Patterns
First-Class Patterns
John De Goes
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
Muthu Vinayagam
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
Muhammad Fayyaz
 
Data structures KTU chapter2.PPT
Data structures KTU chapter2.PPTData structures KTU chapter2.PPT
Data structures KTU chapter2.PPT
Albin562191
 
Pyimproved again
Pyimproved againPyimproved again
Pyimproved again
rik0
 
NTU ML TENSORFLOW
NTU ML TENSORFLOWNTU ML TENSORFLOW
NTU ML TENSORFLOW
Mark Chang
 
Problemas resueltos de funciones lineales ccesa007
Problemas resueltos de  funciones lineales ccesa007Problemas resueltos de  funciones lineales ccesa007
Problemas resueltos de funciones lineales ccesa007
Demetrio Ccesa Rayme
 
Week 3-Using functions Week 3-Using functions
Week 3-Using functions Week 3-Using functionsWeek 3-Using functions Week 3-Using functions
Week 3-Using functions Week 3-Using functions
Aman970290
 
python language programming presentation
python language  programming presentationpython language  programming presentation
python language programming presentation
lbisht2
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
Fwdays
 
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 AutumnGoptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Masashi Shibata
 
A Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsA Few of My Favorite (Python) Things
A Few of My Favorite (Python) Things
Michael Pirnat
 
Machine-level Composition of Modularized Crosscutting Concerns
Machine-level Composition of Modularized Crosscutting ConcernsMachine-level Composition of Modularized Crosscutting Concerns
Machine-level Composition of Modularized Crosscutting Concerns
saintiss
 
ML Assignment help.pptx
ML Assignment help.pptxML Assignment help.pptx
ML Assignment help.pptx
Robinjk
 
An overview of Python 2.7
An overview of Python 2.7An overview of Python 2.7
An overview of Python 2.7
decoupled
 
Google Go For Ruby Hackers
Google Go For Ruby HackersGoogle Go For Ruby Hackers
Google Go For Ruby Hackers
Eleanor McHugh
 
First-Class Patterns
First-Class PatternsFirst-Class Patterns
First-Class Patterns
John De Goes
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
Muthu Vinayagam
 
Data structures KTU chapter2.PPT
Data structures KTU chapter2.PPTData structures KTU chapter2.PPT
Data structures KTU chapter2.PPT
Albin562191
 
Pyimproved again
Pyimproved againPyimproved again
Pyimproved again
rik0
 
NTU ML TENSORFLOW
NTU ML TENSORFLOWNTU ML TENSORFLOW
NTU ML TENSORFLOW
Mark Chang
 
Problemas resueltos de funciones lineales ccesa007
Problemas resueltos de  funciones lineales ccesa007Problemas resueltos de  funciones lineales ccesa007
Problemas resueltos de funciones lineales ccesa007
Demetrio Ccesa Rayme
 
Ad

More from Christoph Matthies (20)

Investigating Software Engineering Artifacts in DevOps Through the Lens of Bo...
Investigating Software Engineering Artifacts in DevOps Through the Lens of Bo...Investigating Software Engineering Artifacts in DevOps Through the Lens of Bo...
Investigating Software Engineering Artifacts in DevOps Through the Lens of Bo...
Christoph Matthies
 
Automated Exercises & Software Development Data
Automated Exercises & Software Development DataAutomated Exercises & Software Development Data
Automated Exercises & Software Development Data
Christoph Matthies
 
Challenges (and Opportunities!) of a Remote Agile Software Engineering Projec...
Challenges (and Opportunities!) of a Remote Agile Software Engineering Projec...Challenges (and Opportunities!) of a Remote Agile Software Engineering Projec...
Challenges (and Opportunities!) of a Remote Agile Software Engineering Projec...
Christoph Matthies
 
Experience vs Data: A Case for More Data-informed Retrospective Activities
Experience vs Data: A Case for More Data-informed Retrospective ActivitiesExperience vs Data: A Case for More Data-informed Retrospective Activities
Experience vs Data: A Case for More Data-informed Retrospective Activities
Christoph Matthies
 
More than Code: Contributions in Scrum Software Engineering Teams
More than Code: Contributions in Scrum Software Engineering TeamsMore than Code: Contributions in Scrum Software Engineering Teams
More than Code: Contributions in Scrum Software Engineering Teams
Christoph Matthies
 
Agile Software Development Practices: Perceptions & Project Data
Agile Software Development Practices: Perceptions & Project DataAgile Software Development Practices: Perceptions & Project Data
Agile Software Development Practices: Perceptions & Project Data
Christoph Matthies
 
The Road to Data-Informed Agile Development Processes
The Road to Data-Informed Agile Development ProcessesThe Road to Data-Informed Agile Development Processes
The Road to Data-Informed Agile Development Processes
Christoph Matthies
 
Counteracting Agile Retrospective Problems with Retrospective Activities
Counteracting Agile Retrospective Problems with Retrospective ActivitiesCounteracting Agile Retrospective Problems with Retrospective Activities
Counteracting Agile Retrospective Problems with Retrospective Activities
Christoph Matthies
 
Using Data to Inform Decisions in Agile Software Development
Using Data to Inform Decisions in Agile Software Development Using Data to Inform Decisions in Agile Software Development
Using Data to Inform Decisions in Agile Software Development
Christoph Matthies
 
An Additional Set of (Automated) Eyes: Chatbots for Agile Retrospectives
An Additional Set of (Automated) Eyes: Chatbots for Agile RetrospectivesAn Additional Set of (Automated) Eyes: Chatbots for Agile Retrospectives
An Additional Set of (Automated) Eyes: Chatbots for Agile Retrospectives
Christoph Matthies
 
Feedback in Scrum: Data-Informed Retrospectives
Feedback in Scrum: Data-Informed Retrospectives Feedback in Scrum: Data-Informed Retrospectives
Feedback in Scrum: Data-Informed Retrospectives
Christoph Matthies
 
Beyond Surveys: Analyzing Software Development Artifacts to Assess Teaching E...
Beyond Surveys: Analyzing Software Development Artifacts to Assess Teaching E...Beyond Surveys: Analyzing Software Development Artifacts to Assess Teaching E...
Beyond Surveys: Analyzing Software Development Artifacts to Assess Teaching E...
Christoph Matthies
 
Scrum2Kanban: Integrating Kanban and Scrum in a University Software Engineeri...
Scrum2Kanban: Integrating Kanban and Scrum in a University Software Engineeri...Scrum2Kanban: Integrating Kanban and Scrum in a University Software Engineeri...
Scrum2Kanban: Integrating Kanban and Scrum in a University Software Engineeri...
Christoph Matthies
 
Should I Bug You? Identifying Domain Experts in Software Projects Using Code...
 Should I Bug You? Identifying Domain Experts in Software Projects Using Code... Should I Bug You? Identifying Domain Experts in Software Projects Using Code...
Should I Bug You? Identifying Domain Experts in Software Projects Using Code...
Christoph Matthies
 
Introduction to Lean Software & Kanban
Introduction to Lean Software & KanbanIntroduction to Lean Software & Kanban
Introduction to Lean Software & Kanban
Christoph Matthies
 
Lightweight Collection and Storage of Software Repository Data with DataRover
Lightweight Collection and Storage of  Software Repository Data with DataRoverLightweight Collection and Storage of  Software Repository Data with DataRover
Lightweight Collection and Storage of Software Repository Data with DataRover
Christoph Matthies
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
Christoph Matthies
 
How to reverse engineer Android applications—using a popular word game as an ...
How to reverse engineer Android applications—using a popular word game as an ...How to reverse engineer Android applications—using a popular word game as an ...
How to reverse engineer Android applications—using a popular word game as an ...
Christoph Matthies
 
Beat Your Mom At Solitaire—Reverse Engineering of Computer Games
Beat Your Mom At Solitaire—Reverse Engineering of Computer GamesBeat Your Mom At Solitaire—Reverse Engineering of Computer Games
Beat Your Mom At Solitaire—Reverse Engineering of Computer Games
Christoph Matthies
 
Introduction to Homomorphic Encryption
Introduction to Homomorphic EncryptionIntroduction to Homomorphic Encryption
Introduction to Homomorphic Encryption
Christoph Matthies
 
Investigating Software Engineering Artifacts in DevOps Through the Lens of Bo...
Investigating Software Engineering Artifacts in DevOps Through the Lens of Bo...Investigating Software Engineering Artifacts in DevOps Through the Lens of Bo...
Investigating Software Engineering Artifacts in DevOps Through the Lens of Bo...
Christoph Matthies
 
Automated Exercises & Software Development Data
Automated Exercises & Software Development DataAutomated Exercises & Software Development Data
Automated Exercises & Software Development Data
Christoph Matthies
 
Challenges (and Opportunities!) of a Remote Agile Software Engineering Projec...
Challenges (and Opportunities!) of a Remote Agile Software Engineering Projec...Challenges (and Opportunities!) of a Remote Agile Software Engineering Projec...
Challenges (and Opportunities!) of a Remote Agile Software Engineering Projec...
Christoph Matthies
 
Experience vs Data: A Case for More Data-informed Retrospective Activities
Experience vs Data: A Case for More Data-informed Retrospective ActivitiesExperience vs Data: A Case for More Data-informed Retrospective Activities
Experience vs Data: A Case for More Data-informed Retrospective Activities
Christoph Matthies
 
More than Code: Contributions in Scrum Software Engineering Teams
More than Code: Contributions in Scrum Software Engineering TeamsMore than Code: Contributions in Scrum Software Engineering Teams
More than Code: Contributions in Scrum Software Engineering Teams
Christoph Matthies
 
Agile Software Development Practices: Perceptions & Project Data
Agile Software Development Practices: Perceptions & Project DataAgile Software Development Practices: Perceptions & Project Data
Agile Software Development Practices: Perceptions & Project Data
Christoph Matthies
 
The Road to Data-Informed Agile Development Processes
The Road to Data-Informed Agile Development ProcessesThe Road to Data-Informed Agile Development Processes
The Road to Data-Informed Agile Development Processes
Christoph Matthies
 
Counteracting Agile Retrospective Problems with Retrospective Activities
Counteracting Agile Retrospective Problems with Retrospective ActivitiesCounteracting Agile Retrospective Problems with Retrospective Activities
Counteracting Agile Retrospective Problems with Retrospective Activities
Christoph Matthies
 
Using Data to Inform Decisions in Agile Software Development
Using Data to Inform Decisions in Agile Software Development Using Data to Inform Decisions in Agile Software Development
Using Data to Inform Decisions in Agile Software Development
Christoph Matthies
 
An Additional Set of (Automated) Eyes: Chatbots for Agile Retrospectives
An Additional Set of (Automated) Eyes: Chatbots for Agile RetrospectivesAn Additional Set of (Automated) Eyes: Chatbots for Agile Retrospectives
An Additional Set of (Automated) Eyes: Chatbots for Agile Retrospectives
Christoph Matthies
 
Feedback in Scrum: Data-Informed Retrospectives
Feedback in Scrum: Data-Informed Retrospectives Feedback in Scrum: Data-Informed Retrospectives
Feedback in Scrum: Data-Informed Retrospectives
Christoph Matthies
 
Beyond Surveys: Analyzing Software Development Artifacts to Assess Teaching E...
Beyond Surveys: Analyzing Software Development Artifacts to Assess Teaching E...Beyond Surveys: Analyzing Software Development Artifacts to Assess Teaching E...
Beyond Surveys: Analyzing Software Development Artifacts to Assess Teaching E...
Christoph Matthies
 
Scrum2Kanban: Integrating Kanban and Scrum in a University Software Engineeri...
Scrum2Kanban: Integrating Kanban and Scrum in a University Software Engineeri...Scrum2Kanban: Integrating Kanban and Scrum in a University Software Engineeri...
Scrum2Kanban: Integrating Kanban and Scrum in a University Software Engineeri...
Christoph Matthies
 
Should I Bug You? Identifying Domain Experts in Software Projects Using Code...
 Should I Bug You? Identifying Domain Experts in Software Projects Using Code... Should I Bug You? Identifying Domain Experts in Software Projects Using Code...
Should I Bug You? Identifying Domain Experts in Software Projects Using Code...
Christoph Matthies
 
Introduction to Lean Software & Kanban
Introduction to Lean Software & KanbanIntroduction to Lean Software & Kanban
Introduction to Lean Software & Kanban
Christoph Matthies
 
Lightweight Collection and Storage of Software Repository Data with DataRover
Lightweight Collection and Storage of  Software Repository Data with DataRoverLightweight Collection and Storage of  Software Repository Data with DataRover
Lightweight Collection and Storage of Software Repository Data with DataRover
Christoph Matthies
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
Christoph Matthies
 
How to reverse engineer Android applications—using a popular word game as an ...
How to reverse engineer Android applications—using a popular word game as an ...How to reverse engineer Android applications—using a popular word game as an ...
How to reverse engineer Android applications—using a popular word game as an ...
Christoph Matthies
 
Beat Your Mom At Solitaire—Reverse Engineering of Computer Games
Beat Your Mom At Solitaire—Reverse Engineering of Computer GamesBeat Your Mom At Solitaire—Reverse Engineering of Computer Games
Beat Your Mom At Solitaire—Reverse Engineering of Computer Games
Christoph Matthies
 
Introduction to Homomorphic Encryption
Introduction to Homomorphic EncryptionIntroduction to Homomorphic Encryption
Introduction to Homomorphic Encryption
Christoph Matthies
 

Recently uploaded (20)

Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Odoo ERP for Education Management to Streamline Your Education Process
Odoo ERP for Education Management to Streamline Your Education ProcessOdoo ERP for Education Management to Streamline Your Education Process
Odoo ERP for Education Management to Streamline Your Education Process
iVenture Team LLP
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Foundation Models for Time Series : A Survey
Foundation Models for Time Series : A SurveyFoundation Models for Time Series : A Survey
Foundation Models for Time Series : A Survey
jayanthkalyanam1
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Full Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest VersionFull Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest Version
jonesmichealj2
 
🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf
🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf
🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf
Imma Valls Bernaus
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Creating Automated Tests with AI - Cory House - Applitools.pdf
Creating Automated Tests with AI - Cory House - Applitools.pdfCreating Automated Tests with AI - Cory House - Applitools.pdf
Creating Automated Tests with AI - Cory House - Applitools.pdf
Applitools
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Implementing promises with typescripts, step by step
Implementing promises with typescripts, step by stepImplementing promises with typescripts, step by step
Implementing promises with typescripts, step by step
Ran Wahle
 
Microsoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptxMicrosoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptx
Mekonnen
 
Tools of the Trade: Linux and SQL - Google Certificate
Tools of the Trade: Linux and SQL - Google CertificateTools of the Trade: Linux and SQL - Google Certificate
Tools of the Trade: Linux and SQL - Google Certificate
VICTOR MAESTRE RAMIREZ
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Innovative Approaches to Software Dev no good at all
Innovative Approaches to Software Dev no good at allInnovative Approaches to Software Dev no good at all
Innovative Approaches to Software Dev no good at all
ayeshakanwal75
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Odoo ERP for Education Management to Streamline Your Education Process
Odoo ERP for Education Management to Streamline Your Education ProcessOdoo ERP for Education Management to Streamline Your Education Process
Odoo ERP for Education Management to Streamline Your Education Process
iVenture Team LLP
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Foundation Models for Time Series : A Survey
Foundation Models for Time Series : A SurveyFoundation Models for Time Series : A Survey
Foundation Models for Time Series : A Survey
jayanthkalyanam1
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Full Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest VersionFull Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest Version
jonesmichealj2
 
🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf
🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf
🌱 Green Grafana 🌱 Essentials_ Data, Visualizations and Plugins.pdf
Imma Valls Bernaus
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Creating Automated Tests with AI - Cory House - Applitools.pdf
Creating Automated Tests with AI - Cory House - Applitools.pdfCreating Automated Tests with AI - Cory House - Applitools.pdf
Creating Automated Tests with AI - Cory House - Applitools.pdf
Applitools
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Implementing promises with typescripts, step by step
Implementing promises with typescripts, step by stepImplementing promises with typescripts, step by step
Implementing promises with typescripts, step by step
Ran Wahle
 
Microsoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptxMicrosoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptx
Mekonnen
 
Tools of the Trade: Linux and SQL - Google Certificate
Tools of the Trade: Linux and SQL - Google CertificateTools of the Trade: Linux and SQL - Google Certificate
Tools of the Trade: Linux and SQL - Google Certificate
VICTOR MAESTRE RAMIREZ
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Innovative Approaches to Software Dev no good at all
Innovative Approaches to Software Dev no good at allInnovative Approaches to Software Dev no good at all
Innovative Approaches to Software Dev no good at all
ayeshakanwal75
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 

Pybelsberg — Constraint-based Programming in Python

  • 1. Conrad Calmez Christoph Matthies Robert Lehmann Pybelsberg © 2006 by Jeremy Quinn, https://www.flickr.com/photos/sharkbait/314820030 1
  • 2. a = pt(100, 100) b = pt(200, 200) always { a.dist(b) == 200 } a.setX(50) a.dist(b) # => 200 babelsberg-js © 2006 by Jeremy Quinn, https://www.flickr.com/photos/sharkbait/314820030 https://github.com/timfel/babelsberg-js 2
  • 3. a = pt(100, 100) b = pt(200, 200) always { a.dist(b) == 200 } a.setX(50) a.dist(b) # => 200 © 2006 by Jeremy Quinn, https://www.flickr.com/photos/sharkbait/314820030 babelsberg-js 3
  • 4. a = Point(100, 100) b = Point(200, 200) @always def constraint(): return a.dist(b) == 200 a.x = 50 a.dist(b) # => 200 pybelsberg © 2006 by Jeremy Quinn, https://www.flickr.com/photos/sharkbait/314820030 4
  • 6. p = Problem() p.a_x = p.a_y = 100; p.b_x = p.b_y = 200 constraint = … p.always(constraint) print(dist((p.a_x, p.a_y), (p.b_x, p.b_y))) # => 200 Boilerplate 6
  • 7. p = Problem() p.a_x = p.a_y = 100; p.b_x = p.b_y = 200 constraint = … p.always(constraint) print(dist((p.a_x, p.a_y), (p.b_x, p.b_y))) # => 200 Boilerplate ? 7
  • 9. 100 200 100 200 a.x f(a.x) = √(a.x−b.x)² + (a.y−b.y)² f(a.x) = 200 9 a b
  • 10. 100 200 100 200 a.x f(a.x) = √(a.x−b.x)² + (a.y−b.y)² f(a.x) = 200 f 10 a b
  • 11. 100 200 100 200 a.x f(a.x) = √(a.x−b.x)² + (a.y−b.y)² f(a.x) = 200 g(a.x) = f(a.x) − 200 = 0 11 a b
  • 13. def constraint(a_x, a_y, b_x, b_y): return dist((a_x, a_y), (b_x, b_y)) — 200 1 Defining the constraint actually: f(a.x, a.y, b.x, b.y) = √(a.x−b.x)² + (a.y−b.y)² 13
  • 14. Satisfying constraints ● Finding values to satisfy constraints is solving equations. ● Solving equations means finding the root of polynomials. dist((a_x, a_y), (b_x, b_y)) — 200) 14
  • 15. def constraint(a_x, a_y, b_x, b_y): return dist((a_x, a_y), (b_x, b_y)) — 200 def constraint(a_x, a_y, b_x, b_y): return dist((a_x, a_y), (b_x, b_y)) == 200 2 Define constraints naturally 15
  • 16. class Expr(object): def __add__(self, other): return Expr('+', self, other) def __eq__(self, other): return Expr('=', self, other) … def to_eval(self): return self.left.to_eval() + self.operator + self.right.to_eval() Remember performed operations 16
  • 17. def constraint(a_x, a_y, b_x, b_y): return dist((a_x, a_y), (b_x, b_y)) == 200 3 No explicit declaration of parameters 17
  • 18. def foo(): x foo() # => NameError: global name 'x' is not defined Variables in functions 18
  • 19. class Namespace(dict): def __getattr__(self, key): print("getattr", key) def foo(): a + b ns = Namespace() proxy = types.FunctionType(foo.__code__, ns) proxy() # => ??? Execute function in different global scope 19
  • 20. Execute function in different global scope class Namespace(dict): def __getattr__(self, key): print("getattr", key) def foo(): a + b ns = Namespace() proxy = types.FunctionType(foo.__code__, ns) proxy() # => getattr a # => getattr b 20
  • 21. 2.7.6 case LOAD_GLOBAL: w = GETITEM(names, oparg); x = PyDict_GetItem(f->f_globals, w); PUSH(x); 3.3.5 TARGET(LOAD_GLOBAL) w = GETITEM(names, oparg); if (PyDict_CheckExact(f->f_globals)) { … } else { /* Slow-path if globals or builtins is not a dict */ x = PyObject_GetItem(f->f_globals, w); … } PUSH(x); CPython: Python/ceval.c 21
  • 22. def constraint(): return dist((a_x, a_y), (b_x, b_y)) == 200 a_x = 50 print(a_x, a_y, b_x, b_y) # => 50 100 200 -32.14 print(dist(a_x, a_y), (b_x, b_y))) # => 200 4 Work with global variables 22
  • 23. TARGET(STORE_FAST) v = POP(); // SETLOCAL(oparg, v); PyObject *tmp = fastlocals[i]; fastlocals[i] = value; Py_XDECREF(tmp); FAST_DISPATCH(); CPython: Python/ceval.c no Python protocol is used -- GAME OVER 23
  • 24. class Namespace(dict): def __setattr__(self, key): print("setattr", key) def foo(): global a a = 2 ns = Namespace() proxy = types.FunctionType(foo.__code__, ns) proxy() # => no output ☹ Function globals can be overridden? 24
  • 25. TARGET(STORE_GLOBAL) { PyObject *name = GETITEM(names, oparg); PyObject *v = POP(); int err; err = PyDict_SetItem(f->f_globals, name, v); Py_DECREF(v); if (err != 0) goto error; DISPATCH(); } GAME OVER -- bug, see ticket #1402289 CPython: Python/ceval.c 25
  • 26. class in_constrained(constraint): a_x = 50 Use class as scope 26
  • 27. class Namespace(dict): def __setitem__(self, key, val): print("setitem", key, val) class Meta(type): def __prepare__(self, obj): return Namespace() class Object(metaclass=Meta): x = 2 # => setitem __module__ __main__ # => setitem __qualname__ Object # => setitem x 2 Use class as scope 27
  • 28. class Namespace(dict): def __setitem__(self, key, val): print("setitem", key, val) class Meta(type): def __prepare__(self, obj): return Namespace() class Object(metaclass=Meta): x = 2 # => setitem __module__ __main__ # => setitem __qualname__ Object # => setitem x 2 Use class as scope Stamp © 2012 Stuart Miles, FreeDigitalPhotos.net, http://www.freedigitalphotos.net/images/Other_Metaphors_and__g307-Reject_Stamp_p86053.html 28
  • 29. a = Point(100, 100) b = Point(200, 200) @always def point_distance_constraint(): return a.dist(b) == 200 a.x = 50 # a.__setattr__('x', 50) ~› solve() a.dist(b) # => 200 5 Catch instance variables 29
  • 30. class A(object): pass def setattr(self, name, value): print("setattr", name, value) a = A() a.__setattr__ = setattr a.x = 10 # no output ☹ Notice instance variable assignment 30
  • 31. 3.3.5 int PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value) { PyTypeObject *tp = Py_TYPE(v); int err; Py_INCREF(name); if (tp->tp_setattr != NULL) { err = (*tp->tp_setattr)(v, name_str, value); Py_DECREF(name); return err; } … return -1; } CPython: Objects/object. c 31
  • 32. class A(object): pass def setattr(self, name, value): print("setattr", name, value) a = A() type(a).__setattr__ = setattr a.x = 10 # => setattr x 10 Use type 32
  • 33. always: a.dist(b) == 200 6 Source code transforms 33
  • 34. import codecs def decode(text): return u'x=5n' + text.decode('utf8') codecs.register('babelsberg', decode) # encoding: babelsberg print(x) # => 5 Custom encoding * * not the actual codecs API 34
  • 35. ## main.py ☹ import custom_codec import demo ## demo.py # encoding: babelsberg print(x) # => 5 Custom encoding, caveat depends on 35
  • 36. ## main.py ☹ import custom_codec import demo ## demo.py # encoding: babelsberg print(x) # => 5 Custom encoding, caveat 36
  • 37. <demo> a = Point(100.0, 100.0) b = Point(200.0, 200.0) @always def constant_distance(): yield a.distance(b) == 200 assert_almost_equals(a.distance(b), 200) a.x = 50 assert_almost_equals(a.distance(b), 200) 37
  • 38. 0 LOAD_GLOBAL 0 (a) 3 LOAD_ATTR 1 (dist) 6 LOAD_GLOBAL 2 (b) 9 CALL_FUNCTION 1 12 LOAD_CONST 1 (200) 15 COMPARE_OP 2 (==) 18 POP_TOP 19 LOAD_CONST 0 (None) 22 RETURN_VALUE a = Point(100, 100) b = Point(200, 200) @always def constant_distance(): a.dist(b) == 200 patch(obj): for each instance variable of obj: remember original value replace with wrapped valuea.x, a.y, b.x, b.y 38
  • 39. constraint = constant_distance() for all remembered instance variables: solver.add(instance_variable == value) solver.add(constraint) solver.solve() (= 200 (sqrt (+ (** (- a.x b.x) 2) (** (- a.y b.y) 2) ))) 39
  • 42. scipy.optimize.fsolve( func, #A function that takes at least one argument. x0, #The starting estimate for the roots of func(x) = 0. args=(), #Any extra arguments to func. fprime=None, #A function to compute the Jacobian of func with derivatives across the rows. By default, the Jacobian will be estimated. full_output=0, #If True, return optional outputs. col_deriv=0, #Specify whether the Jacobian function computes derivatives down the columns (faster, because there is no transpose operation). xtol=1.49012e-08, #The calculation will terminate if the relative error between two consecutive iterates is at most xtol maxfev=0, #The maximum number of calls to the function. If zero, then 100*(N+1) is the maximum where N is the number of elements in x0. band=None, #If set to a two-sequence containing the number of sub- and super-diagonals within the band of the Jacobi matrix, the Jacobi matrix is considered banded (only for fprime=None). epsfcn=None, #A suitable step length for the forward-difference approximation of the Jacobian (for fprime=None). If epsfcn is less than the machine precision, it is assumed that the relative errors in the functions are of the order of the machine precision. 42
  • 43. scipy.optimize.fsolve constraint = lambda args: [ math.sqrt( (args[0]-args[1])**2 + (args[2]-args[3])**2 ) - 200 ]*4 fsolve(constraint, [1, 1, 1, 1]) # => (array([ 201., 1., 1., 1.]) starting values 43
  • 44. scipy.optimize.fsolve ● Requires transformation ○ “Return the roots of the (non-linear) equations defined by func(x) = 0” ○ Cannot access instance variables ○ Function value must be closer to 0 if the parameters are closer to the solution ○ x = y → x - y = 0 x > y → x - y if x - y > 0 else 0 ● Requires starting estimate ○ Hard to determine best value for user-defined equations 44
  • 45. Z3 45
  • 46. Z3 theorem prover ● Developed by Microsoft Research http://z3.codeplex.com/ ● General-purpose solver (not only for finding roots) ● Many built-in theories ○ linear arithmetic, nonlinear arithmetic, bitvectors, arrays, datatypes, quantifiers ● Python bindings ○ already does ASTs 46
  • 47. from z3 import * a_x, a_y = Real('a.x'), Real('a.y') b_x, b_y = Real('b.x'), Real('b.y') s = Solver() s.add(a_x == 100, …) s.add(sqrt((a_x-b_x)**2 + (a_y-b_y)**2) == 200) print(s.check()) # => sat print(s.model()) # => [a.x = 26.79, a.y = 100, …] Z3 theorem prover 47
  • 48. Z3 theorem prover ● Quality of life improvement ○ Try to minimize the amount of variables that are changed by the solver due to a constraint 48
  • 49. Add all constraints ● Put a rollback point (“push” in Z3 lingo) ● Add all current variables (eg. from Point constructor, example a = Point(50, 100)) as “soft constraints” ○ ie., boolnew → a.x = 50 ● Solver tells us which implications are wrong (were invalidated to satisfy constraints) ● We remove these from future runs, so that these variables are preferably modified Z3 theorem prover 49
  • 50. s.add(sqrt((a.x - b.x)**2 … == 200) s.push() s.add(a.x == 100, a.y == 100, b.x == 50, b.y == 50) s.check() # => unsat, a.x s.pop() s.add(a.x == 100, a.y == 100, …) s.check() # => sat transaction 50
  • 51. © 2008 by “GillyBerlin”, flickr.com/photos/gillyberlin/2531057541 (CC BY 2.0) ● Constraint-based programming with object-oriented Python ● Leverage same advanced solver as Babelsberg/JS ● Quality of life improvements for the programmer 51