• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SMTorg / smt-optim / 28686583443

03 Jul 2026 10:47PM UTC coverage: 79.757% (-7.4%) from 87.112%
28686583443

Pull #13

github

web-flow
Merge 9d44a36d2 into f08badaa8
Pull Request #13: Feat/multi objective

294 of 760 new or added lines in 13 files covered. (38.68%)

79 existing lines in 5 files now uncovered.

3944 of 4945 relevant lines covered (79.76%)

1.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.61
/src/smt_optim/benchmarks/multiobj/constrained.py
1
import numpy as np
2✔
2

3
from smt_optim.benchmarks.base import BenchmarkProblem
2✔
4

5

6
class BNH(BenchmarkProblem):
2✔
7
    def __init__(self):
2✔
8
        super().__init__()
2✔
9

10
        self.name: str = "BNH"
2✔
11

12
        self.num_dim: int = 2
2✔
13
        self.num_obj: int = 2
2✔
14
        self.num_cstr: int = 2
2✔
15
        self.num_fidelity = 1
2✔
16

17
        self.tags = [
2✔
18
            "multi-obj",
19
        ]
20

21
        self.bounds = np.array(
2✔
22
            [
23
                [0, 5],
24
                [0, 3],
25
            ]
26
        )
27

28
        self.objective = [
2✔
29
            self.f1,
30
            self.f2,
31
        ]
32

33
        self.constraints = [
2✔
34
            self.g1,
35
            self.g2,
36
        ]
37

38
    def f1(self, x):
2✔
39
        return 4 * x[0] ** 2 + 4 * x[1] ** 2
2✔
40

41
    def f2(self, x):
2✔
42
        return (x[0] - 5) ** 2 + (x[1] - 5) ** 2
2✔
43

44
    def g1(self, x):
2✔
45
        return (x[0] - 5) ** 2 + x[1] ** 2 - 25
2✔
46

47
    def g2(self, x):
2✔
48
        return -((x[0] - 8) ** 2) - (x[1] + 3) ** 2 + 7.7
2✔
49

50

51
class TNK(BenchmarkProblem):
2✔
52
    def __init__(self):
2✔
53
        super().__init__()
2✔
54

55
        self.name: str = "TNK"
2✔
56

57
        self.num_dim: int = 2
2✔
58
        self.num_obj: int = 2
2✔
59
        self.num_cstr: int = 2
2✔
60
        self.num_fidelity = 1
2✔
61

62
        self.tags = [
2✔
63
            "multi-obj",
64
        ]
65

66
        self.bounds = np.array(
2✔
67
            [
68
                [0, np.pi],
69
                [0, np.pi],
70
            ]
71
        )
72

73
        self.objective = [
2✔
74
            self.f1,
75
            self.f2,
76
        ]
77

78
        self.constraints = [
2✔
79
            self.g1,
80
            self.g2,
81
        ]
82

83
    def f1(self, x):
2✔
84
        return x[0]
2✔
85

86
    def f2(self, x):
2✔
87
        return x[1]
2✔
88

89
    def g1(self, x):
2✔
90
        return -(x[0] ** 2) - x[1] ** 2 + 1 + 0.1 * np.cos(16 * np.arctan(x[0] / x[1]))
2✔
91

92
    def g2(self, x):
2✔
93
        return (x[0] - 0.5) ** 2 + (x[1] - 0.5) ** 2 - 0.5
2✔
94

95

96
class OSY(BenchmarkProblem):
2✔
97
    def __init__(self):
2✔
98
        super().__init__()
2✔
99

100
        self.name: str = "OSY"
2✔
101

102
        self.num_dim: int = 6
2✔
103
        self.num_obj: int = 2
2✔
104
        self.num_cstr: int = 6
2✔
105
        self.num_fidelity = 1
2✔
106

107
        self.tags = [
2✔
108
            "multi-obj",
109
        ]
110

111
        self.bounds = np.array(
2✔
112
            [
113
                [0.0, 10.0],
114
                [0.0, 10.0],
115
                [0.0, 5.0],
116
                [0.0, 6.0],
117
                [0.0, 5.0],
118
                [0.0, 10.0],
119
            ]
120
        )
121

122
        self.objective = [
2✔
123
            self.f1,
124
            self.f2,
125
        ]
126

127
        self.constraints = [
2✔
128
            self.g1,
129
            self.g2,
130
            self.g3,
131
            self.g4,
132
            self.g5,
133
            self.g6,
134
        ]
135

136
    def f1(self, x):
2✔
137
        return -(
2✔
138
            25 * (x[0] - 2) ** 2
139
            + (x[1] - 2) ** 2
140
            + (x[2] - 1) ** 2
141
            + (x[3] - 4) ** 2
142
            + (x[4] - 1) ** 2
143
        )
144

145
    def f2(self, x):
2✔
146
        return np.sum(x**2)
2✔
147

148
    def g1(self, x):
2✔
149
        return -x[0] - x[1] + 2
2✔
150

151
    def g2(self, x):
2✔
152
        return -6 + x[0] + x[1]
2✔
153

154
    def g3(self, x):
2✔
155
        return -2 + x[1] - x[0]
2✔
156

157
    def g4(self, x):
2✔
158
        return -2 + x[0] - 3 * x[1]
2✔
159

160
    def g5(self, x):
2✔
161
        return -4 + (x[2] - 3) ** 2 + x[3]
2✔
162

163
    def g6(self, x):
2✔
164
        return -((x[4] - 3) ** 2) - x[5] + 4
2✔
165

166

167
if __name__ == "__main__":
2✔
NEW
168
    pass
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc