Skip to content

Commit 1813dfb

Browse files
committed
Merge branch 'main' of github.com:sandialabs/coek into dev
2 parents e10e206 + f80a4ff commit 1813dfb

File tree

20 files changed

+315
-359
lines changed

20 files changed

+315
-359
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
BasedOnStyle: Google
33
AlignTrailingComments: 'true'
44
AllowAllArgumentsOnNextLine: 'true'
5-
AllowAllParametersOfDeclarationOnNextLine: 'true'
5+
AllowAllParametersOfDeclarationOnNextLine: 'false'
66
AllowShortLoopsOnASingleLine : 'false'
77
AllowShortIfStatementsOnASingleLine: 'false'
88
AlwaysBreakTemplateDeclarations: 'Yes'

lib/CMakeLists.txt

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,10 @@ if(${with_python})
2929
# Targets for poek testing
3030
#
3131
if(${with_tests})
32-
list(APPEND lib_test_targets test_poek test_pyomo test_coek_utils)
32+
list(APPEND lib_test_targets "test_poek")
3333
add_custom_target(test_poek
3434
COMMAND ${Python_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/poek/poek
3535
)
36-
add_custom_target(test_coek_utils
37-
COMMAND ${Python_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/coek_utils/coek_utils
38-
)
39-
add_custom_target(test_pyomo
40-
COMMAND ${Python_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/pyomo_coek/pyomo_coek
41-
)
4236
endif()
4337
#
4438
# Targets for poek documentation
@@ -92,16 +86,6 @@ else()
9286
message("Ignoring lib/pyomo_coek")
9387
endif()
9488

95-
message("")
96-
if(${with_python})
97-
message("Configuring lib/coek_utils install")
98-
add_custom_target(pip_install_coek_utils ALL
99-
COMMAND ${Python_EXECUTABLE} -m pip install -e ${CMAKE_CURRENT_SOURCE_DIR}/coek_utils
100-
)
101-
else()
102-
message("Ignoring lib/coek_utils")
103-
endif()
104-
10589
#
10690
# Lib test targets
10791
#

lib/coek/coek/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ if (CMAKE_CXX_STANDARD GREATER_EQUAL 17)
4949
api/variable_array.cpp
5050
api/constraint_map.cpp
5151
api/subexpression_map.cpp
52-
util/DataPortal.cpp
5352
)
5453
endif()
5554

lib/coek/coek/ast/visitor_to_list.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ void visit_MonomialTerm(const expr_pointer_t& expr, std::list<std::string>& repr
7070
auto tmp = safe_pointer_cast<MonomialTerm>(expr);
7171
repr.push_back("[");
7272
repr.push_back("*");
73-
repr.push_back(std::to_string(tmp->coef));
73+
{
74+
std::stringstream sstr;
75+
sstr << tmp->coef;
76+
repr.push_back(sstr.str());
77+
}
7478
if (tmp->var->name.size() == 0) {
7579
// WEH - It's hard to test this logic, since the variable index is dynamically generated
7680
// GCOVR_EXCL_START

lib/coek/coek/model/writer_lp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,9 @@ void LPWriter::print_constraint(fmt::ostream& ostr, const Constraint& c, size_t
584584
}
585585
else {
586586
print_repn(ostr, expr, vid);
587-
// CALI_MARK_BEGIN("ELSE");
587+
//CALI_MARK_BEGIN("ELSE");
588588
ostr.print(fmt::format(eq_fmt, lower.value() - tmp));
589-
// CALI_MARK_END("ELSE");
589+
//CALI_MARK_END("ELSE");
590590
}
591591
}
592592

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
#pragma once
22

3-
#include <map>
4-
#include <set>
5-
63
namespace coek {
74

8-
// count_args
9-
105
template <typename... Args>
116
constexpr std::size_t count_args(Args...)
127
{
138
return sizeof...(Args);
149
}
1510

16-
// has_nonintegral_args
17-
1811
template <typename... ARGS>
1912
struct has_nonintegral_args {
2013
static constexpr bool value = false;
@@ -26,36 +19,4 @@ struct has_nonintegral_args<T, Args...> {
2619
= !std::is_integral<T>::value || has_nonintegral_args<Args...>::value;
2720
};
2821

29-
// is_std_set
30-
31-
template <typename>
32-
struct is_std_set : std::false_type {};
33-
34-
template <typename T>
35-
struct is_std_set<std::set<T>> : std::true_type {};
36-
37-
// is_std_map
38-
39-
template <typename>
40-
struct is_std_map : std::false_type {};
41-
42-
template <typename K, typename V>
43-
struct is_std_map<std::map<K, V>> : std::true_type {};
44-
45-
// is_std_vector
46-
47-
template <typename>
48-
struct is_std_vector : std::false_type {};
49-
50-
template <typename T>
51-
struct is_std_vector<std::vector<T>> : std::true_type {};
52-
53-
// is_std_tuple
54-
55-
template <typename>
56-
struct is_std_tuple : std::false_type {};
57-
58-
template <typename... T>
59-
struct is_std_tuple<std::tuple<T...>> : std::true_type {};
60-
6122
} // namespace coek

lib/coek/test/smoke/test_con.cpp

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -361,20 +361,9 @@ TEST_CASE("elementary_constraint", "[smoke]")
361361
WHEN("v < v")
362362
{
363363
auto e = v < v;
364-
static std::list<std::string> baseline = {"[",
365-
"<",
366-
"-Inf",
367-
"[",
368-
"+",
369-
"v",
370-
"[",
371-
"*",
372-
std::to_string(-1.0),
373-
"v",
374-
"]",
375-
"]",
376-
std::to_string(0.0),
377-
"]"};
364+
static std::list<std::string> baseline = {
365+
"[", "<", "-Inf", "[", "+", "v", "[", "*", "-1", "v", "]", "]", std::to_string(0.0),
366+
"]"};
378367
REQUIRE(e.to_list() == baseline);
379368
}
380369

@@ -680,7 +669,7 @@ TEST_CASE("elementary_constraint", "[smoke]")
680669
"v",
681670
"[",
682671
"*",
683-
std::to_string(-1.0),
672+
"-1",
684673
"v",
685674
"]",
686675
"]",
@@ -945,10 +934,8 @@ TEST_CASE("elementary_constraint", "[smoke]")
945934
WHEN("v == v")
946935
{
947936
auto e = v == v;
948-
static std::list<std::string> baseline = {"[", "==", "[", "+",
949-
"v", "[", "*", std::to_string(-1.0),
950-
"v", "]", "]", std::to_string(0.0),
951-
"]"};
937+
static std::list<std::string> baseline = {
938+
"[", "==", "[", "+", "v", "[", "*", "-1", "v", "]", "]", std::to_string(0.0), "]"};
952939
REQUIRE(e.to_list() == baseline);
953940
}
954941

@@ -1198,20 +1185,9 @@ TEST_CASE("elementary_constraint", "[smoke]")
11981185
WHEN("v > v")
11991186
{
12001187
auto e = v > v;
1201-
static std::list<std::string> baseline = {"[",
1202-
"<",
1203-
"-Inf",
1204-
"[",
1205-
"+",
1206-
"v",
1207-
"[",
1208-
"*",
1209-
std::to_string(-1.0),
1210-
"v",
1211-
"]",
1212-
"]",
1213-
std::to_string(0.0),
1214-
"]"};
1188+
static std::list<std::string> baseline = {
1189+
"[", "<", "-Inf", "[", "+", "v", "[", "*", "-1", "v", "]", "]", std::to_string(0.0),
1190+
"]"};
12151191
REQUIRE(e.to_list() == baseline);
12161192
}
12171193

@@ -1469,7 +1445,7 @@ TEST_CASE("elementary_constraint", "[smoke]")
14691445
"v",
14701446
"[",
14711447
"*",
1472-
std::to_string(-1.0),
1448+
"-1",
14731449
"v",
14741450
"]",
14751451
"]",

0 commit comments

Comments
 (0)