Skip to content

Commit

Permalink
scale
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Sep 14, 2023
1 parent 33f6a1d commit 61c85e8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/boxopt_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ TEST(BoxOptTest, BasicAssertions) {
constexpr auto fsoft = [](auto x) {
auto u0 = x[0];
auto u1 = x[1];
return fcore(u0, u1) + 0.125 * poly::math::softplus(8.0 * gcore(u0, u1));
return fcore(u0, u1) + 0.25 * poly::math::softplus(8.0 * gcore(u0, u1));
};
poly::utils::OwningArena<> arena;
double opt0 = poly::math::minimize(&arena, box, fsoft);
double u0 = box.transformed()[0];
double u1 = box.transformed()[1];
std::cout << "u0 = " << u0 << "; u1 = " << u1 << '\n';
EXPECT_LT(std::abs(3.4567 - u0), 1e-3);
EXPECT_LT(std::abs(7.8 - u1), 1e-3);
EXPECT_LT(std::abs(3.45128 - u0), 1e-3);
EXPECT_LT(std::abs(7.78878 - u1), 1e-3);
box.decreaseUpperBound(0, 3);
double opt1 = poly::math::minimize(&arena, box, fsoft);
EXPECT_LT(opt0, opt1);
double u01 = box.transformed()[0];
double u11 = box.transformed()[1];
std::cout << "u01 = " << u01 << "; u11 = " << u11 << '\n';
EXPECT_EQ(u01, 3.0);
EXPECT_LT(std::abs(9.132 - u11), 1e-3);
EXPECT_LT(std::abs(9.10293 - u11), 1e-3);

poly::math::Vector<int32_t> r{0, 0};
double opti = poly::math::minimizeIntSol(&arena, r, 1, 32, fsoft);
Expand Down

0 comments on commit 61c85e8

Please sign in to comment.