demuu 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- demuu-0.1.0/LICENCE +19 -0
- demuu-0.1.0/PKG-INFO +35 -0
- demuu-0.1.0/docs/pypip-index.md +21 -0
- demuu-0.1.0/pyproject.toml +24 -0
- demuu-0.1.0/src/demuu/__init__.py +4 -0
- demuu-0.1.0/src/demuu/clib/Linux-x86_64/libDemuu.so +0 -0
- demuu-0.1.0/src/demuu/clib/Linux-x86_64/libDemuu.so.0.1.0 +0 -0
- demuu-0.1.0/src/demuu/clib/Windows-AMD64/libDemuu.dll +0 -0
- demuu-0.1.0/src/demuu/clib/Windows-AMD64/libDemuu.dll.a +0 -0
- demuu-0.1.0/src/demuu/clib/__init__.py +18 -0
- demuu-0.1.0/src/demuu/clib/bench.py +112 -0
- demuu-0.1.0/src/demuu/clib/clibdemuu.py +1358 -0
- demuu-0.1.0/src/demuu/clib/code.py +114 -0
- demuu-0.1.0/src/demuu/clib/condition.py +133 -0
- demuu-0.1.0/src/demuu/clib/demuu.h +699 -0
- demuu-0.1.0/src/demuu/clib/dynamic.py +153 -0
- demuu-0.1.0/src/demuu/clib/evaluator.py +145 -0
- demuu-0.1.0/src/demuu/clib/function.py +30 -0
- demuu-0.1.0/src/demuu/clib/tree.py +114 -0
- demuu-0.1.0/src/demuu/clib/valuefct.py +78 -0
- demuu-0.1.0/src/demuu/clib/vector.py +79 -0
- demuu-0.1.0/src/demuu/model.py +281 -0
demuu-0.1.0/LICENCE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) <year> Guillaume Lozenguez
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
demuu-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: demuu
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python wrap of libDemuu
|
|
5
|
+
Author-email: Guillaume Lozenguez <guillaume@ktorz.net>
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
License-File: LICENCE
|
|
12
|
+
Project-URL: Homepage, https://ktorz-net.github.io/pyDemuu
|
|
13
|
+
|
|
14
|
+
# pyDemuu - DeMUU Python Library
|
|
15
|
+
|
|
16
|
+
The DeMUU project aims to implement models and algorythms for Decision-Majing Under Uncertainty.
|
|
17
|
+
Devellopement is based on multiple discrete variables defined Markov Decision Process with a transition function defined as a Bayesian network.
|
|
18
|
+
|
|
19
|
+
_pyDemuu_ is mainly a Python wrapper of the _libDemuu_ (_C_ librairy).
|
|
20
|
+
It also introduces some user-friendly Python classes to better manage _DeMUU_ concepts.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
**Attention:** Actually, only `x86` machin under `Linux` OS are supported.
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
pip install demuu
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Links
|
|
31
|
+
|
|
32
|
+
- Python wrapper on github : [pyDeMUU](https://github.com/ktorz-net/pydemuu)
|
|
33
|
+
- Documentation : [libDeMUU](https://github.com/ktorz-net/libdemuu)
|
|
34
|
+
- C Librairy on github : [ktorz-net.github.io](https://ktorz-net.github.io)
|
|
35
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# pyDemuu - DeMUU Python Library
|
|
2
|
+
|
|
3
|
+
The DeMUU project aims to implement models and algorythms for Decision-Majing Under Uncertainty.
|
|
4
|
+
Devellopement is based on multiple discrete variables defined Markov Decision Process with a transition function defined as a Bayesian network.
|
|
5
|
+
|
|
6
|
+
_pyDemuu_ is mainly a Python wrapper of the _libDemuu_ (_C_ librairy).
|
|
7
|
+
It also introduces some user-friendly Python classes to better manage _DeMUU_ concepts.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
**Attention:** Actually, only `x86` machin under `Linux` OS are supported.
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pip install demuu
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Links
|
|
18
|
+
|
|
19
|
+
- Python wrapper on github : [pyDeMUU](https://github.com/ktorz-net/pydemuu)
|
|
20
|
+
- Documentation : [libDeMUU](https://github.com/ktorz-net/libdemuu)
|
|
21
|
+
- C Librairy on github : [ktorz-net.github.io](https://ktorz-net.github.io)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["flit_core >= 3.4"]
|
|
3
|
+
build-backend = "flit_core.buildapi"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "demuu"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Guillaume Lozenguez", email="guillaume@ktorz.net" },
|
|
10
|
+
]
|
|
11
|
+
description = "Python wrap of libDemuu"
|
|
12
|
+
readme = "docs/pypip-index.md"
|
|
13
|
+
requires-python = ">=3.8"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[tool.flit.module]
|
|
21
|
+
name = "demuu"
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://ktorz-net.github.io/pyDemuu"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Core LibDemuu Wraps:
|
|
2
|
+
|
|
3
|
+
## LibDemuu :: STRUCTURE MODULE :
|
|
4
|
+
from .code import Code
|
|
5
|
+
from .vector import Vector
|
|
6
|
+
from .bench import Bench
|
|
7
|
+
from .tree import Tree
|
|
8
|
+
|
|
9
|
+
## LibDemuu :: FUNCTION MODULE :
|
|
10
|
+
from .valuefct import ValueFct
|
|
11
|
+
from .function import Function
|
|
12
|
+
|
|
13
|
+
## LibDemuu :: COMPONENT MODULE :
|
|
14
|
+
from .condition import Condition
|
|
15
|
+
from .dynamic import Dynamic
|
|
16
|
+
from .evaluator import Evaluator
|
|
17
|
+
|
|
18
|
+
## LibDemuu :: SOLVER MODULE :
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
from . import clibdemuu as cc
|
|
2
|
+
from .clibdemuu import c_digit, c_double
|
|
3
|
+
from .code import Code
|
|
4
|
+
from .vector import Vector
|
|
5
|
+
|
|
6
|
+
# DuBench wrap:
|
|
7
|
+
class Bench :
|
|
8
|
+
# Construction destruction:
|
|
9
|
+
def __init__(self, aListOfTuples=[], capacity= 16, cbench= None):
|
|
10
|
+
if cbench is None :
|
|
11
|
+
capacity= max( capacity, len(aListOfTuples) )
|
|
12
|
+
self._cbench= cc.newDuBench( c_digit(capacity) )
|
|
13
|
+
for codeList, v in aListOfTuples :
|
|
14
|
+
if type(v) is list :
|
|
15
|
+
self.attachLast( Code( codeList ), Vector( v ) )
|
|
16
|
+
else :
|
|
17
|
+
self.attachLast( Code( codeList ), Vector( [v] ) )
|
|
18
|
+
self._cmaster= True
|
|
19
|
+
else:
|
|
20
|
+
self._cbench= cbench
|
|
21
|
+
self._cmaster= False
|
|
22
|
+
|
|
23
|
+
def __del__(self):
|
|
24
|
+
if self._cmaster :
|
|
25
|
+
cc.deleteDuBench( self._cbench )
|
|
26
|
+
|
|
27
|
+
def initialize( self, aListOfTuples=[], capacity= 16 ):
|
|
28
|
+
capacity= max( capacity, len(aListOfTuples) )
|
|
29
|
+
cc.DuBench_reinit( self._cbench, c_digit(capacity) )
|
|
30
|
+
for codeList, vectorList in aListOfTuples :
|
|
31
|
+
self.attachLast( Code( codeList ), Vector( vectorList ) )
|
|
32
|
+
return self
|
|
33
|
+
|
|
34
|
+
# Accessor
|
|
35
|
+
def size( self ):
|
|
36
|
+
return cc.DuBench_size( self._cbench )
|
|
37
|
+
|
|
38
|
+
def codeAt(self, i):
|
|
39
|
+
return Code( ccode= cc.DuBench_codeAt( self._cbench, c_digit(i) ) )
|
|
40
|
+
|
|
41
|
+
def vectorAt( self, i ):
|
|
42
|
+
return Vector( cvector=cc.DuBench_vectorAt( self._cbench, c_digit(i) ) )
|
|
43
|
+
|
|
44
|
+
def digitAt( self, i ):
|
|
45
|
+
return cc.DuBench_digitAt( self._cbench, c_digit(i) )
|
|
46
|
+
|
|
47
|
+
def valueAt( self, i ):
|
|
48
|
+
return cc.DuBench_valueAt( self._cbench, c_digit(i) )
|
|
49
|
+
|
|
50
|
+
def range(self):
|
|
51
|
+
return range(1, self.size()+1)
|
|
52
|
+
|
|
53
|
+
def asCodeValueList( self ):
|
|
54
|
+
return [ (self.codeAt(i).asList(), self.valueAt(i)) for i in self.range() ]
|
|
55
|
+
|
|
56
|
+
def asList( self ):
|
|
57
|
+
return [ (self.codeAt(i).asList(), self.vectorAt(i).asList() ) for i in self.range() ]
|
|
58
|
+
|
|
59
|
+
# Construction
|
|
60
|
+
def attachLast( self, newCode, newVector ):
|
|
61
|
+
assert newCode._cmaster
|
|
62
|
+
cc.DuBench_attachCode_vector(
|
|
63
|
+
self._cbench,
|
|
64
|
+
newCode._ccode,
|
|
65
|
+
newVector._cvector )
|
|
66
|
+
newCode._cmaster= False
|
|
67
|
+
newVector._cmaster= False
|
|
68
|
+
|
|
69
|
+
def detachLast( self ):
|
|
70
|
+
code= Code( ccode= cc.DuBench_detach( self._cbench ) )
|
|
71
|
+
code._cmaster= True
|
|
72
|
+
return code
|
|
73
|
+
|
|
74
|
+
def attachFirst( self, newCode, newVector ):
|
|
75
|
+
assert newCode._cmaster
|
|
76
|
+
cc.DuBench_attachFrontCode_vector(
|
|
77
|
+
self._cbench,
|
|
78
|
+
newCode._ccode,
|
|
79
|
+
newVector._cvector )
|
|
80
|
+
newCode._cmaster= False
|
|
81
|
+
newVector._cmaster= False
|
|
82
|
+
|
|
83
|
+
def detachFirst( self ):
|
|
84
|
+
code= Code( ccode= cc.DuBench_detachFront( self._cbench ) )
|
|
85
|
+
code._cmaster= True
|
|
86
|
+
return code
|
|
87
|
+
|
|
88
|
+
def at_setValue(self, i, value):
|
|
89
|
+
cpointer= cc.DuBench_at_setValue(
|
|
90
|
+
self._cbench,
|
|
91
|
+
c_digit(i),
|
|
92
|
+
c_double(value)
|
|
93
|
+
)
|
|
94
|
+
return Code( ccode= cpointer )
|
|
95
|
+
|
|
96
|
+
# dump and load:
|
|
97
|
+
def dump(self):
|
|
98
|
+
descriptor= self.asList()
|
|
99
|
+
return descriptor
|
|
100
|
+
|
|
101
|
+
def load(self, descriptor):
|
|
102
|
+
return self.initialize( descriptor )
|
|
103
|
+
|
|
104
|
+
# Print
|
|
105
|
+
def __str__(self):
|
|
106
|
+
size= self.size()
|
|
107
|
+
if size == 0 :
|
|
108
|
+
return "bench[]"
|
|
109
|
+
s= "bench["+ str( self.codeAt(1).asList() ) +":"+ str( self.vectorAt(1).asList() )
|
|
110
|
+
for i in range(2, size+1) :
|
|
111
|
+
s+= ", "+ str( self.codeAt(i).asList() ) +":"+ str( self.vectorAt(i).asList() )
|
|
112
|
+
return s+"]"
|