Skip to content

Commit 4138c10

Browse files
committed
Resolving other merge failures
1 parent 1813dfb commit 4138c10

File tree

20 files changed

+359
-315
lines changed

20 files changed

+359
-315
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: 'false'
5+
AllowAllParametersOfDeclarationOnNextLine: 'true'
66
AllowShortLoopsOnASingleLine : 'false'
77
AllowShortIfStatementsOnASingleLine: 'false'
88
AlwaysBreakTemplateDeclarations: 'Yes'

lib/CMakeLists.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@ if(${with_python})
2929
# Targets for poek testing
3030
#
3131
if(${with_tests})
32-
list(APPEND lib_test_targets "test_poek")
32+
list(APPEND lib_test_targets test_poek test_pyomo test_coek_utils)
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+
)
3642
endif()
3743
#
3844
# Targets for poek documentation
@@ -86,6 +92,16 @@ else()
8692
message("Ignoring lib/pyomo_coek")
8793
endif()
8894

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+
89105
#
90106
# Lib test targets
91107
#

lib/coek/coek/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ 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
5253
)
5354
endif()
5455

lib/coek/coek/ast/visitor_to_list.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@ 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-
{
74-
std::stringstream sstr;
75-
sstr << tmp->coef;
76-
repr.push_back(sstr.str());
77-
}
73+
repr.push_back(std::to_string(tmp->coef));
7874
if (tmp->var->name.size() == 0) {
7975
// WEH - It's hard to test this logic, since the variable index is dynamically generated
8076
// 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

lib/coek/coek/util/template_utils.hpp

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

3+
#include <map>
4+
#include <set>
5+
36
namespace coek {
47

8+
// count_args
9+
510
template <typename... Args>
611
constexpr std::size_t count_args(Args...)
712
{
813
return sizeof...(Args);
914
}
1015

16+
// has_nonintegral_args
17+
1118
template <typename... ARGS>
1219
struct has_nonintegral_args {
1320
static constexpr bool value = false;
@@ -19,4 +26,36 @@ struct has_nonintegral_args<T, Args...> {
1926
= !std::is_integral<T>::value || has_nonintegral_args<Args...>::value;
2027
};
2128

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+
2261
} // namespace coek

lib/coek/test/smoke/test_con.cpp

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,20 @@ TEST_CASE("elementary_constraint", "[smoke]")
361361
WHEN("v < v")
362362
{
363363
auto e = v < v;
364-
static std::list<std::string> baseline = {
365-
"[", "<", "-Inf", "[", "+", "v", "[", "*", "-1", "v", "]", "]", std::to_string(0.0),
366-
"]"};
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+
"]"};
367378
REQUIRE(e.to_list() == baseline);
368379
}
369380

@@ -669,7 +680,7 @@ TEST_CASE("elementary_constraint", "[smoke]")
669680
"v",
670681
"[",
671682
"*",
672-
"-1",
683+
std::to_string(-1.0),
673684
"v",
674685
"]",
675686
"]",
@@ -934,8 +945,10 @@ TEST_CASE("elementary_constraint", "[smoke]")
934945
WHEN("v == v")
935946
{
936947
auto e = v == v;
937-
static std::list<std::string> baseline = {
938-
"[", "==", "[", "+", "v", "[", "*", "-1", "v", "]", "]", std::to_string(0.0), "]"};
948+
static std::list<std::string> baseline = {"[", "==", "[", "+",
949+
"v", "[", "*", std::to_string(-1.0),
950+
"v", "]", "]", std::to_string(0.0),
951+
"]"};
939952
REQUIRE(e.to_list() == baseline);
940953
}
941954

@@ -1185,9 +1198,20 @@ TEST_CASE("elementary_constraint", "[smoke]")
11851198
WHEN("v > v")
11861199
{
11871200
auto e = v > v;
1188-
static std::list<std::string> baseline = {
1189-
"[", "<", "-Inf", "[", "+", "v", "[", "*", "-1", "v", "]", "]", std::to_string(0.0),
1190-
"]"};
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+
"]"};
11911215
REQUIRE(e.to_list() == baseline);
11921216
}
11931217

@@ -1445,7 +1469,7 @@ TEST_CASE("elementary_constraint", "[smoke]")
14451469
"v",
14461470
"[",
14471471
"*",
1448-
"-1",
1472+
std::to_string(-1.0),
14491473
"v",
14501474
"]",
14511475
"]",

0 commit comments

Comments
 (0)