summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/act4e_mcdp_solution/__init__.py3
-rw-r--r--src/act4e_mcdp_solution/solution.py15
-rw-r--r--src/act4e_mcdp_solution/solver_dp.py29
-rw-r--r--src/act4e_mcdp_solution/solver_mcdp.py34
4 files changed, 65 insertions, 16 deletions
diff --git a/src/act4e_mcdp_solution/__init__.py b/src/act4e_mcdp_solution/__init__.py
index c3fe37e..cddc7c6 100644
--- a/src/act4e_mcdp_solution/__init__.py
+++ b/src/act4e_mcdp_solution/__init__.py
@@ -7,4 +7,5 @@ import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
-from .solution import *
+from .solver_dp import *
+from .solver_mcdp import *
diff --git a/src/act4e_mcdp_solution/solution.py b/src/act4e_mcdp_solution/solution.py
deleted file mode 100644
index 4704807..0000000
--- a/src/act4e_mcdp_solution/solution.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from typing import Any, Mapping
-
-from act4e_mcdp import NamedDP, SolverInterface, UpperSet, LowerSet
-
-__all__ = ["MySolution"]
-
-
-class MySolution(SolverInterface):
- def solve_FixFunMinRes(self, model: NamedDP, query: Mapping[str, Any]) -> UpperSet[Mapping[str, Any]]:
- # returns the empty upper set - marking it as infeasible
- return UpperSet([])
-
- def solve_FixResMaxFun(self, model: NamedDP, query: Mapping[str, Any]) -> LowerSet[Mapping[str, Any]]:
- # returns the empty upper set - marking it as infeasible
- return LowerSet([])
diff --git a/src/act4e_mcdp_solution/solver_dp.py b/src/act4e_mcdp_solution/solver_dp.py
new file mode 100644
index 0000000..8a4d58c
--- /dev/null
+++ b/src/act4e_mcdp_solution/solver_dp.py
@@ -0,0 +1,29 @@
+from act4e_mcdp import DPSolverInterface, Interval, LowerSet, PrimitiveDP, UpperSet
+
+__all__ = [
+ "DPSolver",
+]
+
+
+class DPSolver(DPSolverInterface):
+ def solve_dp_FixFunMinRes(
+ self,
+ dp: PrimitiveDP,
+ functionality_needed: object,
+ /,
+ resolution_optimistic: int = 0,
+ resolution_pessimistic: int = 0,
+ ) -> Interval[UpperSet[object]]:
+ optimistic = pessimistic = UpperSet([])
+ return Interval(pessimistic=pessimistic, optimistic=optimistic)
+
+ def solve_dp_FixResMaxFun(
+ self,
+ dp: PrimitiveDP,
+ resource_budget: object,
+ /,
+ resolution_optimistic: int = 0,
+ resolution_pessimistic: int = 0,
+ ) -> Interval[LowerSet[object]]:
+ optimistic = pessimistic = LowerSet([])
+ return Interval(pessimistic=pessimistic, optimistic=optimistic)
diff --git a/src/act4e_mcdp_solution/solver_mcdp.py b/src/act4e_mcdp_solution/solver_mcdp.py
new file mode 100644
index 0000000..12ab619
--- /dev/null
+++ b/src/act4e_mcdp_solution/solver_mcdp.py
@@ -0,0 +1,34 @@
+from typing import Any, Mapping
+
+from act4e_mcdp import Interval, LowerSet, MCDPSolverInterface, NamedDP, UpperSet
+
+__all__ = [
+ "MCDPSolver",
+]
+
+
+class MCDPSolver(MCDPSolverInterface):
+ def solve_mcdp_FixFunMinRes(
+ self,
+ graph: NamedDP,
+ functionality_needed: Mapping[str, Any],
+ /,
+ resolution_optimistic: int = 0,
+ resolution_pessimistic: int = 0,
+ ) -> Interval[UpperSet[Mapping[str, Any]]]:
+ value_as_tuple = tuple(functionality_needed[key] for key in graph.functionalities)
+
+ optimistic = pessimistic = UpperSet([])
+ return Interval(pessimistic=pessimistic, optimistic=optimistic)
+
+ def solve_mcdp_FixResMaxFun(
+ self,
+ graph: NamedDP,
+ resources_budget: Mapping[str, Any],
+ /,
+ resolution_optimistic: int = 0,
+ resolution_pessimistic: int = 0,
+ ) -> Interval[LowerSet[Mapping[str, Any]]]:
+ value_as_tuple = tuple(resources_budget[key] for key in graph.resources)
+ optimistic = pessimistic = LowerSet([])
+ return Interval(pessimistic=pessimistic, optimistic=optimistic)