示例#1
0
def test_dessin():
    s = Systeme.exemple_bistable()
    fig, ax = plt.subplots()
    s.dessin(ax)
    p, l1, l2, *_ = ax.get_children()
    assert isinstance(l1, Line2D)
    assert isinstance(l2, Line2D)
    assert isinstance(p, PathCollection)
示例#2
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 perrollaz <perrollaz@vincent-MacBookPro>
#
# Distributed under terms of the MIT license.
"""
Exemple d'utilisation du module. Cas avec boite invariante.
"""

import sys
sys.path.append("..")
import matplotlib.pyplot as plt
from hjb.cartographie import Valeur
from hjb.systeme import Systeme
import hjb.affichage as aff

s = Systeme(a=1, b=2, c=2, d=1, M=1, alpha=0.4, beta=0.4, bx=1, by=1)
v = Valeur.from_dl(sys=s, T=50, dl=0.02)
v.resolution()
fc = aff.affichage_contour(v, im=10, num=21)
plt.show()
示例#3
0
def s():
    s = Systeme(a=1, b=1, c=1, d=1, bx=1, by=1, alpha=1, beta=1, M=1)
    return s
示例#4
0
def test_exemple():
    s1 = Systeme.exemple_simple()
    assert not s1.verifications()
    s2 = Systeme.exemple_bistable()
    assert s2.verifications()
示例#5
0
def test_coexistence():
    f2 = Systeme(a=1, b=2, c=2, d=1, bx=1, by=1, alpha=1, beta=1, M=2)
    x, y = f2.etat_coexistence()
    assert (x == 1 / 3) and (y == 1 / 3)
示例#6
0
def test_verification(s1):
    assert not s1.verifications()

    f2 = Systeme(a=1, b=2, c=2, d=1, bx=1, by=1, alpha=1, beta=1, M=2)
    assert f2.verifications()
示例#7
0
def test_bistabilitite(s1):
    assert not s1._regime_bistable()

    f2 = Systeme(a=1, b=2, c=2, d=1, bx=1, by=1, alpha=1, beta=1, M=2)
    assert f2._regime_bistable()
示例#8
0
def test_parametres_valides(s1):
    assert s1._parametres_positifs()

    f2 = Systeme(a=-1, b=1, c=1, d=1, bx=1, by=1, alpha=1, beta=1, M=2)
    assert not f2._parametres_positifs()
示例#9
0
def s1():
    return Systeme(a=1, b=1, c=1, d=1, bx=1, by=1, alpha=1, beta=1, M=2)
示例#10
0
文件: ex1.py 项目: VPerrollaz/HJB
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 perrollaz <perrollaz@vincent-MacBookPro>
#
# Distributed under terms of the MIT license.
"""
Exemple d'utilisation du module. Cas "intéressant" pas de boite invariante.
"""

import sys
sys.path.append("..")
import matplotlib.pyplot as plt
from hjb.cartographie import Valeur
from hjb.systeme import Systeme
import hjb.affichage as aff

s = Systeme(a=1, b=2, c=2, d=1, M=1, alpha=6 / 8, beta=5 / 8, bx=1, by=1)
v = Valeur.from_dl(sys=s, T=50, dl=0.02)
v.resolution()
fc = aff.affichage_contour(v, im=10, num=21)
plt.show()