Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hydraulicModel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘乐
hydraulicModel
Commits
dd384c8d
Commit
dd384c8d
authored
Oct 15, 2020
by
刘乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1, 直接优化调度接口添加
parent
073ea36f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
131 additions
and
11 deletions
+131
-11
main.cpp
funcDemo/main.cpp
+1
-0
OptSchedulingGenetic.cpp
pandaAlgorithm/OptSchedulingGenetic.cpp
+53
-0
OptSchedulingGenetic.h
pandaAlgorithm/OptSchedulingGenetic.h
+57
-0
genetic.h
pandaAlgorithm/genetic.h
+11
-11
pandaAlgorithm.vcxproj
pandaAlgorithm/pandaAlgorithm.vcxproj
+2
-0
pandaAlgorithm.vcxproj.filters
pandaAlgorithm/pandaAlgorithm.vcxproj.filters
+7
-0
No files found.
funcDemo/main.cpp
View file @
dd384c8d
...
...
@@ -72,6 +72,7 @@ int main(int argc, char* argv[])
context
.
setHydrTest
(
new
CivWaterSupplyScopeTest
());
context
.
contextTest
(
findUri
);
break
;
case
7
:
//6.测试水源供水范围
context
.
setHydrTest
(
new
CivProjSimulationTest
());
context
.
contextTest
(
findUri
);
...
...
pandaAlgorithm/OptSchedulingGenetic.cpp
0 → 100644
View file @
dd384c8d
#include "OptSchedulingGenetic.h"
OptSchedulingGenetic
::
OptSchedulingGenetic
(
std
::
shared_ptr
<
OptScheduling
*>&
optPtr
)
:
mOptPtr
(
optPtr
)
{
}
OptSchedulingGenetic
::~
OptSchedulingGenetic
()
{
}
void
OptSchedulingGenetic
::
initPop
()
{
}
void
OptSchedulingGenetic
::
fitNess
()
{
}
void
OptSchedulingGenetic
::
select
()
{
}
void
OptSchedulingGenetic
::
coding
()
{
}
void
OptSchedulingGenetic
::
decoding
()
{
}
void
OptSchedulingGenetic
::
crossover
()
{
}
void
OptSchedulingGenetic
::
variation
()
{
}
void
OptSchedulingGenetic
::
update
()
{
}
pandaAlgorithm/OptSchedulingGenetic.h
0 → 100644
View file @
dd384c8d
#pragma once
#include "genetic.h"
#include "OptScheduling.h"
#include "pandaAlgorithm.h"
#include<memory>
/**
* 具体的遗传优化算法
*/
class
PANDAALGORITHM_API
OptSchedulingGenetic
:
public
Genetic
{
public
:
explicit
OptSchedulingGenetic
(
std
::
shared_ptr
<
OptScheduling
*>
&
optPtr
);
~
OptSchedulingGenetic
();
/**
*@brief 初始化种群
*/
virtual
void
initPop
();
/**
*@brief 计算种群自适应度
*/
virtual
void
fitNess
();
/**
*@brief 选择
*/
virtual
void
select
();
/**
*@brief 编码
*/
virtual
void
coding
();
/**
*@brief 解码
*/
virtual
void
decoding
();
/**
*@brief 交叉
*/
virtual
void
crossover
();
/**
*@brief 选择
*/
virtual
void
variation
();
/**
*@brief 更新种群
*/
virtual
void
update
();
private
:
std
::
shared_ptr
<
OptScheduling
*>
mOptPtr
;
};
pandaAlgorithm/genetic.h
View file @
dd384c8d
...
...
@@ -2,52 +2,52 @@
#include "pandaAlgorithm.h"
/**
遗传算法
对象
遗传算法
接口
*/
class
PANDAALGORITHM_API
Genetic
{
public
:
Genetic
();
~
Genetic
();
virtual
~
Genetic
();
/**
*@brief 初始化种群
*/
void
initPop
();
v
irtual
v
oid
initPop
();
/**
*@brief 计算种群自适应度
*/
void
fitNess
();
v
irtual
v
oid
fitNess
();
/**
*@brief 选择
*/
void
select
();
v
irtual
v
oid
select
();
/**
*@brief 编码
*/
void
coding
();
v
irtual
v
oid
coding
();
/**
*@brief 解码
*/
void
decoding
();
v
irtual
v
oid
decoding
();
/**
*@brief 交叉
*/
void
crossover
();
v
irtual
v
oid
crossover
();
/**
*@brief 选择
*/
void
variation
();
v
irtual
v
oid
variation
();
/**
*@brief 更新种群
*/
void
update
();
v
irtual
v
oid
update
();
void
setNumPop
(
int
numPop
)
{
mNumPop
=
numPop
;
}
int
numPop
()
const
{
return
mNumPop
;
}
...
...
@@ -71,7 +71,7 @@ public:
double
variationRate
()
const
{
return
mVariationRate
;
}
private
:
int
mNumPop
=
100
;
//初始种群大小
int
mNumPop
=
100
;
//初始种群大小
int
mIrangeL
=
-
1
;
// 问题解区间
int
mIrangeR
=
2
;
int
mLength
=
22
;
// 二进制编码长度
...
...
pandaAlgorithm/pandaAlgorithm.vcxproj
View file @
dd384c8d
...
...
@@ -151,12 +151,14 @@ copy genetic.h $(OutDir)..\include /y</Command>
<ClInclude
Include=
"FirstOptScheduling.h"
/>
<ClInclude
Include=
"genetic.h"
/>
<ClInclude
Include=
"OptScheduling.h"
/>
<ClInclude
Include=
"OptSchedulingGenetic.h"
/>
<ClInclude
Include=
"pandaAlgorithm.h"
/>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"FirstOptScheduling.cpp"
/>
<ClCompile
Include=
"genetic.cpp"
/>
<ClCompile
Include=
"OptScheduling.cpp"
/>
<ClCompile
Include=
"OptSchedulingGenetic.cpp"
/>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
<ImportGroup
Label=
"ExtensionTargets"
>
...
...
pandaAlgorithm/pandaAlgorithm.vcxproj.filters
View file @
dd384c8d
...
...
@@ -27,6 +27,9 @@
<ClInclude
Include=
"FirstOptScheduling.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"OptSchedulingGenetic.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"genetic.cpp"
>
...
...
@@ -38,5 +41,8 @@
<ClCompile
Include=
"FirstOptScheduling.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"OptSchedulingGenetic.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment