Commit 50cbba70 authored by 刘乐's avatar 刘乐

1, 优化调度接口bug修改

parent bb927ba0
......@@ -11,8 +11,10 @@ CivHydrTest::~CivHydrTest()
// 优化调度测试
void CivOptSchedulingTest::test(char* uri)
{
std::string condtionMap = "{\"JD0000159\":{\"min\":20,\"max\":48},\"JD0000324\":{\"min\":20,\"max\":48},\"JD0000416\":{\"min\":20,\"max\":48},\"JD0000422\":{\"min\":20,\"max\":48},\"JD0000457\":{\"min\":20,\"max\":48},\"JD0000532\":{\"min\":20,\"max\":48},\"JD0000538\":{\"min\":20,\"max\":48},\"JD0000582\":{\"min\":20,\"max\":48},\"JD0000648\":{\"min\":20,\"max\":48},\"JD0000652\":{\"min\":20,\"max\":48},\"JD0000665\":{\"min\":20,\"max\":48},\"JD0000703\":{\"min\":20,\"max\":48},\"JD0000724\":{\"min\":20,\"max\":48}}";
int time = 9;
std::string condtionMap = "{\"bcdd358e-1925-47be-8e20-d93999e33c1c\":{\"min\":30, \"max\" : 40}, \
\"fd605205-c10e-4f7e-81a4-89c88166e763\" : {\"min\":50, \"max\" : 60}, \"c446cc2c-4110-406a-bda1-4f9544e38cb4\" : {\"min\":70, \"max\" : 80}}";
// std::string condtionMap = "{\"JD0000159\":{\"min\":20,\"max\":48},\"JD0000324\":{\"min\":20,\"max\":48},\"JD0000416\":{\"min\":20,\"max\":48},\"JD0000422\":{\"min\":20,\"max\":48},\"JD0000457\":{\"min\":20,\"max\":48},\"JD0000532\":{\"min\":20,\"max\":48},\"JD0000538\":{\"min\":20,\"max\":48},\"JD0000582\":{\"min\":20,\"max\":48},\"JD0000648\":{\"min\":20,\"max\":48},\"JD0000652\":{\"min\":20,\"max\":48},\"JD0000665\":{\"min\":20,\"max\":48},\"JD0000703\":{\"min\":20,\"max\":48},\"JD0000724\":{\"min\":20,\"max\":48}}";
int time = 17;
char* condition = const_cast<char*>(condtionMap.c_str());
......
......@@ -209,7 +209,8 @@ double GenAlg::fitnessfunction(float cost, map<string, double>& monitorValues)
{
// 计算适应
double objVal = mOptScheduling->objectiveFunction(cost, monitorValues);
return objVal;
return objVal > 0?objVal:0.0;
}
void GenAlg::decoding(vector<map<string, float>>& genVals)
......@@ -235,7 +236,7 @@ void GenAlg::updateGenomeFitNess(int index, double fitNess)
if (index < 0 || index >= vecPop.size())
return;
vecPop[index].fitness = fitNess;
vecPop[index].fitness = fitNess>0?fitNess:0.0;
}
void GenAlg::crossover(const vector<Genome>& parent, vector<Genome>& son)
......
......@@ -216,13 +216,14 @@ void CivOptSchedEngine::schedulingResultToJson(string& json)
if (monitorIter != mMonitorsSnMap.end())
{
monitorName = monitorIter->second;
json.append("\"" + monitorName + "\":[");
json.append(to_string(beforeMonitorVal));
json.append(",");
json.append(to_string(afterMonitorvVal));
json.append("],");
}
json.append("\""+monitorName+"\":[");
json.append(to_string(beforeMonitorVal));
json.append(",");
json.append(to_string(afterMonitorvVal));
json.append("],");
}
json = json.substr(0, json.length() - 1);
json.append("}");
......
......@@ -134,7 +134,19 @@ void CivPumpHelper::getMonitors(vector<string>& monitors,map<string,string>& mon
map<string, string> tempMap = tempMapVec[i];
string szNo = tempMap.find("本点号")->second;
string code = tempMap.find("code")->second;
monitors.push_back(szNo);
monitorMap.insert(pair<string, string>(szNo, code));
auto mIter = std::find(monitors.begin(), monitors.end(), szNo);
if (mIter != monitors.end())
{
monitorMap.insert(pair<string, string>(szNo, code));
}
mIter = std::find(monitors.begin(), monitors.end(), code);
if (mIter != monitors.end())
{
monitorMap.insert(pair<string, string>(szNo, code));
}
}
}
\ No newline at end of file
#pragma once
#include "pandaInpCore.h"
/**
inpļ
*/
class CivInpExporter
class PANDAINPCORE_API CivInpExporter
{
public:
CivInpExporter();
......
#include "CivInpImpoter.h"
#include "CivSysLog.h"
// #include "CivSysLog.h"
#include <stdio.h>
CivInpImpoter::CivInpImpoter()
......@@ -14,7 +14,7 @@ CivInpImpoter::~CivInpImpoter()
int CivInpImpoter::handleline(int linenum, char* text)
{
printf("line[%d]=[%s]\n", linenum, text);
printf("line[%d]=%s\n", linenum, text);
return 0;
}
......@@ -23,13 +23,13 @@ bool CivInpImpoter::load(const std::string& inppath)
FILE* fp;
int linenum;
char* p, buf[1024];
CivSysLog::getInstance()->info("开始解析:"+inppath, "CivInpImpoter", __FUNCTION__);
// CivSysLog::getInstance()->info("开始解析:"+inppath, "CivInpImpoter", __FUNCTION__);
// 打开文件
fp = fopen(inppath.c_str(), "r");
if (fp == NULL)
{
std::string errInfo = "打开文件: " + inppath + "失败!";
CivSysLog::getInstance()->error(errInfo, "CivInpImpoter", __FUNCTION__);
/* std::string errInfo = "打开文件: " + inppath + "失败!";
CivSysLog::getInstance()->error(errInfo, "CivInpImpoter", __FUNCTION__);*/
return false;
}
......@@ -55,8 +55,8 @@ bool CivInpImpoter::load(const std::string& inppath)
// 处理解析的行数据
if (handleline(linenum, p) != 0) {
std::string errInfo = "不能解析第:" + std::to_string(linenum) + "行,跳过";
CivSysLog::getInstance()->warning(errInfo, "CivInpImpoter", __FUNCTION__);
/* std::string errInfo = "不能解析第:" + std::to_string(linenum) + "行,跳过";
CivSysLog::getInstance()->warning(errInfo, "CivInpImpoter", __FUNCTION__);*/
continue;
}
}
......
#pragma once
#include "pandaInpCore.h"
#include <string>
/**
inp文件导入类
*/
class CivInpImpoter
class PANDAINPCORE_API CivInpImpoter
{
public:
CivInpImpoter();
......
#pragma once
#include "CivInpSubject.h"
#include "pandaInpCore.h"
#include <list>
class CivInpSubject;
......@@ -13,13 +15,13 @@ public:
virtual ~CivInpObserver();
/**
*@brief 状态更新,具体子类实现
* @brief 状态更新,具体子类实现
* @param [sub] 给观察者
*/
virtual void update(CivInpSubject* sub) = 0;
/**
*@brief 登记被观察的对象
* @brief 登记被观察的对象
* @param [subject] 具体的被观察者
*/
void subject(CivInpSubject* subject);
......
#include <iostream>
#include "CivInpImpoter.h"
int main(char* argc, char** argv)
{
CivInpImpoter importer;
if (!importer.load("D:\\work\\hydr\\hModelProgram\\Program\\test.inp"))
{
}
getchar();
return 0;
}
\ No newline at end of file
......@@ -47,7 +47,7 @@
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
......@@ -131,7 +131,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;PANDAINPCORE_DLL;PANDAINPCORE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;PANDAINPCORE_DLL;PANDAINPCORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(OUTDIR)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
......@@ -140,7 +140,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>pandaLog.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<ImportLibrary>$(OutDir)..\lib\$(TargetName).lib</ImportLibrary>
</Link>
</ItemDefinitionGroup>
......@@ -159,6 +159,7 @@
<ClCompile Include="CivInpObserver.cpp" />
<ClCompile Include="CivInpSubject.cpp" />
<ClCompile Include="CivInpVector.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
......
......@@ -30,6 +30,9 @@
<ClCompile Include="CivInpExporter.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>头文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="CivInpExporter.h">
......
......@@ -12,10 +12,12 @@ public:
virtual void OnFinalMessage(HWND hWnd);
virtual void InitWindow();
virtual LRESULT ResponseDefaultKeyEvent(WPARAM wParam);
virtual CDuiString GetSkinFile();
virtual CDuiString GetSkinFolder();
virtual UILIB_RESOURCETYPE GetResourceType() const;
virtual CControlUI* CreateControl(LPCTSTR pstrClass);
virtual LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
virtual LRESULT HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
virtual LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
......
#pragma once
#include "pandaWaterCore.h"
class CivConnection;
/**
属性表类
*/
class CivAttributeTable
class PANDAWATERCORELIB_API CivAttributeTable
{
public:
// 属性表类型
......
......@@ -2,6 +2,7 @@
#include <string>
#include <map>
#include "CivVariant.h"
#include "pandaWaterCore.h"
using namespace std;
......@@ -10,7 +11,7 @@ class CivVariant;
/**
属性类
*/
class CivAttributes
class PANDAWATERCORELIB_API CivAttributes
{
public:
typedef pair<string, CivVariant> Pair;
......
......@@ -2,16 +2,17 @@
#include "CivAttributes.h"
#include "CivGeometry.h"
#include "pandaWaterCore.h"
/**
要素类
*/
class CivFeature
class PANDAWATERCORELIB_API CivFeature
{
public:
typedef int FeatureId;
CivFeature(const CivGeometry& geom );
explicit CivFeature(const CivGeometry& geom );
CivFeature() = default;
~CivFeature();
/**
......
......@@ -4,12 +4,13 @@
#include <map>
#include "CivPoint.h"
#include "pandaWaterCore.h"
typedef std::string String;
/**
空间几何体对象
*/
class CivGeometry
class PANDAWATERCORELIB_API CivGeometry
{
public:
// 几何体类型
......@@ -33,7 +34,10 @@ public:
// 几何体类型
GeometryType type() const { return mGeometryType; }
/*几何体对象序列化*/
/**
* @brief 几何体对象序列化
* @param [text] 根据文本文件生成集合体对象
*/
String toJson() const;
private:
......
#pragma once
#include "pandaWaterCore.h"
/**
Ԫ
*/
class CivMetaType {
class PANDAWATERCORELIB_API CivMetaType {
public:
enum Type
{
......
#pragma once
#include "pandaWaterCore.h"
/**
*/
class CivPoint
class PANDAWATERCORELIB_API CivPoint
{
public:
/**
......
#pragma once
#include "CivMetaType.h"
#include "pandaWaterCore.h"
/**
ԭ
*/
class CivVariant
class PANDAWATERCORELIB_API CivVariant
{
public:
typedef CivMetaType::Type Type;
......
#pragma once
# if defined(PANDAWATERCORELIB_EXPORTS)
# if defined(_MSC_VER)
# define PANDAWATERCORELIB_API __declspec(dllexport)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment