Skip to content

Commit

Permalink
Use (+) for max plus operator instead of i=unicode not displayed corr…
Browse files Browse the repository at this point in the history
…ectly by dear #11
  • Loading branch information
Lecrapouille committed Jan 9, 2024
1 parent 24a66fc commit 8174a53
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Editor/PetriEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void Editor::showDynamicLinearSystem() const
SparseMatrix<double> B; SparseMatrix<double> C;
toSysLin(m_net, D, A, B, C);
SparseMatrix<double>::display_for_julia = false;
ImGui::Text(u8"%s", "X(n) = D . X(n) A . X(n-1) B . U(n)\nY(n) = C . X(n)");
ImGui::Text(u8"%s", "X(n) = D . X(n) (+) A . X(n-1) (+) B . U(n)\nY(n) = C . X(n)");
ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags_None;
if (ImGui::BeginTabBar("syslin", tab_bar_flags))
{
Expand Down
8 changes: 4 additions & 4 deletions src/Net/Algorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ std::stringstream showCounterEquation(Net const& net, std::string const& comment
{
ss << "(t)";
}
separator2 = (minplus_notation ? " " : ", ");
separator2 = (minplus_notation ? " (+) " : ", ");
}
separator1 = (minplus_notation ? " " : ", ");
separator1 = (minplus_notation ? " (+) " : ", ");
}
ss << (minplus_notation ? "" : ")") << std::endl;
}
Expand Down Expand Up @@ -403,9 +403,9 @@ std::stringstream showDaterEquation(Net const& net, std::string const& comment,
}
ss << ")";

separator2 = (maxplus_notation ? " " : ", ");
separator2 = (maxplus_notation ? " (+) " : ", ");
}
separator1 = (maxplus_notation ? " " : ", ");
separator1 = (maxplus_notation ? " (+) " : ", ");
}
ss << (maxplus_notation ? "" : ")") << std::endl;
}
Expand Down
24 changes: 12 additions & 12 deletions tests/EventGraphTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,18 @@ TEST(TestEventGraph, TestToDaterEquation)
// --
expected.str(
"# Timed event graph represented as dater equation (max-plus algebra):\n"
"# T1(n) = 1 T0(n) 1 T2(n - 1) 1 T1(n - 2)\n"
"# T2(n) = 1 T1(n - 1) 2 T0(n)\n"
"# T3(n) = T1(n) T2(n)\n");
"# T1(n) = 1 T0(n) (+) 1 T2(n - 1) (+) 1 T1(n - 2)\n"
"# T2(n) = 1 T1(n - 1) (+) 2 T0(n)\n"
"# T3(n) = T1(n) (+) T2(n)\n");
obtained = showDaterEquation(net, "# ", false, true);
ASSERT_STREQ(obtained.str().c_str(), expected.str().c_str());

// --
expected.str(
"# Timed event graph represented as dater equation (max-plus algebra):\n"
"# x1(n) = 1 u(n) 1 x2(n - 1) 1 x1(n - 2)\n"
"# x2(n) = 1 x1(n - 1) 2 u(n)\n"
"# y(n) = x1(n) x2(n)\n");
"# x1(n) = 1 u(n) (+) 1 x2(n - 1) (+) 1 x1(n - 2)\n"
"# x2(n) = 1 x1(n - 1) (+) 2 u(n)\n"
"# y(n) = x1(n) (+) x2(n)\n");
obtained = showDaterEquation(net, "# ", true, true);
ASSERT_STREQ(obtained.str().c_str(), expected.str().c_str());
}
Expand Down Expand Up @@ -258,18 +258,18 @@ TEST(TestEventGraph, TestToCounterEquation)
// --
expected.str(
"# Timed event graph represented as counter equation (min-plus algebra):\n"
"# T1(t) = T0(t - 1) 1 T2(t - 1) 2 T1(t - 1)\n"
"# T2(t) = 1 T1(t - 1) T0(t - 2)\n"
"# T3(t) = T1(t) T2(t)\n");
"# T1(t) = T0(t - 1) (+) 1 T2(t - 1) (+) 2 T1(t - 1)\n"
"# T2(t) = 1 T1(t - 1) (+) T0(t - 2)\n"
"# T3(t) = T1(t) (+) T2(t)\n");
obtained = showCounterEquation(net, "# ", false, true);
ASSERT_STREQ(obtained.str().c_str(), expected.str().c_str());

// --
expected.str(
"# Timed event graph represented as counter equation (min-plus algebra):\n"
"# x1(t) = u(t - 1) 1 x2(t - 1) 2 x1(t - 1)\n"
"# x2(t) = 1 x1(t - 1) u(t - 2)\n"
"# y(t) = x1(t) x2(t)\n");
"# x1(t) = u(t - 1) (+) 1 x2(t - 1) (+) 2 x1(t - 1)\n"
"# x2(t) = 1 x1(t - 1) (+) u(t - 2)\n"
"# y(t) = x1(t) (+) x2(t)\n");
obtained = showCounterEquation(net, "# ", true, true);
ASSERT_STREQ(obtained.str().c_str(), expected.str().c_str());
}

0 comments on commit 8174a53

Please sign in to comment.