diff --git a/cegis_cbf/__init__.py b/fosco/__init__.py similarity index 100% rename from cegis_cbf/__init__.py rename to fosco/__init__.py diff --git a/cegis_cbf/cbf.py b/fosco/cbf.py similarity index 97% rename from cegis_cbf/cbf.py rename to fosco/cbf.py index 74117da..ca40897 100644 --- a/cegis_cbf/cbf.py +++ b/fosco/cbf.py @@ -5,11 +5,11 @@ import torch from torch.optim import Optimizer -from cegis_cbf.common.domains import Set, Rectangle -from cegis_cbf.common.consts import DomainNames -from cegis_cbf.common.utils import _set_assertion -from cegis_cbf.learner import LearnerNN, LearnerCT -from cegis_cbf.verifier import SYMBOL +from fosco.common.domains import Set, Rectangle +from fosco.common.consts import DomainNames +from fosco.common.utils import _set_assertion +from fosco.learner import LearnerNN, LearnerCT +from fosco.verifier import SYMBOL from systems import ControlAffineControllableDynamicalModel XD = DomainNames.XD.value diff --git a/cegis_cbf/cegis.py b/fosco/cegis.py similarity index 93% rename from cegis_cbf/cegis.py rename to fosco/cegis.py index 2522856..3311d4c 100644 --- a/cegis_cbf/cegis.py +++ b/fosco/cegis.py @@ -6,19 +6,19 @@ import matplotlib.pyplot as plt -from cegis_cbf.cbf import ControlBarrierFunction -from cegis_cbf.common.formatter import CustomFormatter -from cegis_cbf.common.plotting import benchmark_3d -from cegis_cbf.consolidator import make_consolidator -from cegis_cbf.common.consts import ( +from fosco.cbf import ControlBarrierFunction +from fosco.common.formatter import CustomFormatter +from fosco.common.plotting import benchmark_3d +from fosco.consolidator import make_consolidator +from fosco.common.consts import ( CertificateType, TimeDomain, ActivationType, VerifierType, ) -from cegis_cbf.learner import make_learner, LearnerNN -from cegis_cbf.translator import make_translator -from cegis_cbf.verifier import make_verifier +from fosco.learner import make_learner, LearnerNN +from fosco.translator import make_translator +from fosco.verifier import make_verifier from systems import ControlAffineControllableDynamicalModel CegisResult = namedtuple("CegisResult", ["found", "net", "infos"]) @@ -32,7 +32,7 @@ class CegisConfig: SYSTEM: Type[ControlAffineControllableDynamicalModel] = None DOMAINS: dict[str, Any] = None TIME_DOMAIN: TimeDomain = TimeDomain.CONTINUOUS - # cegis_cbf + # fosco CERTIFICATE: CertificateType = CertificateType.CBF VERIFIER: VerifierType = VerifierType.Z3 CEGIS_MAX_ITERS: int = 10 @@ -233,5 +233,5 @@ def _assert_state(self): assert self.config.CEGIS_MAX_ITERS > 0 assert ( self.x is self.verifier.xs - ), "expected same variables in cegis_cbf and verifier" + ), "expected same variables in fosco and verifier" self.certificate._assert_state(self.domains, self.datasets) diff --git a/cegis_cbf/common/__init__.py b/fosco/common/__init__.py similarity index 100% rename from cegis_cbf/common/__init__.py rename to fosco/common/__init__.py diff --git a/cegis_cbf/common/activations.py b/fosco/common/activations.py similarity index 99% rename from cegis_cbf/common/activations.py rename to fosco/common/activations.py index 30482d1..3565f5f 100644 --- a/cegis_cbf/common/activations.py +++ b/fosco/common/activations.py @@ -1,6 +1,6 @@ import torch -from cegis_cbf.common import consts +from fosco.common import consts # Activation function diff --git a/cegis_cbf/common/activations_symbolic.py b/fosco/common/activations_symbolic.py similarity index 99% rename from cegis_cbf/common/activations_symbolic.py rename to fosco/common/activations_symbolic.py index 899f0f8..1cd1076 100644 --- a/cegis_cbf/common/activations_symbolic.py +++ b/fosco/common/activations_symbolic.py @@ -7,7 +7,7 @@ import numpy as np import z3 -from cegis_cbf.common import consts +from fosco.common import consts def activation_sym(select, p): diff --git a/cegis_cbf/common/consts.py b/fosco/common/consts.py similarity index 100% rename from cegis_cbf/common/consts.py rename to fosco/common/consts.py diff --git a/cegis_cbf/common/domains.py b/fosco/common/domains.py similarity index 98% rename from cegis_cbf/common/domains.py rename to fosco/common/domains.py index 4b6d5bd..9364a8e 100644 --- a/cegis_cbf/common/domains.py +++ b/fosco/common/domains.py @@ -5,9 +5,9 @@ from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import art3d -from cegis_cbf import verifier -from cegis_cbf.common.plotting import get_plot_colour -from cegis_cbf.common.utils import round_init_data, square_init_data +from fosco import verifier +from fosco.common.plotting import get_plot_colour +from fosco.common.utils import round_init_data, square_init_data class Set: diff --git a/cegis_cbf/common/formatter.py b/fosco/common/formatter.py similarity index 100% rename from cegis_cbf/common/formatter.py rename to fosco/common/formatter.py diff --git a/cegis_cbf/common/plotting.py b/fosco/common/plotting.py similarity index 100% rename from cegis_cbf/common/plotting.py rename to fosco/common/plotting.py diff --git a/cegis_cbf/common/utils.py b/fosco/common/utils.py similarity index 100% rename from cegis_cbf/common/utils.py rename to fosco/common/utils.py diff --git a/cegis_cbf/consolidator.py b/fosco/consolidator.py similarity index 100% rename from cegis_cbf/consolidator.py rename to fosco/consolidator.py diff --git a/cegis_cbf/learner.py b/fosco/learner.py similarity index 96% rename from cegis_cbf/learner.py rename to fosco/learner.py index a376f47..f93abb8 100644 --- a/cegis_cbf/learner.py +++ b/fosco/learner.py @@ -5,9 +5,9 @@ import torch from torch import nn -from cegis_cbf.common.activations import activation -from cegis_cbf.common.consts import ActivationType, TimeDomain -from cegis_cbf.models.network import MLP +from fosco.common.activations import activation +from fosco.common.consts import ActivationType, TimeDomain +from fosco.models.network import MLP class LearnerNN(nn.Module): diff --git a/cegis_cbf/models/__init__.py b/fosco/models/__init__.py similarity index 100% rename from cegis_cbf/models/__init__.py rename to fosco/models/__init__.py diff --git a/cegis_cbf/models/network.py b/fosco/models/network.py similarity index 92% rename from cegis_cbf/models/network.py rename to fosco/models/network.py index 1c61a10..fb7a0d3 100644 --- a/cegis_cbf/models/network.py +++ b/fosco/models/network.py @@ -1,7 +1,7 @@ from torch import nn -from cegis_cbf.common.activations import activation -from cegis_cbf.common.consts import ActivationType +from fosco.common.activations import activation +from fosco.common.consts import ActivationType class MLP(nn.Module): diff --git a/cegis_cbf/translator.py b/fosco/translator.py similarity index 96% rename from cegis_cbf/translator.py rename to fosco/translator.py index 89b09d8..ebd72db 100644 --- a/cegis_cbf/translator.py +++ b/fosco/translator.py @@ -4,10 +4,10 @@ import numpy as np import z3 -from cegis_cbf.common.activations_symbolic import activation_sym, activation_der_sym -from cegis_cbf.common.consts import VerifierType, TimeDomain -from cegis_cbf.models.network import MLP -from cegis_cbf.verifier import SYMBOL +from fosco.common.activations_symbolic import activation_sym, activation_der_sym +from fosco.common.consts import VerifierType, TimeDomain +from fosco.models.network import MLP +from fosco.verifier import SYMBOL class Translator(ABC): diff --git a/cegis_cbf/verifier.py b/fosco/verifier.py similarity index 98% rename from cegis_cbf/verifier.py rename to fosco/verifier.py index abc40ef..0b166db 100644 --- a/cegis_cbf/verifier.py +++ b/fosco/verifier.py @@ -5,8 +5,8 @@ import torch import z3 -from cegis_cbf.common.utils import contains_object -from cegis_cbf.common.consts import VerifierType +from fosco.common.utils import contains_object +from fosco.common.consts import VerifierType SYMBOL = z3.ArithRef INF: float = 1e300 diff --git a/run_example.py b/run_example.py index 80e52bd..edae5b6 100644 --- a/run_example.py +++ b/run_example.py @@ -4,11 +4,11 @@ import torch from matplotlib import pyplot as plt -import cegis_cbf.cegis -from cegis_cbf.common import domains -from cegis_cbf.common.consts import ActivationType -from cegis_cbf.common.consts import CertificateType, TimeDomain, VerifierType -from cegis_cbf.common.plotting import benchmark_3d +import fosco.cegis +from fosco.common import domains +from fosco.common.consts import ActivationType +from fosco.common.consts import CertificateType, TimeDomain, VerifierType +from fosco.common.plotting import benchmark_3d from systems import make_system @@ -72,7 +72,7 @@ def main(): "unsafe": lambda n: XU.generate_data(n), } - config = cegis_cbf.cegis.CegisConfig( + config = fosco.cegis.CegisConfig( SYSTEM=system, DOMAINS=sets, DATA_GEN=data_gen, @@ -85,7 +85,7 @@ def main(): N_DATA=n_data_samples, SEED=seed, ) - cegis = cegis_cbf.cegis.Cegis(config=config, verbose=verbose) + cegis = fosco.cegis.Cegis(config=config, verbose=verbose) result = cegis.solve() diff --git a/systems/system.py b/systems/system.py index 1fcd28b..584af63 100644 --- a/systems/system.py +++ b/systems/system.py @@ -4,7 +4,7 @@ import torch import z3 -from cegis_cbf.common.utils import contains_object +from fosco.common.utils import contains_object class ControlAffineControllableDynamicalModel: diff --git a/tests/test_cegis.py b/tests/test_cegis.py index 2946fdd..cf1cade 100644 --- a/tests/test_cegis.py +++ b/tests/test_cegis.py @@ -3,9 +3,9 @@ import torch -from cegis_cbf.cegis import CegisConfig, Cegis -from cegis_cbf.common.domains import Rectangle, Sphere -from cegis_cbf.common.consts import ( +from fosco.cegis import CegisConfig, Cegis +from fosco.common.domains import Rectangle, Sphere +from fosco.common.consts import ( TimeDomain, ActivationType, VerifierType, diff --git a/tests/test_domains.py b/tests/test_domains.py index c0c1402..2aa400e 100644 --- a/tests/test_domains.py +++ b/tests/test_domains.py @@ -1,6 +1,6 @@ import unittest -from cegis_cbf.common import domains +from fosco.common import domains class TestDomains(unittest.TestCase): diff --git a/tests/test_translator.py b/tests/test_translator.py index 6806a00..45643a6 100644 --- a/tests/test_translator.py +++ b/tests/test_translator.py @@ -3,9 +3,9 @@ import numpy as np import torch -from cegis_cbf.models.network import MLP -from cegis_cbf.translator import MLPZ3Translator, make_translator -from cegis_cbf.verifier import VerifierZ3 +from fosco.models.network import MLP +from fosco.translator import MLPZ3Translator, make_translator +from fosco.verifier import VerifierZ3 class TestTranslator(unittest.TestCase): @@ -70,8 +70,8 @@ def test_separation_symbolic_functions(self): ), f"Wrong symbolic formula for Vdot, got {expr_nndot}" def test_factory(self): - from cegis_cbf.common.consts import VerifierType - from cegis_cbf.common.consts import TimeDomain + from fosco.common.consts import VerifierType + from fosco.common.consts import TimeDomain translator = make_translator( verifier_type=VerifierType.Z3, time_domain=TimeDomain.CONTINUOUS diff --git a/tests/test_verifier.py b/tests/test_verifier.py index 321aa34..1ac3a05 100644 --- a/tests/test_verifier.py +++ b/tests/test_verifier.py @@ -1,8 +1,8 @@ import unittest -from cegis_cbf.common.consts import VerifierType -from cegis_cbf.verifier import make_verifier, Verifier, SYMBOL +from fosco.common.consts import VerifierType +from fosco.verifier import make_verifier, Verifier, SYMBOL class TestVerifier(unittest.TestCase):