Skip to content

Commit

Permalink
ASCII plots more colorful + distribution of solutions (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
mj-xmr committed Aug 11, 2022
1 parent 432488d commit 79489f4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion externals/tsqsim
Submodule tsqsim updated 1 files
+1 −1 externals/EnjoLib
5 changes: 4 additions & 1 deletion src/opti-lib/src/OptiEnProfitResults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ using namespace EnjoLib;
/// TODO: UTest & refactor
void OptimizerEnProfit::PrintSolution(const EnjoLib::Matrix & bestMat) const
{
ELO
const int currHour = TimeUtil().GetCurrentHour();
OptiSubjectEnProfit osub(m_dataModel);
osub.GetVerbose(bestMat, true);
Expand All @@ -31,10 +32,12 @@ void OptimizerEnProfit::PrintSolution(const EnjoLib::Matrix & bestMat) const
const DistribData & distribDat = distr.GetDistrib(m_goals);
if (distribDat.IsValid())
{
const Str & dstr = distr.PlotLine(distribDat, false, true, true);
LOG << Nl << "Distribution of solutions:" << Nl<< dstr << Nl;
//GnuplotPlotTerminal2d(distribDat.data, "Solution distribution", 1, 0.5);
}
Str cmds = "";
ELO

LOG << "\nComputer start schedule:\n";
Osstream oss;
for (int i = 0; i < bestMat.size(); ++i)
Expand Down
1 change: 1 addition & 0 deletions src/opti-lib/src/OptiEnProfitSubject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ double OptiSubjectEnProfit::GetVerbose(const EnjoLib::Matrix & dataMat, bool ver
LOG << "Energy input [A] :\n" << AsciiPlot::Build()(Par::MAXIMUM, m_prod.Max()).Finalize().Plot(m_prod) << Nl;
LOG << "Bat charge [Ah]:\n" << AsciiPlot::Build()(Par::MAXIMUM, batteryCopy.m_maxCapacityAmph)
(Par::MINIMUM, m_dataModel.GetBatPars().MIN_LOAD_AMPH)(Par::COLORS, true)
(Par::MULTILINE, true)
.Finalize().Plot(m_loads) << Nl;
LOG << "Total usage [A] :\n" << AsciiPlot::Build()(Par::MAXIMUM, batteryCopy.pars.MAX_DISCHARGE_AMP)
(Par::COLORS, true)
Expand Down
16 changes: 11 additions & 5 deletions src/opti-lib/src/OptimizerEnProfit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "TimeUtil.h"

#include <Math/GeneralMath.hpp>
#include <Math/RandomMath.hpp>
#include <Util/ProgressMonit.hpp>
#include <Util/ProgressMonitHigh.hpp>
#include <Util/CharManipulations.hpp>
Expand All @@ -27,9 +28,7 @@
#include <Statistical/Statistical.hpp>
#include <Statistical/Distrib.hpp>
#include <Template/CorradePointer.h>

#include <Math/RandomMath.hpp>
#include <Math/GeneralMath.hpp>
#include <Visual/AsciiPlot.hpp>

#include <STD/VectorCpp.hpp>
#include <STD/Set.hpp>
Expand Down Expand Up @@ -105,12 +104,19 @@ void OptimizerEnProfit::RandomSearch()
std::set<std::string> usedCombinations;
int alreadyCombined = 0;
const GMat gmat;
ProgressMonitHigh progressMonitor;
//const Distrib distr;
ProgressMonitHigh progressMonitor(20);
for (int i = 0; i < MAX_NUM_COMBINATIONS; ++i)
{
if (i % 100000 == 0)
{
progressMonitor.PrintProgressBarTime(i, MAX_NUM_COMBINATIONS);
progressMonitor.PrintProgressBarTime(i, MAX_NUM_COMBINATIONS, "Solutions");
//if (i > 0)
{
//const DistribData & data = distr.GetDistrib(m_goals, 20); const Str & dstr = distr.PlotLine(data, true, true, true);
//progressMonitor.PrintProgressBarTime(i, MAX_NUM_COMBINATIONS, dstr);
}

}
const int icomp = gmat.round(rmath.Rand(0, numComputers-1));
//for (int icomp = 0; icomp < numComputers; ++icomp)
Expand Down

0 comments on commit 79489f4

Please sign in to comment.