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

SMTorg / smt-optim / 28686250335

03 Jul 2026 10:35PM UTC coverage: 79.634% (-7.5%) from 87.112%
28686250335

Pull #13

github

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

307 of 771 new or added lines in 13 files covered. (39.82%)

3 existing lines in 1 file now uncovered.

3957 of 4969 relevant lines covered (79.63%)

1.59 hits per line

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

98.63
/src/smt_optim/benchmarks/multiobj/constrained.py
1

2

3

4
import numpy as np
2✔
5
import smt.design_space as ds
2✔
6

7
from smt_optim.benchmarks.base import BenchmarkProblem
2✔
8

9

10
class BNH(BenchmarkProblem):
2✔
11

12
    def __init__(self):
2✔
13
        super().__init__()
2✔
14

15
        self.name: str = "BNH"
2✔
16

17
        self.num_dim: int = 2
2✔
18
        self.num_obj: int = 2
2✔
19
        self.num_cstr: int = 2
2✔
20
        self.num_fidelity = 1
2✔
21

22
        self.tags = [
2✔
23
            "multi-obj",
24
        ]
25

26
        self.bounds = np.array([
2✔
27
            [0, 5],
28
            [0, 3],
29
        ])
30

31
        self.objective = [
2✔
32
            self.f1, self.f2,
33
        ]
34

35
        self.constraints = [
2✔
36
            self.g1,
37
            self.g2,
38
        ]
39

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

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

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

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

52

53
class TNK(BenchmarkProblem):
2✔
54

55
    def __init__(self):
2✔
56
        super().__init__()
2✔
57

58
        self.name: str = "TNK"
2✔
59

60
        self.num_dim: int = 2
2✔
61
        self.num_obj: int = 2
2✔
62
        self.num_cstr: int = 2
2✔
63
        self.num_fidelity = 1
2✔
64

65
        self.tags = [
2✔
66
            "multi-obj",
67
        ]
68

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

74
        self.objective = [
2✔
75
            self.f1, 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

98
    def __init__(self):
2✔
99
        super().__init__()
2✔
100

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

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

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

112
        self.bounds = np.array([
2✔
113
            [0., 10.],
114
            [0., 10.],
115
            [0., 5.],
116
            [0., 6.],
117
            [0., 5.],
118
            [0., 10.],
119
        ])
120

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

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

134
    def f1(self, x):
2✔
135
        return -(25*(x[0] - 2)**2 + (x[1] - 2)**2 + (x[2] - 1)**2 + (x[3] - 4)**2 + (x[4] - 1)**2)
2✔
136

137
    def f2(self, x):
2✔
138
        return np.sum(x**2)
2✔
139

140
    def g1(self, x):
2✔
141
        return -x[0] - x[1] + 2
2✔
142

143
    def g2(self, x):
2✔
144
        return -6 + x[0] + x[1]
2✔
145

146
    def g3(self, x):
2✔
147
        return -2 + x[1] - x[0]
2✔
148

149
    def g4(self, x):
2✔
150
        return -2 + x[0] - 3*x[1]
2✔
151

152
    def g5(self, x):
2✔
153
        return -4 + (x[2] - 3)**2 + x[3]
2✔
154

155
    def g6(self, x):
2✔
156
        return -(x[4] - 3)**2 - x[5] + 4
2✔
157

158

159
if __name__ == "__main__":
2✔
NEW
160
    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