You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+45-6
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,46 @@ ospf introduces a concept called "intermediate expression" to facilitate DDD-bas
21
21
- they are grammatically equivalent to variables, having a global scope and static lifetime.
22
22
- they can be constructed through an anonymous polynomial.
23
23
24
-
<!-- add examples -->
24
+
### Arithmetic Intermediate Expression:
25
+
26
+
The initial purpose of designing intermediate expressions was to reduce redundancy in mathematical models. Therefore, the most basic arithmetic intermediate expressions are constructed using a polynomial, allowing users to replace all identical polynomials with this intermediate expression anywhere in the model.
27
+
28
+
$$
29
+
ExprSymbol = \sum_{i} x_{i} \\ \; \\
30
+
min \quad ExprSymbol \\ \; \\
31
+
s.t. \quad ExprSymbol \leq 1
32
+
$$
33
+
34
+
ospf automatically replaces each arithmetic intermediate expressions with specific polynomials when translating the model into interfaces for specific solvers. This translation process is transparent to the user, so the user does not need to know how the arithmetic intermediate expressions are implemented through which variables and operations.
35
+
36
+
Thus, we can divide the maintainers of mathematical models into two roles: <em>"intermediate expressions maintainer"</em> and <em>"user of intermediate expressions"</em>. The intermediate expressions maintainers are responsible for defining and implementing intermediate expressions, while users of intermediate expressions do not concern themselves with the implementation of intermediate expresssions. They only focus on the definition and behavior of intermediate expressions and use these intermediate expressions to describe business logic in mathematical models.
37
+
38
+
This engineering practice is similar to <strong><em>Object-Oriented Design</em></strong> (OOD), where defining a class encapsulates variables and functions with the same semantics, and users only need to focus on their behavior without concerning themselves with their implementation. With such a foundation, we can then begin to introduce DDD.
39
+
40
+
### Functional Intermediate Expression:
41
+
42
+
Building upon the concept of arithmetic intermediate expressions, ospf can also encapsulate non-arithmetic expressions such as logical operations into intermediate expressions.
When ospf translates the model into interfaces for specific solvers, it automatically adds the intermediate variables and constraints required for each intermediate expressions. This translation process is transparent to the users, so the users don't need to know how the intermediate expressions are implemented through which intermediate variables and constraints. For example, the expression $FuncSymbol = \bigvee_{i} x_{i}$ will be translated as follows:
50
+
51
+
$$
52
+
s.t. \quad y = 1, \; \\ \; \\
53
+
\begin{cases}
54
+
y \geq \frac{x_{i}}{\sup_{\leq}(x_{i})}, & \sup_{\leq}(x_{i}) > 1 \\ \;
55
+
y \geq x_{i}, & else
56
+
\end{cases} \\ \; \\
57
+
y \leq \sum_{i} x_{i}, \; \forall i \\ \; \\
58
+
y \in \{ 0, 1 \}
59
+
$$
60
+
61
+
Of course, you can also extend these intermediate expressions according to your own business requirements. At this point, you need to implement some interfaces to let ospf know which intermediate variables and constraints need to be added for these intermediate expressions.
62
+
63
+
The <em>ospf-core</em> only maintains arithmetic and logical functions. In fact, we can design and implement functional intermediate expressions based entirely on the domain, as part of domain engineering. For specific references, you can refer to the development package for specific problem domains in the <em>ospf-framework</em>.
25
64
26
65
## Components
27
66
@@ -45,11 +84,11 @@ each OSPF implementation consists of the following components:
45
84
- <strong>core-plugin-heuristic</strong>: meta-heuristic algorithm plugins containing implementations of various common meta-heuristic algorithms.
46
85
- <strong>framework</strong>: problem-specific frameworks containing implementations of data processing, mathematical models, and solving algorithms tailored to specific problems. All designs and implementations are non-intrusive, allowing users to use them out of the box or extend them seamlessly, integrating with other frameworks or components.
47
86
- <strong>framework-plugin-XXX</strong>: framework plugins implementing functionalities requiring middleware involvement, such as data persistence, asynchronous message communication.
48
-
- <strong>bpp1d</strong>: 1d bin packing problem development package containing implementations of data processing, mathematical models, and solving algorithms for various one-dimensional bin packing problems.
49
-
- <strong>bpp2d</strong>: 2d bin packing problem development package containing implementations of data processing, mathematical models, and solving algorithms for various two-dimensional bin packing problems.
50
-
- <strong>bpp3d</strong>: 3d bin packing problem development package containing implementations of data processing, mathematical models, and solving algorithms for various three-dimensional bin packing problems.
51
-
- <strong>csp1d</strong>: 1d cutting stock problem development package containing implementations of data processing, mathematical models, and solving algorithms for various one-dimensional cutting stock problems.
52
-
- <strong>csp2d</strong>: 2d cutting stock problem development package containing implementations of data processing, mathematical models, and solving algorithms for various two-dimensional cutting stock problems.
87
+
- <strong>bpp1d</strong>: 1D <strong><em>Bin Packing Problem</em></strong> (BPP) development package containing implementations of data processing, mathematical models, and solving algorithms for various 1D BPPs.
88
+
- <strong>bpp2d</strong>: 2D <strong><em>Bin Packing Problem</em></strong> (BPP) development package containing implementations of data processing, mathematical models, and solving algorithms for various 2D BPPs.
89
+
- <strong>bpp3d</strong>: 3D <strong><em>Bin Packing Problem</em></strong> (BPP) development package containing implementations of data processing, mathematical models, and solving algorithms for various 3D BPPs.
90
+
- <strong>csp1d</strong>: 1D <strong><em>Cutting Stock Problem</em></strong> (CSP) development package containing implementations of data processing, mathematical models, and solving algorithms for various 1D CSPs.
91
+
- <strong>csp2d</strong>: 2D <strong><em>Cutting Stock Problem</em></strong> (CSP) development package containing implementations of data processing, mathematical models, and solving algorithms for various 2D CSPs.
53
92
- <strong>gantt-scheduling</strong>: gantt scheduling problem development package containing implementations of data processing, mathematical models, and solving algorithms for various Gantt chart scheduling problems. It can be used for scheduling and planning problems such as <strong><em>Advanced Production Scheduling</em></strong> (APS), <strong><em>Lot Scheduling Problem</em></strong> (LSP), etc.
54
93
- <strong>network-scheduling</strong>: network scheduling problem development package containing implementations of data processing, mathematical models, and solving algorithms for various network scheduling problems. It can be used for scheduling and planning problems such as <strong><em>Vehicle Routing Problem</em></strong> (VRP), <strong><em>Facility Location Problem</em></strong> (FLP), etc.
0 commit comments