Init version
This commit is contained in:
33
DEC-0.0.cpp
Normal file
33
DEC-0.0.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <iostream>
|
||||
#include <ctime>
|
||||
#include "processor/KolchShindyalov.h"
|
||||
#include "processor/Processor.h"
|
||||
#include "processor/Settings.h"
|
||||
//#include "DerevyankoReport.h"
|
||||
#include "DerevyankoReport2014.h"
|
||||
|
||||
int main(int argc, char** argv){
|
||||
|
||||
/*if(argc < 2){
|
||||
std::cerr<<"No input file specified\nTrying default script file (DecScript.txt)\n";
|
||||
Settings::initScript("DecScript.txt");
|
||||
}
|
||||
else{
|
||||
Settings::initScript(argv[1]);
|
||||
}*/
|
||||
|
||||
time_t rawtime;
|
||||
time ( &rawtime );
|
||||
std::cout<<"*** Starting\tDEC v0.0 ***\t"<<ctime (&rawtime)<<std::endl;
|
||||
//Processor::test(initPSize, generations);
|
||||
//Processor::test01(/*initPSize, generations*/);
|
||||
//Processor::testInOutBreeding01();
|
||||
//KolchShindyalov::test01();
|
||||
//DerevyankoReport::reportRFBR2013_01();
|
||||
DerevyankoReport2014::report2014_01(argc,argv);
|
||||
|
||||
time ( &rawtime );
|
||||
std::cout<<"*** Ending\tDEC v0.0 ***\t"<<ctime (&rawtime)<<std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
228
DEC-0.0.vcxproj.filters
Normal file
228
DEC-0.0.vcxproj.filters
Normal file
@@ -0,0 +1,228 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\environment">
|
||||
<UniqueIdentifier>{1543172e-803c-444e-8cda-6a2308e41db2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\individual">
|
||||
<UniqueIdentifier>{01603e36-7499-4442-a781-b13e2af1fd98}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\individual\genome">
|
||||
<UniqueIdentifier>{05942c27-3dc6-45ca-8cc0-accdf0dc3b86}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\individual\genome\strategies">
|
||||
<UniqueIdentifier>{7c9f48d2-5ac8-4755-a0a2-536a0eacf1e8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\individual\genome\strategies\InOutBreeding">
|
||||
<UniqueIdentifier>{651fa082-b05e-41a5-a43b-0698a5dce75c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\individual\genome\strategies\KolchShindyal">
|
||||
<UniqueIdentifier>{a12457ad-86da-429a-b79c-59cfe2ad991d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\population">
|
||||
<UniqueIdentifier>{831c8153-9898-45b7-81d8-a65c0aa1e297}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\population\BreedingStrategies">
|
||||
<UniqueIdentifier>{f7bd5858-9457-4195-9b6e-50b7db3bfc5f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\processor">
|
||||
<UniqueIdentifier>{5dfc1f18-3517-4edd-8a1a-ab0a9993ba0f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DEC-0.0.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DerevyankoReport2014.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="environment\Environment.cpp">
|
||||
<Filter>Header Files\environment</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="environment\Region.cpp">
|
||||
<Filter>Header Files\environment</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\Individual.cpp">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\InnerSubstratesPool.cpp">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\Phenotype.cpp">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\Trait.cpp">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\Chromosome.cpp">
|
||||
<Filter>Header Files\individual\genome</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\Gene.cpp">
|
||||
<Filter>Header Files\individual\genome</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\Genotype.cpp">
|
||||
<Filter>Header Files\individual\genome</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\ChromosomeRearrangementStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\GenotypeToPhenotypeStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\PhenotypeToFitnessStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\InOutBreeding\InOutBreedingPhenToFitStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies\InOutBreeding</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\InOutBreeding\InOutBreedingPopulationBreedingStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies\InOutBreeding</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\InOutBreeding\InOutBreeginGenToPhenStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies\InOutBreeding</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\KolchShindyal\KolchShindyalBreedingStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies\KolchShindyal</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\KolchShindyal\KolchShindyalGenotypeToPhenotypeStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies\KolchShindyal</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\KolchShindyal\KolchShindyalPhenToFitnessStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies\KolchShindyal</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="population\BisexualPopulation.cpp">
|
||||
<Filter>Header Files\population</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="population\Population.cpp">
|
||||
<Filter>Header Files\population</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="population\BreedingStrategies\NeutralEvolutionBreedStrat.cpp">
|
||||
<Filter>Header Files\population\BreedingStrategies</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="population\BreedingStrategies\PopulationBreedingStrategy.cpp">
|
||||
<Filter>Header Files\population\BreedingStrategies</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="population\BreedingStrategies\VerhulstBreedingStrategy.cpp">
|
||||
<Filter>Header Files\population\BreedingStrategies</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DerevyankoReport.cpp">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="processor\KolchShindyalov.cpp">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="processor\Processor.cpp">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="processor\Settings.cpp">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DerevyankoReport2015.cpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\Derevyanko\2015\Derevyanko2015RecombinationStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DerevyankoReport2014.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Environment\AbstractEnvironment.h">
|
||||
<Filter>Header Files\environment</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="environment\AbstractRegion.h">
|
||||
<Filter>Header Files\environment</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Individual\AbstractIndividual.h">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Individual\InnerSubstratesPool.h">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Individual\Phenotype.h">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\Trait.h">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\AbstractGenome.h">
|
||||
<Filter>Header Files\individual\genome</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\Chromosome.h">
|
||||
<Filter>Header Files\individual\genome</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\Gene.h">
|
||||
<Filter>Header Files\individual\genome</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\ChromosomeRearrangementStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\GenotypeToPhenotypeStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\PhenotypeToFitnessStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\InOutBreeding\InOutBreedingPhenToFitStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies\InOutBreeding</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\InOutBreeding\InOutBreedingPopulationBreedingStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies\InOutBreeding</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\KolchShindyal\KolchShindyalBreedingStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies\KolchShindyal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\KolchShindyal\KolchShindyalGenotypeToPhenotypeStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies\KolchShindyal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\KolchShindyal\KolchShindyalPhenToFitnessStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies\KolchShindyal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="population\Population.h">
|
||||
<Filter>Header Files\population</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="population\BreedingStrategies\NeutralEvolutionBreedStrat.h">
|
||||
<Filter>Header Files\population\BreedingStrategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="population\BreedingStrategies\PopulationBreedingStrategy.h">
|
||||
<Filter>Header Files\population\BreedingStrategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="population\BreedingStrategies\VerhulstBreedingStrategy.h">
|
||||
<Filter>Header Files\population\BreedingStrategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DerevyankoReport.h">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="processor\KolchShindyalov.h">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="processor\Processor.h">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="processor\Settings.h">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DerevyankoReport2015.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\Derevyanko\2015\Derevyanko2015RecombinationStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ToDoList.txt" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
79
DEC_GUI/Agressor/agent.cpp
Normal file
79
DEC_GUI/Agressor/agent.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
#include "agent.h"
|
||||
#include <iostream>
|
||||
#include <QLineF>
|
||||
|
||||
Agent::Agent(uint agentId, uint agr, uint prot, uint mod, uint str, uint rad, uint sp, QObject *parent) :
|
||||
id(agentId), agressor(agr), protector(prot), mode(mod), strategy(str), radius(rad),
|
||||
speed(sp), distTarget(0), contentment(0), QObject(parent) {}
|
||||
|
||||
uint Agent::getID(){
|
||||
return this->id;
|
||||
}
|
||||
void Agent::setID(uint agentId){
|
||||
this->id = agentId;
|
||||
}
|
||||
uint Agent::getAgressor(){
|
||||
return this->agressor;
|
||||
}
|
||||
void Agent::setAgressor(uint agr){
|
||||
this->agressor = agr;
|
||||
}
|
||||
uint Agent::getProtector(){
|
||||
return this->protector;
|
||||
}
|
||||
void Agent::setProtector(uint prot){
|
||||
this->protector = prot;
|
||||
}
|
||||
qreal Agent::getCoordX(){
|
||||
return this->coordX;
|
||||
}
|
||||
void Agent::setCoordX(qreal x){
|
||||
this->coordX = x;
|
||||
}
|
||||
qreal Agent::getCoordY(){
|
||||
return this->coordY;
|
||||
}
|
||||
void Agent::setCoordY(qreal y){
|
||||
this->coordY = y;
|
||||
}
|
||||
uint Agent::getMode() {
|
||||
return this->mode;
|
||||
}
|
||||
void Agent::setMode(uint mod) {
|
||||
this->mode = mod;
|
||||
}
|
||||
uint Agent::getStrategy() {
|
||||
return this->strategy;
|
||||
}
|
||||
void Agent::setStratedy(uint str){
|
||||
this->strategy = str;
|
||||
}
|
||||
int Agent::getRadius(){
|
||||
return this->radius;
|
||||
}
|
||||
void Agent::setRadius(uint rad){
|
||||
this->radius = rad;
|
||||
}
|
||||
uint Agent::getSpeed(){
|
||||
return this->speed;
|
||||
}
|
||||
void Agent::setSpeed(uint sp){
|
||||
this->speed = sp;
|
||||
}
|
||||
qreal Agent::getDistTarget(){
|
||||
return this->distTarget;
|
||||
}
|
||||
void Agent::setDistTarget(qreal dist){
|
||||
this->distTarget = dist;
|
||||
}
|
||||
qreal Agent::getContentmemt(){
|
||||
return this->contentment;
|
||||
}
|
||||
void Agent::setContentment(qreal cont){
|
||||
this->contentment = cont;
|
||||
}
|
||||
void Agent::gameEvent(QLineF shift){
|
||||
setCoordX(getCoordX() + shift.dx());
|
||||
setCoordY(getCoordY() + shift.dy());
|
||||
//std::cout << "new coord X: " << getCoordX() << ", new coord Y: " << getCoordY() << std::endl;
|
||||
}
|
||||
51
DEC_GUI/Agressor/agent.h
Normal file
51
DEC_GUI/Agressor/agent.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#ifndef AGENT_H
|
||||
#define AGENT_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class Agent : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Agent(uint agentId, uint agr, uint prot, uint mod, uint str, uint rad, uint sp, QObject *parent = 0);
|
||||
// setters, getters
|
||||
uint getID();
|
||||
void setID(uint);
|
||||
uint getAgressor();
|
||||
void setAgressor(uint agr);
|
||||
uint getProtector();
|
||||
void setProtector(uint prot);
|
||||
qreal getCoordX();
|
||||
void setCoordX(qreal x);
|
||||
qreal getCoordY();
|
||||
void setCoordY(qreal y);
|
||||
uint getMode();
|
||||
void setMode(uint mod);
|
||||
uint getStrategy();
|
||||
void setStratedy(uint str);
|
||||
int getRadius();
|
||||
void setRadius(uint rad);
|
||||
uint getSpeed();
|
||||
void setSpeed(uint sp);
|
||||
qreal getDistTarget();
|
||||
void setDistTarget(qreal dist);
|
||||
qreal getContentmemt();
|
||||
void setContentment(qreal cont);
|
||||
|
||||
void gameEvent(QLineF shift); // смена положения
|
||||
|
||||
private:
|
||||
uint id; // порядковый номер
|
||||
uint agressor; // номер игрока А (условно - агрессора)
|
||||
uint protector; // номер игрока В (условно - защитника)
|
||||
qreal coordX; // координата x
|
||||
qreal coordY; // координата y
|
||||
uint mode; // режим: 0 - режим труса, 1 - режим защитника
|
||||
uint strategy; // стратегия: 0 - движение по медиане/антимедиане, 1 - движение по нормали
|
||||
uint radius; // радиус (для расчёта столкновений)
|
||||
uint speed; // скорость
|
||||
qreal distTarget; // расстояние до желаемых координат
|
||||
qreal contentment; // неудовлетворённость агента
|
||||
};
|
||||
|
||||
#endif // AGENT_H
|
||||
26
DEC_GUI/Agressor/agentitem.cpp
Normal file
26
DEC_GUI/Agressor/agentitem.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <QPainter>
|
||||
#include "agentitem.h"
|
||||
|
||||
AgentItem::AgentItem(Agent *ag, QColor col) :
|
||||
agent(ag), color(col){
|
||||
}
|
||||
QRectF AgentItem::boundingRect()const {
|
||||
int radius = agent->getRadius();
|
||||
return QRectF(-radius, -radius, 2*radius, 2*radius);
|
||||
}
|
||||
void AgentItem::paint(QPainter * painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget){
|
||||
int radius = agent->getRadius();
|
||||
painter->setBrush(color);
|
||||
painter->drawEllipse(-radius, -radius, 2*radius, 2*radius);
|
||||
}
|
||||
|
||||
/*
|
||||
* Событие: обновление текущих координат
|
||||
*/
|
||||
void AgentItem::agentEvent(){
|
||||
//std::cout << "coordX: " << agent->getCoordX() << " coordY: " << agent->getCoordY() << std::endl;
|
||||
setPos(agent->getCoordX(), agent->getCoordY());
|
||||
}
|
||||
21
DEC_GUI/Agressor/agentitem.h
Normal file
21
DEC_GUI/Agressor/agentitem.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef AGENTITEM_H
|
||||
#define AGENTITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include "agent.h"
|
||||
|
||||
class AgentItem : public QGraphicsItem
|
||||
{
|
||||
public:
|
||||
explicit AgentItem(Agent *agent, QColor col);
|
||||
|
||||
QRectF boundingRect() const; // ограничивающий прямоугольник
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); // отрисовка
|
||||
void agentEvent(); // событие: обновление текущих координат
|
||||
|
||||
private:
|
||||
Agent *agent;
|
||||
QColor color;
|
||||
};
|
||||
|
||||
#endif // AGENTITEM_H
|
||||
187
DEC_GUI/Agressor/aphistory.cpp
Normal file
187
DEC_GUI/Agressor/aphistory.cpp
Normal file
@@ -0,0 +1,187 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <QDir>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include "aphistory.h"
|
||||
|
||||
/*
|
||||
* Конструктор
|
||||
*/
|
||||
APHistory::APHistory() {
|
||||
//
|
||||
}
|
||||
|
||||
/*
|
||||
* Добавление отдельного контейнера для каждого запуска модели
|
||||
*/
|
||||
void APHistory::addClassHistory() {
|
||||
QList<qreal> content;
|
||||
avContenmentHistory.push_back(content);
|
||||
}
|
||||
|
||||
/*
|
||||
* Добавление отдельного контейнера для данных по группам каждого запуска модели
|
||||
*/
|
||||
void APHistory::addClassGroupHistory() {
|
||||
QList<qreal> groupsContent;
|
||||
QVector<QList<qreal> > modelsContent(4, groupsContent);
|
||||
groupAvContenmentHistoty.push_back(modelsContent);
|
||||
}
|
||||
|
||||
/*
|
||||
* Добавление данных о модели с номером iModel
|
||||
*/
|
||||
void APHistory::addAvContenmentData(int iModel, qreal avContenmentData){
|
||||
avContenmentHistory[iModel].push_back(avContenmentData);
|
||||
}
|
||||
|
||||
/*
|
||||
* Добавление данных о модели с номером iModel по группам
|
||||
*/
|
||||
void APHistory::addGroupAvContenmentData(int iModel, QVector<qreal> avContenmentData){
|
||||
for (int iGroup = 0; iGroup < 4; iGroup++) {
|
||||
groupAvContenmentHistoty[iModel][iGroup].push_back(avContenmentData[iGroup]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Вывод в файл всех данных по модели с номером iModel
|
||||
*/
|
||||
void APHistory::postPrintModelData(int iModel){
|
||||
QString directoryName("Output_for_model_");
|
||||
directoryName += QString::number(iModel);
|
||||
QDir directory(directoryName);
|
||||
if (!directory.exists()){
|
||||
directory.mkpath(".");
|
||||
}
|
||||
std::stringstream fileName;
|
||||
fileName << "./Output_for_model_" << iModel << "/avContenment_model" << iModel << ".txt";
|
||||
std::ofstream avContOutput(fileName.str().c_str());
|
||||
for(int i = 0; i < avContenmentHistory[iModel].size(); i++){
|
||||
avContOutput << avContenmentHistory[iModel][i] << std::endl;
|
||||
}
|
||||
avContOutput.close();
|
||||
}
|
||||
|
||||
void APHistory::postPrintGroupData(int iModel){
|
||||
QString directoryName("Output_for_model_");
|
||||
directoryName += QString::number(iModel);
|
||||
QDir directory(directoryName);
|
||||
if (!directory.exists()){
|
||||
directory.mkpath(".");
|
||||
}
|
||||
for (int j = 0; j < 4; j++){
|
||||
std::stringstream ss;
|
||||
ss << "./Output_for_model_" << iModel << "/avContenment_model" << iModel << "_group" << j << ".txt";
|
||||
std::ofstream groupAvContOutput(ss.str().c_str());
|
||||
for(int i = 0; i < groupAvContenmentHistoty[iModel][j].size(); i++){
|
||||
groupAvContOutput << groupAvContenmentHistoty[iModel][j][i] << std::endl;
|
||||
}
|
||||
groupAvContOutput.close();
|
||||
}
|
||||
}
|
||||
|
||||
void APHistory::postPrintGlobalAverage() {
|
||||
for (int iGroup = 0; iGroup < 4; iGroup++) {
|
||||
QList<qreal> data = getAverageForGroup(iGroup);
|
||||
QString directoryName("Output_for_average");
|
||||
QDir directory(directoryName);
|
||||
if (!directory.exists()){
|
||||
directory.mkpath(".");
|
||||
}
|
||||
std::stringstream ss;
|
||||
ss << "./Output_for_average/avContenmentForAllModels_group" << iGroup << ".txt";
|
||||
std::ofstream averageForGroups(ss.str().c_str(), std::ios::app);
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
averageForGroups << data[i] << std::endl;
|
||||
}
|
||||
averageForGroups.close();
|
||||
}
|
||||
QList<qreal> data = getAverageForAllModels();
|
||||
std::ofstream averageForAll("./Output_for_average/avContenmentForAllModels.txt");
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
averageForAll << data[i] << std::endl;
|
||||
}
|
||||
averageForAll.close();
|
||||
}
|
||||
|
||||
/*
|
||||
* Вывод в файл последних данных по модели с номером iModel
|
||||
*/
|
||||
void APHistory::printCurrentContentmentData(int iModel){
|
||||
QString directoryName("Output_for_model_");
|
||||
directoryName += QString::number(iModel);
|
||||
QDir directory(directoryName);
|
||||
if (!directory.exists()){
|
||||
directory.mkpath(".");
|
||||
}
|
||||
std::stringstream ss;
|
||||
ss << "./Output_for_model_" << iModel << "/avContenment_model" << iModel << ".txt";
|
||||
std::ofstream currentAvContOutput(ss.str().c_str(), std::ios::app);
|
||||
currentAvContOutput << avContenmentHistory[iModel].last() << std::endl;
|
||||
currentAvContOutput.close();
|
||||
}
|
||||
|
||||
void APHistory::printCurrentContentmentGroupData(int iModel){
|
||||
QString directoryName("Output_for_model_");
|
||||
directoryName += QString::number(iModel);
|
||||
QDir directory(directoryName);
|
||||
if (!directory.exists()){
|
||||
directory.mkpath(".");
|
||||
}
|
||||
for (int iGroup = 0; iGroup < 4; iGroup++){
|
||||
std::stringstream ss;
|
||||
ss << "./Output_for_model_" << iModel << "/avContenment_model" << iModel << "_group" << iGroup <<".txt";
|
||||
std::ofstream currentAvContOutput(ss.str().c_str(), std::ios::app);
|
||||
currentAvContOutput << groupAvContenmentHistoty[iModel][iGroup].last() << std::endl;
|
||||
currentAvContOutput.close();
|
||||
}
|
||||
}
|
||||
|
||||
QList<qreal> APHistory::getHistory(int iModel) {
|
||||
return avContenmentHistory[iModel];
|
||||
}
|
||||
|
||||
QList<qreal> APHistory::getGroupHistory(int iModel, int iGroup) {
|
||||
return groupAvContenmentHistoty[iModel][iGroup];
|
||||
}
|
||||
|
||||
QList<qreal> APHistory::getAverageForAllModels() {
|
||||
QList<qreal> average;
|
||||
int nModels = avContenmentHistory.size();
|
||||
if (nModels > 0){
|
||||
int nIterations = avContenmentHistory[0].size();
|
||||
for (int j = 0; j < nIterations; j++){
|
||||
qreal buffer = 0;
|
||||
for (int i = 0; i < nModels; i++) {
|
||||
buffer += avContenmentHistory[i][j];
|
||||
}
|
||||
average.push_back(buffer/nModels);
|
||||
}
|
||||
}
|
||||
return average;
|
||||
}
|
||||
|
||||
QList<qreal> APHistory::getAverageForGroup(int group) {
|
||||
QList<qreal> average;
|
||||
int nModels = groupAvContenmentHistoty.size();
|
||||
if (nModels > 0){
|
||||
int nIterations = groupAvContenmentHistoty[0][group].size();
|
||||
for (int j = 0; j < nIterations; j++){
|
||||
qreal buffer = 0;
|
||||
for (int i = 0; i < nModels; i++) {
|
||||
buffer += groupAvContenmentHistoty[i][group][j];
|
||||
}
|
||||
average.push_back(buffer/nModels);
|
||||
}
|
||||
}
|
||||
return average;
|
||||
}
|
||||
|
||||
void APHistory::clearHistory() {
|
||||
avContenmentHistory.clear();
|
||||
groupAvContenmentHistoty.clear();
|
||||
}
|
||||
29
DEC_GUI/Agressor/aphistory.h
Normal file
29
DEC_GUI/Agressor/aphistory.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef APHISTORY_H
|
||||
#define APHISTORY_H
|
||||
|
||||
#include <QList>
|
||||
|
||||
class APHistory
|
||||
{
|
||||
public:
|
||||
APHistory();
|
||||
void addClassHistory ();
|
||||
void addClassGroupHistory();
|
||||
void addAvContenmentData(int iModel, qreal avContenmentData); // Добавление данных о модели с номером iModel
|
||||
void addGroupAvContenmentData(int iModel, QVector<qreal> avContenmentData);
|
||||
void postPrintModelData(int iModel); // Вывод в файл всех данных по модели с номером iModel
|
||||
void postPrintGroupData(int iModel);
|
||||
void postPrintGlobalAverage();
|
||||
void printCurrentContentmentData(int iModel); // Вывод в файл последних данных по модели с номером iModel
|
||||
void printCurrentContentmentGroupData(int iModel);
|
||||
QList<qreal> getHistory(int iModel);
|
||||
QList<qreal> getGroupHistory(int iModel, int iGroup);
|
||||
QList<qreal> getAverageForAllModels();
|
||||
QList<qreal> getAverageForGroup(int group);
|
||||
void clearHistory();
|
||||
private:
|
||||
QList<QList<qreal> > avContenmentHistory; // Хранитель данных о ср.неудовлетворённости
|
||||
QList<QVector<QList<qreal> > > groupAvContenmentHistoty;
|
||||
};
|
||||
|
||||
#endif // APHISTORY_H
|
||||
687
DEC_GUI/Agressor/manager.cpp
Normal file
687
DEC_GUI/Agressor/manager.cpp
Normal file
@@ -0,0 +1,687 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <cmath>
|
||||
#include <QLabel>
|
||||
#include <QString>
|
||||
#include <QThread>
|
||||
#include "QtConcurrent/qtconcurrentrun.h"
|
||||
#include "manager.h"
|
||||
|
||||
enum Group {CM, PM, CN, PN};
|
||||
static const bool multipleThreads = true;
|
||||
static const int nThreads = 4;
|
||||
static const bool blackAndWhite = false;
|
||||
|
||||
/*
|
||||
* Конструктор
|
||||
*/
|
||||
Manager::Manager(QObject *parent) : manItem(0),
|
||||
xCoord(100, 0), yCoord(100, 0), cowardMedian(0), cowardNormal(0), protectorMedian(0), protectorNormal(0),
|
||||
agentRadius(0), speedDistr(0), gamerSpeed(0), period(0), initDistr(0), enmity(0), newEnmity(0),
|
||||
viewOrPackageMode(0), nIterations(1), nModels(1), outputToTxt(false), typeContentment(0), radiusLocality(0), QObject(parent)
|
||||
{
|
||||
window = new QWidget;
|
||||
base = new QGridLayout;
|
||||
QGroupBox *settings = new QGroupBox;
|
||||
initSettings(settings);
|
||||
tabWindow = new QTabWidget;
|
||||
initTab(tabWindow);
|
||||
|
||||
base->addWidget(settings, 0, 1);
|
||||
base->addWidget(tabWindow, 0, 0);
|
||||
|
||||
window->setLayout(base);
|
||||
window->setWindowTitle("Agressor-Protector");
|
||||
window->show();
|
||||
|
||||
// создание таймера
|
||||
timer = new QTimer(this);
|
||||
timer->setInterval(1000/10);
|
||||
timer->stop();
|
||||
|
||||
// хранитель данных
|
||||
history = new APHistory(); // ToDo: setNModel
|
||||
}
|
||||
|
||||
/*
|
||||
* Создание окна настроек
|
||||
*/
|
||||
void Manager::initSettings(QGroupBox *set){
|
||||
QVBoxLayout *box = new QVBoxLayout;
|
||||
|
||||
QGroupBox *box1 = new QGroupBox;
|
||||
QGroupBox *box2 = new QGroupBox;
|
||||
QGroupBox *box3 = new QGroupBox;
|
||||
QGroupBox *box4 = new QGroupBox;
|
||||
QGroupBox *box5 = new QGroupBox;
|
||||
|
||||
QGridLayout *hbox1 = new QGridLayout;
|
||||
QGridLayout *hbox2 = new QGridLayout;
|
||||
QGridLayout *hbox3 = new QGridLayout;
|
||||
QGridLayout *hbox4 = new QGridLayout;
|
||||
QVBoxLayout *hbox5 = new QVBoxLayout;
|
||||
|
||||
QLabel *labelMode1 = new QLabel("Gamer is a coward");
|
||||
QLabel *labelMode2 = new QLabel("Gamer is a protector");
|
||||
QLabel *labelStrategy1 = new QLabel("Along median");
|
||||
QLabel *labelStrategy2 = new QLabel("Along normal");
|
||||
QSpinBox *spinCM = new QSpinBox;
|
||||
spinCM->setMaximum(1000);
|
||||
connect (spinCM, SIGNAL(valueChanged(int)), this, SLOT(setCowardMedian(int)));
|
||||
QSpinBox *spinCN = new QSpinBox;
|
||||
spinCN->setMaximum(1000);
|
||||
connect (spinCN, SIGNAL(valueChanged(int)), this, SLOT(setCowardNormal(int)));
|
||||
QSpinBox *spinPM = new QSpinBox;
|
||||
spinPM->setMaximum(1000);
|
||||
connect (spinPM, SIGNAL(valueChanged(int)), this, SLOT(setProtectorMedian(int)));
|
||||
QSpinBox *spinPN = new QSpinBox;
|
||||
spinPN->setMaximum(1000);
|
||||
connect (spinPN, SIGNAL(valueChanged(int)), this, SLOT(setProtectorNormal(int)));
|
||||
|
||||
QLabel *labelRadius = new QLabel("Gamer radius:");
|
||||
QSpinBox *boxRadius = new QSpinBox;
|
||||
connect(boxRadius, SIGNAL(valueChanged(int)), this, SLOT(setAgentRadius(int)));
|
||||
QLabel *labelEnmity = new QLabel("Enmity:");
|
||||
QSpinBox *spinBoxEnmity = new QSpinBox;
|
||||
connect(spinBoxEnmity, SIGNAL(valueChanged(int)), this, SLOT(setNewEnmity(int)));
|
||||
// QLabel *labelSpeedDistr = new QLabel("Speed distribution:");
|
||||
// QComboBox *comboSpeedDistr = new QComboBox;
|
||||
// comboSpeedDistr->addItem("homogeneous");
|
||||
QLabel *labelSpeed = new QLabel("Gamer speed:");
|
||||
QSpinBox *spinSpeed = new QSpinBox;
|
||||
spinSpeed->setMaximum(10);
|
||||
connect(spinSpeed, SIGNAL(valueChanged(int)), this, SLOT(setGamerSpeed(int)));
|
||||
QLabel *labelCont = new QLabel("Type of contenment calculation: ");
|
||||
QComboBox *comboContent = new QComboBox;
|
||||
comboContent->addItem("absolute");
|
||||
comboContent->addItem("comparative");
|
||||
connect(comboContent, SIGNAL(currentIndexChanged(int)), this, SLOT(setTypeContenment(int)));
|
||||
QLabel *labelLocality = new QLabel("Radius of locality");
|
||||
spinLocality = new QSpinBox;
|
||||
spinLocality->setEnabled(false);
|
||||
connect(spinLocality, SIGNAL(valueChanged(int)), this, SLOT(setRadiusLocality(int)));
|
||||
connect(comboContent, SIGNAL(currentIndexChanged(int)), this, SLOT(manageSpinLocality(int)));
|
||||
|
||||
QCheckBox *checkPeriod = new QCheckBox;
|
||||
checkPeriod->setText("Periodicity");
|
||||
connect(checkPeriod, SIGNAL(toggled(bool)), this, SLOT(setPeriodicity(bool)));
|
||||
QLabel *label = new QLabel("Initial distribution:");
|
||||
QComboBox *comboDistr = new QComboBox;
|
||||
comboDistr->addItem("random");
|
||||
comboDistr->addItem("on the circle");
|
||||
connect(comboDistr, SIGNAL(currentIndexChanged(int)), this, SLOT(setDistr(int)));
|
||||
|
||||
createButton = new QPushButton;
|
||||
createButton->setText("Create");
|
||||
connect(createButton, SIGNAL(clicked()), this, SLOT(resetProgressBarAndHistory()));
|
||||
connect(createButton, SIGNAL(clicked()), this, SLOT(initModel()));
|
||||
|
||||
QLabel *labelViewOrPackage = new QLabel("Type of job: ");
|
||||
viewOrPackage = new QComboBox;
|
||||
viewOrPackage->addItem("one model in detail");
|
||||
viewOrPackage->addItem("processing");
|
||||
connect(viewOrPackage, SIGNAL(currentIndexChanged(int)), this, SLOT(setviewOrPackageMode(int)));
|
||||
connect(viewOrPackage, SIGNAL(currentIndexChanged(int)), this, SLOT(managePackageOptions(int)));
|
||||
checkLink = new QCheckBox;
|
||||
checkLink->setText("Show links");
|
||||
checkOutputToTxt = new QCheckBox;
|
||||
checkOutputToTxt->setText("Output to txt");
|
||||
connect(checkOutputToTxt, SIGNAL(toggled(bool)), this, SLOT(setOutputToTxt(bool)));
|
||||
QLabel *label3 = new QLabel("Updating frequency: ");
|
||||
comboTime = new QComboBox;
|
||||
comboTime->addItem("1000/10");
|
||||
comboTime->addItem("1000/20");
|
||||
comboTime->addItem("1000/30");
|
||||
comboTime->addItem("1000/50");
|
||||
comboTime->addItem("1000/100");
|
||||
connect(comboTime, SIGNAL(currentIndexChanged(int)), this, SLOT(timerRestart(int)));
|
||||
QLabel *labelIterations = new QLabel("Number of iterations: ");
|
||||
spinIterations = new QSpinBox;
|
||||
spinIterations->setMinimum(1);
|
||||
spinIterations->setMaximum(10000);
|
||||
spinIterations->setEnabled(false);
|
||||
connect(spinIterations, SIGNAL(valueChanged(int)), this, SLOT(setNIterations(int)));
|
||||
QLabel *labelModels = new QLabel("Number of models: ");
|
||||
spinModels = new QSpinBox;
|
||||
spinModels->setMinimum(1);
|
||||
spinModels->setMaximum(1000);
|
||||
spinModels->setEnabled(false);
|
||||
connect(spinModels, SIGNAL(valueChanged(int)), this, SLOT(setNModels(int)));
|
||||
buttonTime = new QPushButton;
|
||||
buttonTime->setText("Start");
|
||||
connect(buttonTime, SIGNAL(clicked()), this, SLOT(handleButton()));
|
||||
buttonTime->setEnabled(false);
|
||||
|
||||
hbox1->addWidget(labelMode1, 0, 1);
|
||||
hbox1->addWidget(labelMode2, 0, 2);
|
||||
hbox1->addWidget(labelStrategy1, 1, 0);
|
||||
hbox1->addWidget(labelStrategy2, 2, 0);
|
||||
hbox1->addWidget(spinCM, 1, 1);
|
||||
hbox1->addWidget(spinCN, 2, 1);
|
||||
hbox1->addWidget(spinPM, 1, 2);
|
||||
hbox1->addWidget(spinPN, 2, 2);
|
||||
box1->setLayout(hbox1);
|
||||
box1->setTitle("Gamers number");
|
||||
|
||||
hbox2->addWidget(labelRadius, 0, 0);
|
||||
hbox2->addWidget(boxRadius, 0, 1);
|
||||
hbox2->addWidget(labelEnmity, 1, 0);
|
||||
hbox2->addWidget(spinBoxEnmity, 1, 1);
|
||||
// hbox2->addWidget(labelSpeedDistr, 2, 0);
|
||||
// hbox2->addWidget(comboSpeedDistr, 2, 1);
|
||||
hbox2->addWidget(labelSpeed, 3, 0);
|
||||
hbox2->addWidget(spinSpeed, 3, 1);
|
||||
hbox2->addWidget(labelCont, 4, 0);
|
||||
hbox2->addWidget(comboContent, 4, 1);
|
||||
hbox2->addWidget(labelLocality, 5, 0);
|
||||
hbox2->addWidget(spinLocality, 5, 1);
|
||||
box2->setLayout(hbox2);
|
||||
box2->setTitle("Gamer settings");
|
||||
|
||||
hbox3->addWidget(checkPeriod, 0, 0);
|
||||
hbox3->addWidget(label, 1, 0);
|
||||
hbox3->addWidget(comboDistr, 1, 1);
|
||||
box3->setLayout(hbox3);
|
||||
box3->setTitle("Scene settings");
|
||||
|
||||
hbox4->addWidget(labelViewOrPackage, 0, 0);
|
||||
hbox4->addWidget(viewOrPackage, 0, 1);
|
||||
hbox4->addWidget(checkLink, 1, 0);
|
||||
hbox4->addWidget(checkOutputToTxt, 1, 1);
|
||||
hbox4->addWidget(label3, 2, 0);
|
||||
hbox4->addWidget(comboTime, 2, 1);
|
||||
hbox4->addWidget(labelIterations, 3, 0);
|
||||
hbox4->addWidget(spinIterations, 3, 1);
|
||||
hbox4->addWidget(labelModels, 4, 0);
|
||||
hbox4->addWidget(spinModels, 4, 1);
|
||||
box4->setLayout(hbox4);
|
||||
|
||||
hbox5->addWidget(createButton);
|
||||
hbox5->addWidget(buttonTime);
|
||||
box5->setLayout(hbox5);
|
||||
|
||||
box->addWidget(box1);
|
||||
box->addWidget(box2);
|
||||
box->addWidget(box3);
|
||||
box->addWidget(box4);
|
||||
box->addWidget(box5);
|
||||
box->addStretch();
|
||||
|
||||
set->setLayout(box);
|
||||
}
|
||||
|
||||
void Manager::initTab(QTabWidget *tabs){
|
||||
// Первая вкладка - визуализация одной модели (сцена + график)
|
||||
QWidget *viewTab = new QWidget;
|
||||
QGridLayout *viewLayout = new QGridLayout;
|
||||
// Создание и заполнение сцены
|
||||
scene = new QGraphicsScene;
|
||||
scene->setSceneRect(-300, -300, 600, 600);
|
||||
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||
|
||||
QGraphicsView *view = new QGraphicsView(scene);
|
||||
view->setRenderHint(QPainter::Antialiasing);
|
||||
view->setCacheMode(QGraphicsView::CacheBackground);
|
||||
view->resize(800, 800);
|
||||
view->setMinimumWidth(600);
|
||||
view->show();
|
||||
|
||||
// Создание графика ср.неудовлетворённости
|
||||
QLabel *labelGraph = new QLabel("Dynamics of average contenment");
|
||||
labelContent = new QLabel("Average contentment: ");
|
||||
plot = new QCustomPlot;
|
||||
plot->addGraph();
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
xCoord[i] = i;
|
||||
}
|
||||
plot->graph(0)->setData(xCoord, yCoord);
|
||||
plot->yAxis->setRange(0, 1);
|
||||
plot->graph(0)->rescaleAxes();
|
||||
plot->yAxis->setVisible(false);
|
||||
plot->xAxis->setTickLabels(false);
|
||||
|
||||
viewLayout->addWidget(view, 0, 0, 1, 2);
|
||||
viewLayout->addWidget(labelGraph, 1, 0);
|
||||
viewLayout->addWidget(labelContent, 1, 1);
|
||||
viewLayout->addWidget(plot, 2, 0, 1, 2);
|
||||
|
||||
viewTab->setLayout(viewLayout);
|
||||
|
||||
// Вторая вкладка - пакетное задание (прогресс-бар)
|
||||
QWidget *packageTab = new QWidget;
|
||||
QGridLayout *packageLayout = new QGridLayout;
|
||||
|
||||
prBar = new QProgressBar;
|
||||
prBar->setValue(0);
|
||||
QLabel *graphComboLabel = new QLabel("Compose the graphic for: ");
|
||||
graphCombo = new QComboBox;
|
||||
graphCombo->setEnabled(false);
|
||||
graphCombo->addItem("---");
|
||||
connect(graphCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(composeGraph(int)));
|
||||
|
||||
batchPlot = new QCustomPlot;
|
||||
batchPlot->addGraph();
|
||||
batchPlot->addGraph();
|
||||
batchPlot->addGraph();
|
||||
batchPlot->addGraph();
|
||||
batchPlot->addGraph();
|
||||
batchPlot->graph(0)->setPen(QPen(Qt::black, 2));
|
||||
if (blackAndWhite) {
|
||||
batchPlot->graph(CM + 1)->setPen(QPen(Qt::SolidLine));
|
||||
batchPlot->graph(PM + 1)->setPen(QPen(Qt::DashDotLine));
|
||||
batchPlot->graph(CN + 1)->setPen(QPen(Qt::DashLine));
|
||||
QPen * pen = new QPen(QPen(Qt::DashDotDotLine));
|
||||
pen->setWidth(2);
|
||||
batchPlot->graph(PN + 1)->setPen(*pen);
|
||||
} else {
|
||||
batchPlot->graph(CM + 1)->setPen(QPen(Qt::red));
|
||||
batchPlot->graph(PM + 1)->setPen(QPen(Qt::yellow));
|
||||
batchPlot->graph(CN + 1)->setPen(QPen(Qt::darkBlue));
|
||||
batchPlot->graph(PN + 1)->setPen(QPen(Qt::cyan));
|
||||
}
|
||||
batchPlot->graph(0)->setName("Average for all agents");
|
||||
batchPlot->graph(CM + 1)->setName("Average for coward-median");
|
||||
batchPlot->graph(PM + 1)->setName("Average for all protector-median");
|
||||
batchPlot->graph(CN + 1)->setName("Average for all coward-normal");
|
||||
batchPlot->graph(PN + 1)->setName("Average for all protector-normal");
|
||||
|
||||
xBatchCoord.resize(100);
|
||||
yBatchCoord.resize(100);
|
||||
yBatchCoord.fill(0);
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
xBatchCoord[i] = i;
|
||||
}
|
||||
batchPlot->graph(0)->setData(xBatchCoord, yBatchCoord);
|
||||
batchPlot->yAxis->setRange(0, 1.05);
|
||||
QVector<qreal> ticks;
|
||||
qreal i = 0;
|
||||
while (i <= 1.05) {
|
||||
ticks << i;
|
||||
i += 0.1;
|
||||
}
|
||||
batchPlot->yAxis->setAutoTicks(false);
|
||||
batchPlot->yAxis->setTickVector(ticks);
|
||||
batchPlot->graph(0)->rescaleAxes();
|
||||
|
||||
QLabel *labelSaveWithName = new QLabel("Save with name: ");
|
||||
lineSaveWithName = new QLineEdit;
|
||||
lineSaveWithName->setPlaceholderText("For example: default_name");
|
||||
QPushButton *buttonSaveGraph = new QPushButton;
|
||||
buttonSaveGraph->setText("Save as jpeg");
|
||||
connect(buttonSaveGraph, SIGNAL(clicked()), this, SLOT(saveGragh()));
|
||||
|
||||
packageLayout->addWidget(prBar, 0, 0, 1, 2);
|
||||
packageLayout->addWidget(graphComboLabel, 1, 0, 1, 1);
|
||||
packageLayout->addWidget(graphCombo, 1, 1, 1, 1);
|
||||
packageLayout->addWidget(batchPlot, 2, 0, 2, 2);
|
||||
packageLayout->addWidget(labelSaveWithName, 4, 0, 1, 1);
|
||||
packageLayout->addWidget(lineSaveWithName, 4, 1, 1, 1);
|
||||
packageLayout->addWidget(buttonSaveGraph, 5, 1, 1, 1);
|
||||
packageTab->setLayout(packageLayout);
|
||||
|
||||
tabs->addTab(viewTab, "One model in detail");
|
||||
tabs->addTab(packageTab, "Batch processing");
|
||||
connect(tabs, SIGNAL(currentChanged(int)), viewOrPackage, SLOT(setCurrentIndex(int)));
|
||||
}
|
||||
|
||||
QVector<qreal> Manager::calculateAvContenmentForGroups(uint typeCalc, uint iModel){
|
||||
qreal max = 0;
|
||||
qreal res = 0;
|
||||
QVector<qreal> cont(4, 0);
|
||||
QList <Agent *> neibours;
|
||||
QVector<uint> nAgents;
|
||||
nAgents << cowardMedian << protectorMedian << cowardNormal << protectorNormal;
|
||||
if (modelList[iModel]->getAgentList().size() == 0){
|
||||
return cont;
|
||||
}
|
||||
// С оглядкой на всех агентов
|
||||
else if (typeCalc == 0){
|
||||
int ind = 0;
|
||||
for (int i = 0; i < modelList[iModel]->getAgentList().size(); i++){
|
||||
if (modelList[iModel]->getAgentList()[i]->getMode() == 0) {
|
||||
ind = modelList[iModel]->getAgentList()[i]->getStrategy() == 0 ? 0 : 2;
|
||||
}
|
||||
else {
|
||||
ind = modelList[iModel]->getAgentList()[i]->getStrategy() == 0 ? 1 : 3;
|
||||
}
|
||||
if (modelList[iModel]->getAgentList()[i]->getDistTarget() > max){
|
||||
max = modelList[iModel]->getAgentList()[i]->getDistTarget();
|
||||
}
|
||||
else{}
|
||||
if (max > 0.0) {
|
||||
modelList[iModel]->getAgentList()[i]->setContentment(modelList[iModel]->getAgentList()[i]->getDistTarget()/max);
|
||||
cont[ind] += modelList[iModel]->getAgentList()[i]->getDistTarget()/max;
|
||||
}
|
||||
else{
|
||||
modelList[iModel]->getAgentList()[i]->setContentment(1);
|
||||
cont[ind] += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// С оглядкой на агентов внутри окрестности
|
||||
else if (typeCalc == 1){
|
||||
for (int i = 0; i < modelList[iModel]->getAgentList().size(); i++){
|
||||
int ind = 0;
|
||||
if (modelList[iModel]->getAgentList()[i]->getMode() == 0) {
|
||||
ind = modelList[iModel]->getAgentList()[i]->getStrategy() == 0 ? 0 : 2;
|
||||
}
|
||||
else {
|
||||
ind = modelList[iModel]->getAgentList()[i]->getStrategy() == 0 ? 1 : 3;
|
||||
}
|
||||
|
||||
neibours = modelList[iModel]->DangerGamer(i, 0, 0, radiusLocality);
|
||||
max = modelList[iModel]->getAgentList()[i]->getDistTarget();
|
||||
for (int j = 0; j < neibours.size(); j++){
|
||||
if (neibours[j]->getDistTarget() > max){
|
||||
max = neibours[j]->getDistTarget();
|
||||
}
|
||||
else{}
|
||||
}
|
||||
if (max > 0.0) {
|
||||
modelList[iModel]->getAgentList()[i]->setContentment(modelList[iModel]->getAgentList()[i]->getDistTarget()/max);
|
||||
cont[ind] += modelList[iModel]->getAgentList()[i]->getDistTarget()/max;
|
||||
}
|
||||
else{
|
||||
modelList[iModel]->getAgentList()[i]->setContentment(1);
|
||||
cont[ind] += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = CM; i < PN + 1; i++){
|
||||
if (nAgents[i] != 0) {
|
||||
res += cont[i];
|
||||
cont[i] = cont[i]/nAgents[i];
|
||||
}
|
||||
}
|
||||
modelList[iModel]->setAvContentment(res/modelList[iModel]->getAgentList().size());
|
||||
yCoord.removeFirst();
|
||||
yCoord.push_back(res/modelList[iModel]->getAgentList().size());
|
||||
return cont;
|
||||
}
|
||||
|
||||
/*
|
||||
* Создание модели по полученным данным
|
||||
*/
|
||||
void Manager::initModel(){
|
||||
|
||||
buttonTime->setText("Start");
|
||||
createButton->setText("Recreate");
|
||||
|
||||
yCoord.fill(0);
|
||||
graphCombo->setCurrentIndex(0);
|
||||
graphCombo->setEnabled(false);
|
||||
|
||||
// Визуализация одной модели
|
||||
if (viewOrPackageMode == 0){
|
||||
timer->stop();
|
||||
history->addClassHistory();
|
||||
history->addClassGroupHistory();
|
||||
Model *model = new Model(0, cowardMedian, cowardNormal, protectorMedian, protectorNormal, agentRadius, gamerSpeed, period, initDistr, enmity, newEnmity);
|
||||
modelList.push_back(model);
|
||||
if (manItem != 0){
|
||||
delete manItem;
|
||||
}
|
||||
batchPlot->clearItems();
|
||||
batchPlot->replot();
|
||||
// Создание управленца визуализацией
|
||||
manItem = new ManagerItem(model->getAgentList(), scene, cowardMedian, cowardNormal, protectorMedian);
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(timerEvent()));
|
||||
connect(timer, SIGNAL(timeout()), manItem, SLOT(gameEvent()));
|
||||
connect(checkLink, SIGNAL(toggled(bool)), manItem, SLOT(setLink(bool)));
|
||||
}
|
||||
// Пакетное задание
|
||||
else {
|
||||
// Очистка сцены и графика на первой вкладке
|
||||
scene->clear();
|
||||
plot->graph(0)->setData(xCoord, yCoord);
|
||||
plot->replot();
|
||||
|
||||
prBar->setMinimum(0);
|
||||
prBar->setMaximum(nIterations*nModels);
|
||||
}
|
||||
setEnmity(newEnmity);
|
||||
buttonTime->setEnabled(true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Событие игры. Вычисление новых координат для всех игроков на сцене
|
||||
*/
|
||||
void Manager::timerEvent(){
|
||||
modelList[0]->modelIteration();
|
||||
history->addGroupAvContenmentData(0, calculateAvContenmentForGroups(typeContentment, 0));
|
||||
history->addAvContenmentData(0, modelList[0]->getAvContentment());
|
||||
if (outputToTxt) {
|
||||
history->postPrintModelData(0);
|
||||
history->postPrintGroupData(0);
|
||||
}
|
||||
plot->graph(0)->setData(xCoord, yCoord);
|
||||
plot->replot();
|
||||
history->addGroupAvContenmentData(0, calculateAvContenmentForGroups(typeContentment, 0));
|
||||
history->addAvContenmentData(0, modelList[0]->getAvContentment()); // запись в хранитель данных
|
||||
labelContent->setText("Average contenment: " + QString::number(modelList[0]->getAvContentment()));
|
||||
}
|
||||
|
||||
void Manager::iteration(uint j) {
|
||||
Model *model = new Model(j, cowardMedian, cowardNormal, protectorMedian, protectorNormal, agentRadius, gamerSpeed, period, initDistr, enmity, newEnmity);
|
||||
modelList.append(model);
|
||||
for(int i = 0; i < nIterations; i++){
|
||||
model->modelIteration();
|
||||
history->addGroupAvContenmentData(modelList.indexOf(model), calculateAvContenmentForGroups(typeContentment, modelList.indexOf(model)));
|
||||
history->addAvContenmentData(modelList.indexOf(model), model->getAvContentment());
|
||||
//qApp->processEvents();
|
||||
}
|
||||
if (outputToTxt) {
|
||||
history->postPrintModelData(modelList.indexOf(model));
|
||||
history->postPrintGroupData(modelList.indexOf(model));
|
||||
}
|
||||
model->clear();
|
||||
//delete model;
|
||||
}
|
||||
|
||||
void Manager::handlePrBar() {
|
||||
//prBar->setValue(prBar->value() + nIterations);
|
||||
std::cout << "handlePrBar" << std::endl;
|
||||
}
|
||||
|
||||
/*
|
||||
* Остановка/возобновление игры
|
||||
*/
|
||||
void Manager::handleButton(){
|
||||
// Визуализация модели
|
||||
if(viewOrPackageMode == 0){
|
||||
if (timer->isActive()){
|
||||
timer->stop();
|
||||
buttonTime->setText("Start");
|
||||
}
|
||||
else {
|
||||
timer->start(timer->interval());
|
||||
buttonTime->setText("Pause");
|
||||
}
|
||||
}
|
||||
// Пакетное задание (без возможности остановки)
|
||||
else{
|
||||
buttonTime->setText("In process...");
|
||||
buttonTime->setEnabled(false);
|
||||
createButton->setEnabled(false);
|
||||
tabWindow->setTabEnabled(0, false);
|
||||
//prBar->setValue(0);
|
||||
|
||||
if(!multipleThreads){
|
||||
for (int i = 0; i < nModels; i++) {
|
||||
history->addClassHistory();
|
||||
history->addClassGroupHistory();
|
||||
iteration(i);
|
||||
prBar->setValue(prBar->value() + nIterations);
|
||||
}
|
||||
}
|
||||
else {
|
||||
QVector<QFuture<void> > futureVector;
|
||||
QVector<QFutureWatcher<void> *> watcherVector;
|
||||
for (int i = 0; i < nThreads; i++) {
|
||||
QFuture<void> future;
|
||||
futureVector.append(future);
|
||||
QFutureWatcher<void> *watcher = new QFutureWatcher<void>;
|
||||
watcherVector.append(watcher);
|
||||
//connect(watcherVector[i], SIGNAL(finished()), this, SLOT(handlePrBar()));
|
||||
}
|
||||
|
||||
for(int i = 0; i < nModels; i++) {
|
||||
history->addClassHistory();
|
||||
history->addClassGroupHistory();
|
||||
}
|
||||
|
||||
for(int j = 0; j < nModels/nThreads; j++){
|
||||
for (int i = 0; i < nThreads; i++) {
|
||||
//qApp->processEvents();
|
||||
futureVector[i] = QtConcurrent::run(this, &Manager::iteration, j*nThreads + i);
|
||||
watcherVector[i]->setFuture(futureVector[i]);
|
||||
}
|
||||
qApp->processEvents();
|
||||
prBar->setValue(prBar->value() + nThreads*nIterations);
|
||||
for (int i = 0; i < nThreads; i++) {
|
||||
watcherVector[i]->waitForFinished();
|
||||
//modelList[j*nThreads + i]->clear();
|
||||
//prBar->setValue(prBar->value() + nIterations);
|
||||
}
|
||||
}
|
||||
//qApp->processEvents();
|
||||
if (nModels % nThreads != 0) {
|
||||
for (int i = 0; i < nModels % nThreads; i++) {
|
||||
futureVector[i] = QtConcurrent::run(this, &Manager::iteration, nThreads*(nModels/nThreads) + i);
|
||||
watcherVector[i]->setFuture(futureVector[i]);
|
||||
}
|
||||
prBar->setValue(prBar->value() + (nModels % nThreads)*nIterations);
|
||||
for (int i = 0; i < nModels % nThreads; i++) {
|
||||
watcherVector[i]->waitForFinished();
|
||||
//modelList[nThreads*(nModels/nThreads) + i]->clear();
|
||||
//prBar->setValue(prBar->value() + nIterations);
|
||||
}
|
||||
}
|
||||
}
|
||||
qDeleteAll(modelList.begin(), modelList.end());
|
||||
modelList.clear();
|
||||
if (outputToTxt) {
|
||||
history->postPrintGlobalAverage();
|
||||
}
|
||||
disconnect(graphCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(composeGraph(int)));
|
||||
graphCombo->clear();
|
||||
graphCombo->addItem("---");
|
||||
for(int i = 0; i < nModels; i++){
|
||||
QString comboString = "Model ";
|
||||
comboString += QString::number(i + 1);
|
||||
graphCombo->addItem(comboString);
|
||||
}
|
||||
if (nModels > 1) {
|
||||
graphCombo->addItem("Average for all models");
|
||||
}
|
||||
connect(graphCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(composeGraph(int)));
|
||||
buttonTime->setText("Start");
|
||||
buttonTime->setEnabled(true);
|
||||
graphCombo->setEnabled(true);
|
||||
createButton->setEnabled(true);
|
||||
tabWindow->setTabEnabled(0, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Перезапуск таймера
|
||||
*/
|
||||
void Manager::timerRestart(int index){
|
||||
if (index == 0){
|
||||
timer->setInterval(1000/10);
|
||||
}
|
||||
else if(index == 1){
|
||||
timer->setInterval(1000/20);
|
||||
}
|
||||
else if(index == 2){
|
||||
timer->setInterval(1000/30);
|
||||
}
|
||||
else if(index == 3){
|
||||
timer->setInterval(1000/50);
|
||||
}
|
||||
else if (index == 4){
|
||||
timer->setInterval(1000/100);
|
||||
}
|
||||
else{}
|
||||
}
|
||||
|
||||
void Manager::resetProgressBarAndHistory(){
|
||||
prBar->setValue(0);
|
||||
history->clearHistory();
|
||||
}
|
||||
/*
|
||||
* Вкл/выкл спинбокс для радиуса окрестности
|
||||
*/
|
||||
void Manager::manageSpinLocality(int value){
|
||||
if (value == 0){
|
||||
spinLocality->setEnabled(false);
|
||||
}
|
||||
else{
|
||||
spinLocality->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Вкл/выкл спинбокс для числа итераций и спинбокс для числа запусков модели
|
||||
*/
|
||||
void Manager::managePackageOptions(int val){
|
||||
if(val == 0){
|
||||
spinIterations->setEnabled(false);
|
||||
spinModels->setEnabled(false);
|
||||
checkLink->setEnabled(true);
|
||||
comboTime->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
timer->stop();
|
||||
spinIterations->setEnabled(true);
|
||||
spinModels->setEnabled(true);
|
||||
checkLink->setEnabled(false);
|
||||
comboTime->setEnabled(false);
|
||||
}
|
||||
tabWindow->setCurrentIndex(val);
|
||||
}
|
||||
|
||||
void Manager::composeGraph(int iModel) {
|
||||
xBatchCoord.resize(nIterations);
|
||||
QVector<qreal> avCM(nIterations, 0);
|
||||
QVector<qreal> avPM(nIterations, 0);
|
||||
QVector<qreal> avCN(nIterations, 0);
|
||||
QVector<qreal> avPN(nIterations, 0);
|
||||
|
||||
for(int i = 0; i < nIterations; i++) {
|
||||
xBatchCoord[i] = i;
|
||||
}
|
||||
yBatchCoord.resize(nIterations);
|
||||
batchPlot->xAxis->setRange(0, nIterations + 1);
|
||||
if(iModel == 0) {
|
||||
yBatchCoord.fill(0);
|
||||
}
|
||||
else if (iModel == nModels + 1){
|
||||
yBatchCoord = history->getAverageForAllModels().toVector();
|
||||
avCM = history->getAverageForGroup(CM).toVector();
|
||||
avPM = history->getAverageForGroup(PM).toVector();
|
||||
avCN = history->getAverageForGroup(CN).toVector();
|
||||
avPN = history->getAverageForGroup(PN).toVector();
|
||||
} else {
|
||||
yBatchCoord = history->getHistory(iModel - 1).toVector();
|
||||
avCM = history->getGroupHistory(iModel - 1, CM).toVector();
|
||||
avPM = history->getGroupHistory(iModel - 1, PM).toVector();
|
||||
avCN = history->getGroupHistory(iModel - 1, CN).toVector();
|
||||
avPN = history->getGroupHistory(iModel - 1, PN).toVector();
|
||||
}
|
||||
batchPlot->graph(0)->setData(xBatchCoord, yBatchCoord);
|
||||
batchPlot->graph(CM + 1)->setData(xBatchCoord, avCM);
|
||||
batchPlot->graph(PM + 1)->setData(xBatchCoord, avPM);
|
||||
batchPlot->graph(CN + 1)->setData(xBatchCoord, avCN);
|
||||
batchPlot->graph(PN + 1)->setData(xBatchCoord, avPN);
|
||||
batchPlot->legend->setVisible(true);
|
||||
batchPlot->replot();
|
||||
}
|
||||
|
||||
void Manager::saveGragh() {
|
||||
batchPlot->saveJpg(lineSaveWithName->text() + ".jpg");
|
||||
}
|
||||
109
DEC_GUI/Agressor/manager.h
Normal file
109
DEC_GUI/Agressor/manager.h
Normal file
@@ -0,0 +1,109 @@
|
||||
#ifndef MANAGER_H
|
||||
#define MANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtWidgets>
|
||||
#include "agent.h"
|
||||
#include "agentitem.h"
|
||||
#include "aphistory.h"
|
||||
#include "manageritem.h"
|
||||
#include "model.h"
|
||||
#include "Kolch_Shind/qcustomplot.h"
|
||||
|
||||
class Manager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Manager(QObject *parent = 0); // конструктор
|
||||
void initSettings(QGroupBox *set); // создание окна настроек
|
||||
void initTab(QTabWidget *tabs);
|
||||
QVector<qreal> calculateAvContenmentForGroups(uint typeCalc, uint iModel);
|
||||
void iteration(uint j);
|
||||
|
||||
// геттеры
|
||||
uint getCowardMedian(){return this->cowardMedian;}
|
||||
uint getCowardNormal(){return this->cowardNormal;}
|
||||
uint getProtectorMedian(){return this->protectorMedian;}
|
||||
uint getProtectorNormal(){return this->protectorNormal;}
|
||||
|
||||
private:
|
||||
QList<Model*> modelList;
|
||||
QVector<qreal> xCoord; // x координата для построения графика средней неудовлетворённости
|
||||
QVector<qreal> yCoord; // y координата для построения графика средней неудовлетворённости
|
||||
QVector<qreal> xBatchCoord;
|
||||
QVector<qreal> yBatchCoord;
|
||||
uint cowardMedian; // число игроков в режиме труса, движущихся по медиане
|
||||
uint cowardNormal; // число игроков в режиме труса, движущихся по нормали
|
||||
uint protectorMedian; // число игроков в режиме защитника, движущихся по медиане
|
||||
uint protectorNormal; // число игроков в режиме защитника, движущихся по нормали
|
||||
int agentRadius; // радиус шарика-агента (для передачи в конструктор)
|
||||
uint speedDistr; // распределение скоростей (однородное)
|
||||
uint gamerSpeed; // скорость агентов
|
||||
bool period; // метка периодичности краёв сцены (true - сцена периодична)
|
||||
uint initDistr; // метка начального распределения игроков сцены (0 - случайное, 1 - на круге)
|
||||
uint enmity; // минимальное расстояние, на которое игроки могут приближаются друг к другу, enmity = 0 - возможно покоординатное совпадение игроков
|
||||
uint newEnmity; // параметр enmity, полученный из диалогового окна
|
||||
int viewOrPackageMode; // 0 - визуализация одной модели, 1 - пакетное задание
|
||||
int nIterations; // число итераций для пакетного задания
|
||||
int nModels; // число запусков модели для пакетного задания
|
||||
uint typeContentment; // способ расчёта ср.неудовлетворённости: 0 - сравнение со всеми агентами, 1 - сравнение внутри окрестности
|
||||
//qreal avContentment; // ср.неудовлетворённость (ToDo: а надо ли?)
|
||||
uint radiusLocality; // радиус окрестности в случае typeContenment = 1
|
||||
QWidget *window;
|
||||
QGridLayout *base;
|
||||
QTabWidget *tabWindow;
|
||||
QGraphicsScene *scene;
|
||||
ManagerItem *manItem;
|
||||
QCustomPlot *plot;
|
||||
QPushButton *createButton; // кнопка создания модели
|
||||
QPushButton *buttonTime; // кнопка "Pause/Start"
|
||||
QLabel *labelContent;
|
||||
QSpinBox *spinLocality;
|
||||
QComboBox *viewOrPackage;
|
||||
QCheckBox *checkLink;
|
||||
QCheckBox *checkOutputToTxt;
|
||||
QComboBox *comboTime;
|
||||
QSpinBox *spinIterations;
|
||||
QSpinBox *spinModels;
|
||||
bool outputToTxt;
|
||||
QTimer *timer;
|
||||
QProgressBar *prBar;
|
||||
QComboBox *graphCombo;
|
||||
QCustomPlot *batchPlot;
|
||||
QLineEdit *lineSaveWithName;
|
||||
APHistory *history;
|
||||
|
||||
private slots:
|
||||
void setCowardMedian(int cm) {this->cowardMedian = cm;}
|
||||
void setCowardNormal(int cn) {this->cowardNormal = cn;}
|
||||
void setProtectorMedian(int pm) {this->protectorMedian = pm;}
|
||||
void setProtectorNormal(int pn) {this->protectorNormal = pn;}
|
||||
void setAgentRadius(int rad){this->agentRadius = rad;}
|
||||
void setSpeedDistr(int spDistr) {this->speedDistr = spDistr;}
|
||||
void setGamerSpeed(int gamerSp) {this->gamerSpeed = gamerSp;}
|
||||
void setPeriodicity(bool value) {this->period = value;}
|
||||
void setDistr(int distr){this->initDistr = distr;}
|
||||
void setEnmity(int enm) {this->enmity = enm;}
|
||||
void setNewEnmity(int nEnm){this->newEnmity = nEnm;}
|
||||
void setviewOrPackageMode(int val){this->viewOrPackageMode = val;}
|
||||
void setNIterations(int number){this->nIterations = number;}
|
||||
void setNModels(int number){this->nModels = number;}
|
||||
void setOutputToTxt(bool output) {this->outputToTxt = output;}
|
||||
void setTypeContenment(int type){this->typeContentment = type;}
|
||||
//void setAvContentment(qreal cont){this->avContentment = cont;}
|
||||
void setRadiusLocality(int rad){this->radiusLocality = rad;}
|
||||
|
||||
void initModel(); // создание модели по полученным данным
|
||||
void timerEvent(); // итерация игры - вычисление новых координат для всех игроков
|
||||
void handlePrBar();
|
||||
void handleButton(); // остановка/возобновление игры
|
||||
void timerRestart(int index); // перезапуск таймера
|
||||
void resetProgressBarAndHistory();
|
||||
void composeGraph(int iModel);
|
||||
void saveGragh();
|
||||
// вкл/выкл пункты окна настроеек
|
||||
void manageSpinLocality(int value);
|
||||
void managePackageOptions(int val);
|
||||
};
|
||||
|
||||
#endif // MANAGER_H
|
||||
160
DEC_GUI/Agressor/manageritem.cpp
Normal file
160
DEC_GUI/Agressor/manageritem.cpp
Normal file
@@ -0,0 +1,160 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <QGraphicsScene>
|
||||
#include <QPen>
|
||||
#include "manageritem.h"
|
||||
|
||||
static const qreal pi = 3.14159265358979323846264338327950288419717;
|
||||
|
||||
/*
|
||||
* Конструктор
|
||||
*/
|
||||
ManagerItem::ManagerItem(QList<Agent*> agents, QGraphicsScene *sceneParameter, int CM, int CN, int PM/*, int PN*/):
|
||||
agent(agents), scene(sceneParameter), link(0)
|
||||
{
|
||||
fillingScene(CM, CN, PM);
|
||||
}
|
||||
|
||||
/*
|
||||
* Отрисовка связей между агентами и их агрессорами, защитниками/защищаемыми
|
||||
*/
|
||||
void ManagerItem::drawLinks(){
|
||||
for(int i = 0; i < agent.size(); i++){
|
||||
Agent *gamer = agent[i];
|
||||
QGraphicsLineItem *item1 = new QGraphicsLineItem(QLineF(gamer->getCoordX(), gamer->getCoordY(),
|
||||
agent[gamer->getAgressor()]->getCoordX(), agent[gamer->getAgressor()]->getCoordY()));
|
||||
QGraphicsLineItem *item2 = new QGraphicsLineItem(QLineF(gamer->getCoordX(), gamer->getCoordY(),
|
||||
agent[gamer->getProtector()]->getCoordX(), agent[gamer->getProtector()]->getCoordY()));
|
||||
item1->setPen(QPen(Qt::blue));
|
||||
item2->setPen(QPen(Qt::green));
|
||||
links.push_back(item1);
|
||||
links.push_back(item2);
|
||||
scene->addItem(item1);
|
||||
scene->addItem(item2);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Отрисовка направлений связей
|
||||
*/
|
||||
void ManagerItem::drawArrow(){
|
||||
for(int i = 0; i < agent.size(); i++){
|
||||
Agent *gamer = agent[i];
|
||||
QLineF *line1 = new QLineF(gamer->getCoordX(), gamer->getCoordY(),
|
||||
agent[gamer->getAgressor()]->getCoordX(), agent[gamer->getAgressor()]->getCoordY());
|
||||
QLineF *line2 = new QLineF(gamer->getCoordX(), gamer->getCoordY(),
|
||||
agent[gamer->getProtector()]->getCoordX(), agent[gamer->getProtector()]->getCoordY());
|
||||
qreal angel1 = ::acos(line1->dx()/line1->length());
|
||||
qreal angel2 = ::acos(line2->dx()/line2->length());
|
||||
if (line1->dy() >= 0){
|
||||
angel1 = 2*pi - angel1;
|
||||
}
|
||||
if (line2->dy() >= 0){
|
||||
angel2 = 2*pi - angel2;
|
||||
}
|
||||
if (line1->length() > 20){
|
||||
line1->setLength(20);
|
||||
QPointF point1 = line1->p2();
|
||||
QPointF point2 = point1 + QPointF(sin(angel1 - pi/3)*10, cos(angel1 - pi/3)*10);
|
||||
QPointF point3 = point1 + QPointF(sin(angel1 - 2*pi/3)*10, cos(angel1 - 2*pi/3)*10);
|
||||
QGraphicsPolygonItem *poly1 = new QGraphicsPolygonItem(QPolygonF() << point1 << point2 << point3);
|
||||
poly1->setBrush(QBrush(Qt::blue));
|
||||
poly1->setPen(QPen(Qt::blue));
|
||||
arrows.push_back(poly1);
|
||||
scene->addItem(poly1);
|
||||
}
|
||||
else {}
|
||||
if (line2->length() > 20){
|
||||
line2->setLength(20);
|
||||
QPointF point4 = line2->p2();
|
||||
QPointF point5 = point4 + QPointF(sin(angel2 - pi/3)*10, cos(angel2 - pi/3)*10);
|
||||
QPointF point6 = point4 + QPointF(sin(angel2 - 2*pi/3)*10, cos(angel2 - 2*pi/3)*10);
|
||||
QGraphicsPolygonItem *poly2 = new QGraphicsPolygonItem(QPolygonF() << point4 << point5 << point6);
|
||||
poly2->setBrush(QBrush(Qt::green));
|
||||
poly2->setPen(QPen(Qt::green));
|
||||
arrows.push_back(poly2);
|
||||
scene->addItem(poly2);
|
||||
}
|
||||
else {}
|
||||
delete line1;
|
||||
delete line2;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Заполнение сцены
|
||||
*/
|
||||
void ManagerItem:: fillingScene(int CM, int CN, int PM/*, int PN*/) {
|
||||
|
||||
clearScene();
|
||||
|
||||
QGraphicsRectItem *rect = new QGraphicsRectItem(-300, -300, 600, 600);
|
||||
rect->setPen(QPen(Qt::gray));
|
||||
scene->addItem(rect);
|
||||
|
||||
//std::cout << "start filling scene with number of gamers =" << agent.size() << std::endl;
|
||||
for(int i = 0; i < agent.size(); i++){
|
||||
AgentItem *agentIt;
|
||||
if (i < CM){
|
||||
agentIt = new AgentItem(agent[i], Qt::red);
|
||||
}
|
||||
else if (i < CM + CN){
|
||||
agentIt = new AgentItem(agent[i], Qt::darkBlue);
|
||||
}
|
||||
else if (i < CM + CN + PM){
|
||||
agentIt = new AgentItem(agent[i], Qt::yellow);
|
||||
}
|
||||
else {
|
||||
agentIt = new AgentItem(agent[i], Qt::cyan);
|
||||
}
|
||||
agentItems.push_back(agentIt);
|
||||
agentIt->setPos(agent[i]->getCoordX(), agent[i]->getCoordY());
|
||||
scene->addItem(agentIt);
|
||||
}
|
||||
//std::cout << "INFO: ManagerItem::fillingScene finished, number of items =" << agentItems.size() << std::endl;
|
||||
}
|
||||
|
||||
/*
|
||||
* Очистка сцены
|
||||
*/
|
||||
void ManagerItem:: clearScene(){
|
||||
scene->clear();
|
||||
qDeleteAll(agentItems.begin(), agentItems.end());
|
||||
agentItems.clear();
|
||||
qDeleteAll(links.begin(), links.end());
|
||||
links.clear();
|
||||
qDeleteAll(arrows.begin(), arrows.end());
|
||||
arrows.clear();
|
||||
}
|
||||
|
||||
void ManagerItem::setLink(bool val){
|
||||
this->link = val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Событие игры: перерисовка всех элементов сцены, графика
|
||||
*/
|
||||
void ManagerItem::gameEvent(){
|
||||
//std::cout << "INFO: ManagerItem::gameEvent start, agentItemsSize: " << agentItems.size() << std::endl;
|
||||
// Перерисовка агентов
|
||||
for(int i = 0; i < agentItems.size(); i++){
|
||||
agentItems[i]->agentEvent();
|
||||
}
|
||||
//Очистка сцены от связей
|
||||
for (int i = 0; i < links.size(); i++){
|
||||
scene->removeItem(links[i]);
|
||||
delete links[i];
|
||||
}
|
||||
for (int i = 0; i < arrows.size(); i++){
|
||||
scene->removeItem(arrows[i]);
|
||||
delete arrows[i];
|
||||
}
|
||||
links.clear();
|
||||
arrows.clear();
|
||||
|
||||
// Отрисовка актуальных связей (если необходимо)
|
||||
if(link == true){
|
||||
drawLinks();
|
||||
drawArrow();
|
||||
}
|
||||
}
|
||||
29
DEC_GUI/Agressor/manageritem.h
Normal file
29
DEC_GUI/Agressor/manageritem.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef MANAGERITEM_H
|
||||
#define MANAGERITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QObject>
|
||||
#include "agent.h"
|
||||
#include "agentitem.h"
|
||||
|
||||
class ManagerItem : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ManagerItem(QList<Agent*> agents, QGraphicsScene *sceneParameter, int CM, int CN, int PM/*, int PN*/);
|
||||
void drawLinks(); // отрисовать связи
|
||||
void drawArrow(); // отрисовать направление связей
|
||||
void fillingScene(int CM, int CN, int PM); // заполнение сцены
|
||||
void clearScene(); // очистка сцены
|
||||
private:
|
||||
QList <Agent*> agent;
|
||||
QList <AgentItem *> agentItems;
|
||||
QList <QGraphicsLineItem *> links;
|
||||
QList <QGraphicsPolygonItem *> arrows;
|
||||
bool link; // флаг: отображать ли связи
|
||||
QGraphicsScene *scene;
|
||||
public slots:
|
||||
void setLink(bool val);
|
||||
void gameEvent(); // событие игры: перерисовка всех элементов сцены, графика
|
||||
};
|
||||
|
||||
#endif // MANAGERITEM_H
|
||||
356
DEC_GUI/Agressor/model.cpp
Normal file
356
DEC_GUI/Agressor/model.cpp
Normal file
@@ -0,0 +1,356 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <QApplication>
|
||||
#include <QLabel>
|
||||
#include <QString>
|
||||
#include <QTime>
|
||||
#include "model.h"
|
||||
|
||||
static const qreal pi = 3.14159265358979323846264338327950288419717;
|
||||
|
||||
/*
|
||||
* Знак числа
|
||||
*/
|
||||
template <typename T> int sgn(T val) {
|
||||
return (T(0) < val) - (val < T(0));
|
||||
}
|
||||
|
||||
Model::Model(uint modelId, uint CM, uint CN, uint PM, uint PN, int radius, uint speed, bool period, uint distr,
|
||||
uint enmity, uint newEnmity, QObject *parent): id(modelId), cowardMedian(CM), cowardNormal(CN),
|
||||
protectorMedian(PM), protectorNormal(PN), agentRadius(radius), gamerSpeed(speed), period(period), initDistr(distr),
|
||||
enmity(enmity), newEnmity(newEnmity), avContentment(0), QObject(parent)
|
||||
{
|
||||
uint agr; // номер агрессора (для передачи в конструктор игрока)
|
||||
uint prot; // номер защитника (для передачи в конструктор игрока)
|
||||
|
||||
// Конструирование игроков, заполнение списка игроков
|
||||
uint gamerCount = cowardMedian + cowardNormal + protectorMedian + protectorNormal;
|
||||
QTime now = QTime::currentTime();
|
||||
qsrand(now.msec());
|
||||
|
||||
for(uint i = 0; i < gamerCount; i++){
|
||||
do {
|
||||
agr = qrand() % gamerCount;
|
||||
}
|
||||
while (agr == i); // игрок не может быть собственным агрессором
|
||||
do {
|
||||
prot = qrand() % gamerCount;
|
||||
}
|
||||
while(prot == i || prot == agr); // игрок и агрессор не могут быть защитниками
|
||||
|
||||
Agent *gamer = new Agent(i, agr, prot, 0, 0, agentRadius, gamerSpeed);
|
||||
if (i < cowardMedian){}
|
||||
else if (i < cowardMedian + cowardNormal){
|
||||
gamer->setStratedy(1);
|
||||
}
|
||||
else if (i < cowardMedian + cowardNormal + protectorMedian){
|
||||
gamer->setMode(1);
|
||||
}
|
||||
else {
|
||||
gamer->setMode(1);
|
||||
gamer->setStratedy(1);
|
||||
}
|
||||
uint d;
|
||||
if (initDistr == 0){
|
||||
d = qrand() % 220 + 70;
|
||||
}
|
||||
else {
|
||||
d = 200;
|
||||
}
|
||||
agentList.push_back(gamer);
|
||||
agentList[i]->setCoordX(::sin((i * 2 * pi) / gamerCount) * d);
|
||||
agentList[i]->setCoordY(::cos((i * 2 * pi) / gamerCount) * d);
|
||||
}
|
||||
setEnmity(newEnmity);
|
||||
}
|
||||
|
||||
/*
|
||||
* Функция, возвращающая модуль от числа
|
||||
*/
|
||||
qreal Model::mod(qreal a){
|
||||
qreal mod = (a > 0) ? a : -a;
|
||||
return mod;
|
||||
}
|
||||
|
||||
/* Функция, возвращающая список игроков, с которыми столкнётся игрок index
|
||||
* при сдвиге на вектор (x, y); dist - максимальное расстояние, на котором игроки считаются столкнувшимися
|
||||
*/
|
||||
QList<Agent *> Model::DangerGamer(uint index, qreal x, qreal y, uint dist){
|
||||
//std:: cout << "INFO: Manager::DangerGamer start" << std::endl;
|
||||
QList <Agent *> DangerGamers;
|
||||
for(int i = 0; i < agentList.size(); i++){
|
||||
if(i == index){
|
||||
continue;
|
||||
}
|
||||
else{
|
||||
QLineF toAgent = QLineF(agentList[index]->getCoordX() + x, agentList[index]->getCoordY() + y, agentList[i]->getCoordX(), agentList[i]->getCoordY());
|
||||
if(toAgent.length() <= dist){
|
||||
DangerGamers.push_back(agentList[i]);
|
||||
}
|
||||
else{}
|
||||
}
|
||||
}
|
||||
return DangerGamers;
|
||||
}
|
||||
|
||||
QList<QList<Agent *> > Model::DangerGamer(QList<QList<Agent *> > danger, int index, qreal x, qreal y, uint dist){
|
||||
//std:: cout << "INFO: Manager::DangerGamer start" << std::endl;
|
||||
for(int i = index + 1; i < agentList.size(); i++){
|
||||
QLineF toAgent = QLineF(agentList[index]->getCoordX() + x, agentList[index]->getCoordY() + y, agentList[i]->getCoordX(), agentList[i]->getCoordY());
|
||||
if(toAgent.length() <= dist){
|
||||
danger[index].push_back(agentList[i]);
|
||||
danger[i].push_back(agentList[index]);
|
||||
}
|
||||
else {}
|
||||
}
|
||||
return danger;
|
||||
}
|
||||
|
||||
/*
|
||||
* Проверка, выходит ли вектор checked в координатах игрока с номером gamerId за пределы сцены по координате x
|
||||
* возвращает true, если выходит, false - иначе.
|
||||
*/
|
||||
bool Model::leaveWindowX(uint agentId, QLineF checked){
|
||||
if(mod(agentList[agentId]->getCoordX() + checked.dx()) > 300 - agentList[agentId]->getRadius()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Проверка, выходит ли вектор checked в координатах игрока с номером gamerId за пределы сцены по координате y
|
||||
* возвращает true, если выходит, false - иначе.
|
||||
*/
|
||||
bool Model::leaveWindowY(uint agentId, QLineF checked){
|
||||
if(mod(agentList[agentId]->getCoordY() + checked.dy()) > 300 - agentList[agentId]->getRadius()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Преобразование координат из-за периодичности сцены
|
||||
* (при попытке выйти за пределы окна игрок должен "выйти" с противоположной стороны сцены)
|
||||
* параметры: номер игрока, вектор сдвига
|
||||
* возвращает преобразованный вектор сдвига
|
||||
*/
|
||||
QLineF Model::periodicTransf(uint index, QLineF tend){
|
||||
qreal x = tend.dx();
|
||||
qreal y = tend.dy();
|
||||
// Проверка на выход за пределы окна по координате x
|
||||
if (mod(tend.dx() + agentList[index]->getCoordX()) > 300 - agentList[index]->getRadius()){
|
||||
x = -1*(600 - 2*agentList[index]->getRadius())*sgn(tend.dx()) + tend.dx();
|
||||
}
|
||||
else{}
|
||||
// Проверка на выход за пределы окна по координате y
|
||||
if (mod(tend.dy() + agentList[index]->getCoordY()) > 300 - agentList[index]->getRadius()){
|
||||
y = -1*(600 - 2*agentList[index]->getRadius())*sgn(tend.dy()) + tend.dy();
|
||||
}
|
||||
else{}
|
||||
return QLineF(0, 0, x, y);
|
||||
}
|
||||
|
||||
/*
|
||||
* Вычисление новых координат для игрока под номером gamerId
|
||||
*/
|
||||
QLineF Model::requiredVector(uint agentId){
|
||||
//std:: cout << "req start" << std::endl;
|
||||
Agent *agressorAg = agentList[agentList[agentId]->getAgressor()];
|
||||
Agent *protectorAg = agentList[agentList[agentId]->getProtector()];
|
||||
// Вычисление координат агрессора и защитника
|
||||
qreal protectorX = protectorAg->getCoordX();
|
||||
qreal protectorY = protectorAg->getCoordY();
|
||||
qreal agressorX = agressorAg->getCoordX();
|
||||
qreal agressorY = agressorAg->getCoordY();
|
||||
|
||||
QLineF fromAtoPr(agressorX, agressorY, protectorX, protectorY);
|
||||
QLineF shiftVector;
|
||||
|
||||
if (agentList[agentId]->getStrategy() == 0){ // Агент движется вдоль медианы
|
||||
// Режим труса
|
||||
if(agentList[agentId]->getMode() == 0){
|
||||
qreal shiftX = agressorX + 2*fromAtoPr.dx() - agentList[agentId]->getCoordX();
|
||||
qreal shiftY = agressorY + 2*fromAtoPr.dy() - agentList[agentId]->getCoordY();
|
||||
shiftVector = QLineF(0, 0, shiftX, shiftY);
|
||||
}
|
||||
// Режим защитника
|
||||
else if(agentList[agentId]->getMode() == 1){
|
||||
qreal shiftX = agressorX + fromAtoPr.dx()/2 - agentList[agentId]->getCoordX();
|
||||
qreal shiftY = agressorY + fromAtoPr.dy()/2 - agentList[agentId]->getCoordY();
|
||||
shiftVector = QLineF(0, 0, shiftX, shiftY);
|
||||
}
|
||||
else {}
|
||||
agentList[agentId]->setDistTarget(shiftVector.length());
|
||||
// Проверка: не проскочить мимо цели
|
||||
if (shiftVector.length() > agentList[agentId]->getSpeed()){
|
||||
shiftVector.setLength(agentList[agentId]->getSpeed());
|
||||
}
|
||||
else{}
|
||||
}
|
||||
else if (agentList[agentId]->getStrategy() == 1){ // если агент движется вдоль нормали
|
||||
|
||||
// ToDo: поправить логику
|
||||
if((protectorY - agressorY == 0 && agressorX - protectorX == 0)){
|
||||
agentList[agentId]->setDistTarget(0);
|
||||
return QLineF(0, 0, 0, 0);
|
||||
}
|
||||
// Расстояние от игрока до прямой, на которой расположены агрессор и защитник
|
||||
qreal dist = (mod((protectorY - agressorY)*agressorX + (agressorX - protectorX)*agressorY)) /
|
||||
sqrt(pow((qreal)protectorY - agressorY, 2) + pow((qreal)agressorX - protectorX, 2));
|
||||
|
||||
// Игрок стремится к данной прямой по нормали.
|
||||
shiftVector = QLineF (0, 0, protectorY - agressorY, agressorX - protectorX);
|
||||
|
||||
// Если свободный член в уравнении прямой Ax + By + C = 0 больше нуля, нормаль нужно перевернуть + нормализация вектора.
|
||||
if (agressorX*(protectorY - agressorY) + agressorY*(agressorX - protectorX) < 0){
|
||||
shiftVector = QLineF(shiftVector.dx(), shiftVector.dy(), 0, 0);
|
||||
|
||||
}
|
||||
else {}
|
||||
// Установление места назначения в точности на пересечение нормали с прямой
|
||||
shiftVector.setLength(dist);
|
||||
|
||||
QLineF fromShiftToA (shiftVector.dx() + agentList[agentId]->getCoordX(), shiftVector.dy() + agentList[agentId]->getCoordY(), agressorX, agressorY);
|
||||
QLineF fromShiftToPr (shiftVector.dx() + agentList[agentId]->getCoordX(), shiftVector.dy() + agentList[agentId]->getCoordY(), protectorX, protectorY);
|
||||
|
||||
// Режим труса
|
||||
if(agentList[agentId]->getMode() == 0){
|
||||
// Проверка, не окажется ли место назначения между агрессором и протектором
|
||||
// (а то и вовсе за агрессором)
|
||||
if((fromShiftToA.length() < fromShiftToPr.length()) && (fromShiftToA.length() >= fromAtoPr.length())){
|
||||
// Установление желаемых координат в точности за защитником
|
||||
QLineF hide = fromAtoPr;
|
||||
hide.setLength(enmity);
|
||||
shiftVector = QLineF(0, 0, protectorX + hide.dx() - agentList[agentId]->getCoordX(), protectorY + hide.dy() - agentList[agentId]->getCoordY());
|
||||
}
|
||||
else{}
|
||||
agentList[agentId]->setDistTarget(shiftVector.length());
|
||||
// Проверка: не проскочить мимо цели
|
||||
if (shiftVector.length() >= agentList[agentId]->getSpeed()){
|
||||
shiftVector.setLength(agentList[agentId]->getSpeed());
|
||||
}
|
||||
else {}
|
||||
}
|
||||
// Режим защитника
|
||||
else if (agentList[agentId]->getMode() == 1){
|
||||
// Проверка, попадает ли точка назначения в промежуток между A и B
|
||||
if((fromAtoPr.length() < fromShiftToPr.length()) && (fromAtoPr.length() >= fromShiftToPr.length())){
|
||||
// Установление желаемых координат посередине между А и В
|
||||
QLineF AtoPr = fromAtoPr;
|
||||
AtoPr.setLength(fromAtoPr.length()/2);
|
||||
shiftVector = QLineF(0, 0, agressorX + AtoPr.dx() - agentList[agentId]->getCoordX(),
|
||||
agressorY + AtoPr.dy() - agentList[agentId]->getCoordY());
|
||||
}
|
||||
else {}
|
||||
agentList[agentId]->setDistTarget(shiftVector.length());
|
||||
// Проверка: не проскочить мимо цели
|
||||
if (shiftVector.length() >= agentList[agentId]->getSpeed()){
|
||||
shiftVector.setLength(agentList[agentId]->getSpeed());
|
||||
}
|
||||
else {}
|
||||
}
|
||||
else {}
|
||||
}
|
||||
else{}
|
||||
//qApp->processEvents();
|
||||
|
||||
//ToDo: сократить код
|
||||
|
||||
// Для непериодичной сцены
|
||||
if (period == false){
|
||||
// Проверка на выход за пределы окна, "подрезание" вектора перемещения
|
||||
if (agentList[agentId]->getCoordX() + shiftVector.dx() > 300 - agentList[agentId]->getRadius()){
|
||||
shiftVector = QLineF(0, 0, 300 - agentList[agentId]->getRadius() - agentList[agentId]->getCoordX(), shiftVector.dy());
|
||||
}
|
||||
else if(agentList[agentId]->getCoordX() + shiftVector.dx() < -300 + agentList[agentId]->getRadius()){
|
||||
shiftVector = QLineF(0, 0, -300 + agentList[agentId]->getRadius() - agentList[agentId]->getCoordX(), shiftVector.dy());
|
||||
}
|
||||
else{}
|
||||
if(agentList[agentId]->getCoordY() + shiftVector.dy() > 300 - agentList[agentId]->getRadius()){
|
||||
shiftVector = QLineF(0, 0, shiftVector.dx(), 300 - agentList[agentId]->getRadius() - agentList[agentId]->getCoordY());
|
||||
}
|
||||
else if(agentList[agentId]->getCoordY() + shiftVector.dy() < -300 + agentList[agentId]->getRadius()){
|
||||
shiftVector = QLineF(0, 0, shiftVector.dx(), -300 + agentList[agentId]->getRadius() - agentList[agentId]->getCoordY());
|
||||
}
|
||||
else {}
|
||||
}
|
||||
// Для периодичной сцены
|
||||
else{
|
||||
// Пересчёт координат с учётом периодичности сцены
|
||||
shiftVector = periodicTransf(agentId, shiftVector);
|
||||
}
|
||||
//qApp->processEvents();
|
||||
|
||||
if(enmity > 0){
|
||||
// Проверка на столкновение
|
||||
//if (agentId < agentList.size() - 1){
|
||||
QList<Agent*> dangerAgents = DangerGamer(/*dangerAgents, */ agentId, shiftVector.dx(), shiftVector.dy(), enmity);
|
||||
//}
|
||||
//QList<Agent*> dangerAgents = DangerGamer(agentId, shiftVector.dx(), shiftVector.dy(), enmity);
|
||||
if(dangerAgents.isEmpty()){
|
||||
//std:: cout << "req start" << std::endl;
|
||||
return shiftVector;
|
||||
}
|
||||
else{
|
||||
// Попытка обойти все потенциальные угрозы стороной. Если не получается, игрок остаётся на месте
|
||||
for (int i = 0; i < dangerAgents.size(); i++){
|
||||
QLineF toAgent = QLineF(agentList[agentId]->getCoordX() + shiftVector.dx(), agentList[agentId]->getCoordY() + shiftVector.dy(),
|
||||
dangerAgents[i]->getCoordX(), dangerAgents[i]->getCoordY());
|
||||
shiftVector = toAgent.normalVector().unitVector();
|
||||
if (period == false){ // для непериодичной сцены - проверка на покидание окна + на новое столкновение
|
||||
QList<Agent*> futureDangerous = DangerGamer(agentId, shiftVector.dx(), shiftVector.dy(), enmity);
|
||||
if(futureDangerous.isEmpty() && leaveWindowX(agentId, shiftVector) && leaveWindowY(agentId, shiftVector) == false){
|
||||
return shiftVector;
|
||||
}
|
||||
else{}
|
||||
futureDangerous.clear();
|
||||
}
|
||||
else{ // для периодичной сцены - преобразование координат из-за периодичности + проверка на новое столкновение
|
||||
shiftVector = periodicTransf(agentId, shiftVector);
|
||||
QList<Agent*> futureDangerous = DangerGamer(agentId, shiftVector.dx(), shiftVector.dy(), enmity);
|
||||
if(futureDangerous.isEmpty()){
|
||||
return shiftVector;
|
||||
}
|
||||
else{}
|
||||
futureDangerous.clear();
|
||||
}
|
||||
//qApp->processEvents();
|
||||
//std::cout << agentId << " Check for crush is done" << std::endl;
|
||||
}
|
||||
//std:: cout << "req start" << std::endl;
|
||||
return QLineF(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//std::cout << "total shift X: " << shiftVector.dx() << " total shift Y: " << shiftVector.dy() << std::endl;
|
||||
//std:: cout << "req start" << std::endl;
|
||||
return shiftVector;
|
||||
}
|
||||
}
|
||||
|
||||
void Model::modelIteration() {
|
||||
QList <QLineF> shift;
|
||||
// Вычисление новых координат
|
||||
// QList<QList<Agent *>> dangerAgents;
|
||||
// for (int i = 0; i < agentList.size(); i++) {
|
||||
// QList<Agent *> content;
|
||||
// dangerAgents.push_back(content);
|
||||
// }
|
||||
for(int i = 0; i < agentList.size(); i++){
|
||||
shift.append(requiredVector(i));
|
||||
//std:: cout << "INFO: iteration: " << step << " agent: " << i << std::endl;
|
||||
}
|
||||
// Смена координат на новые
|
||||
for(int i = 0; i < agentList.size(); i++){
|
||||
agentList[i]->gameEvent(shift[i]);
|
||||
}
|
||||
//qApp->processEvents();
|
||||
shift.clear();
|
||||
}
|
||||
|
||||
void Model::clear() {
|
||||
qDeleteAll(agentList.begin(), agentList.end());
|
||||
agentList.clear();
|
||||
}
|
||||
49
DEC_GUI/Agressor/model.h
Normal file
49
DEC_GUI/Agressor/model.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef MODEL_H
|
||||
#define MODEL_H
|
||||
|
||||
#include <QObject>
|
||||
#include "agent.h"
|
||||
|
||||
|
||||
class Model : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Model(uint modelId, uint CM, uint CN, uint PM, uint PN, int radius, uint speed, bool period, uint distr,
|
||||
uint enmity, uint newEnmity, QObject *parent = 0);
|
||||
qreal mod(qreal a); // модуль числа
|
||||
QList <Agent *> DangerGamer(uint index, qreal x, qreal y, uint dist); // список игроков, с которыми возможно столкновение
|
||||
QList<QList<Agent *> > DangerGamer(QList<QList<Agent *> > danger, int index, qreal x, qreal y, uint dist);
|
||||
bool leaveWindowX(uint agentId, QLineF checked); // проверка на покидание окна по координате X
|
||||
bool leaveWindowY(uint agentId, QLineF checked); // проверка на покидание окна по координате Y
|
||||
QLineF periodicTransf(uint index, QLineF tend); // преобразование координат из-за перидочности сцены
|
||||
QLineF requiredVector(uint gamerId); // вычисление новых координат для игрока с номером gamerId
|
||||
void modelIteration();
|
||||
uint getId() {return id;}
|
||||
QList <Agent *> getAgentList() {return this->agentList;}
|
||||
void setEnmity(int enm) {this->enmity = enm;}
|
||||
void setAvContentment(qreal cont){this->avContentment = cont;}
|
||||
qreal getAvContentment(){return this->avContentment;}
|
||||
void clear();
|
||||
|
||||
private:
|
||||
uint id;
|
||||
QList <Agent *> agentList; // список указателей на игроков
|
||||
uint cowardMedian; // число игроков в режиме труса, движущихся по медиане
|
||||
uint cowardNormal; // число игроков в режиме труса, движущихся по нормали
|
||||
uint protectorMedian; // число игроков в режиме защитника, движущихся по медиане
|
||||
uint protectorNormal; // число игроков в режиме защитника, движущихся по нормали
|
||||
int agentRadius; // радиус шарика-агента (для передачи в конструктор)
|
||||
uint newEnmity; // параметр enmity, полученный из диалогового окна
|
||||
uint gamerSpeed; // скорость агентов
|
||||
bool period; // метка периодичности краёв сцены (true - сцена периодична)
|
||||
uint initDistr; // метка начального распределения игроков сцены (0 - случайное, 1 - на круге)
|
||||
uint enmity; // минимальное расстояние, на которое игроки могут приближаются друг к другу, enmity = 0 - возможно покоординатное совпадение игроков
|
||||
qreal avContentment;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // MODEL_H
|
||||
2002
DEC_GUI/DEC-0.0/1.xls
Normal file
2002
DEC_GUI/DEC-0.0/1.xls
Normal file
File diff suppressed because it is too large
Load Diff
442
DEC_GUI/DEC-0.0/DEC-0.0.vcproj
Normal file
442
DEC_GUI/DEC-0.0/DEC-0.0.vcproj
Normal file
@@ -0,0 +1,442 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="DEC-0.0"
|
||||
ProjectGUID="{40B43ED1-51FA-4A77-9057-945EFC442A7B}"
|
||||
RootNamespace="DEC00"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="C:\Programs\boost_1_46_1\;C:\Programming\boost_1_45_0\;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="C:\Programs\boost_1_46_1\;C:\Programming\boost_1_45_0\;"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\DEC-0.0.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DerevyankoReport2014.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\DerevyankoReport2014.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="environment"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Environment\AbstractEnvironment.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\environment\AbstractRegion.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\environment\Environment.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\environment\Region.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="individual"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Individual\AbstractIndividual.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\Individual.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\InnerSubstratesPool.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Individual\InnerSubstratesPool.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\Phenotype.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Individual\Phenotype.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\Trait.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\Trait.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="genome"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\individual\genome\AbstractGenome.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\Chromosome.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\Chromosome.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\Gene.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\Gene.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\Genotype.cpp"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="strategies"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\ChromosomeRearrangementStrategy.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\ChromosomeRearrangementStrategy.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\GenotypeToPhenotypeStrategy.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\GenotypeToPhenotypeStrategy.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\PhenotypeToFitnessStrategy.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\PhenotypeToFitnessStrategy.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="InOutBreeding"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\InOutBreeding\InOutBreedingPhenToFitStrategy.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\InOutBreeding\InOutBreedingPhenToFitStrategy.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\InOutBreeding\InOutBreedingPopulationBreedingStrategy.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\InOutBreeding\InOutBreedingPopulationBreedingStrategy.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\InOutBreeding\InOutBreeginGenToPhenStrategy.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="KolchShindyal"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\KolchShindyal\KolchShindyalBreedingStrategy.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\KolchShindyal\KolchShindyalBreedingStrategy.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\KolchShindyal\KolchShindyalGenotypeToPhenotypeStrategy.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\KolchShindyal\KolchShindyalGenotypeToPhenotypeStrategy.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\KolchShindyal\KolchShindyalPhenToFitnessStrategy.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\individual\genome\strategies\KolchShindyal\KolchShindyalPhenToFitnessStrategy.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="population"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\population\BisexualPopulation.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\population\Population.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\population\Population.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="BreedingStrategies"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\population\BreedingStrategies\NeutralEvolutionBreedStrat.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\population\BreedingStrategies\NeutralEvolutionBreedStrat.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\population\BreedingStrategies\PopulationBreedingStrategy.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\population\BreedingStrategies\PopulationBreedingStrategy.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\population\BreedingStrategies\VerhulstBreedingStrategy.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\population\BreedingStrategies\VerhulstBreedingStrategy.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="processor"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\DerevyankoReport.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DerevyankoReport.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\processor\KolchShindyalov.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\processor\KolchShindyalov.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\processor\Processor.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\processor\Processor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\processor\Settings.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\processor\Settings.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ToDoList.txt"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
65
DEC_GUI/DEC-0.0/DEC-0.0.vcproj.NEPTUNE.lashin.user
Normal file
65
DEC_GUI/DEC-0.0/DEC-0.0.vcproj.NEPTUNE.lashin.user
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioUserFile
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
ShowAllFiles="false"
|
||||
>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="NEPTUNE"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="NEPTUNE"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</VisualStudioUserFile>
|
||||
65
DEC_GUI/DEC-0.0/DEC-0.0.vcproj.ROCKWOOD.Family.user
Normal file
65
DEC_GUI/DEC-0.0/DEC-0.0.vcproj.ROCKWOOD.Family.user
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioUserFile
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
ShowAllFiles="false"
|
||||
>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="ROCKWOOD"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="ROCKWOOD"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</VisualStudioUserFile>
|
||||
65
DEC_GUI/DEC-0.0/DEC-0.0.vcproj.Rockwood.rock.user
Normal file
65
DEC_GUI/DEC-0.0/DEC-0.0.vcproj.Rockwood.rock.user
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioUserFile
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
ShowAllFiles="false"
|
||||
>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="ROCKWOOD"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="ROCKWOOD"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</VisualStudioUserFile>
|
||||
65
DEC_GUI/DEC-0.0/DEC-0.0.vcproj.neptune2010.lashin.user
Normal file
65
DEC_GUI/DEC-0.0/DEC-0.0.vcproj.neptune2010.lashin.user
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioUserFile
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
ShowAllFiles="false"
|
||||
>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="NEPTUNE2010"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="NEPTUNE2010"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</VisualStudioUserFile>
|
||||
65
DEC_GUI/DEC-0.0/DEC-0.0.vcproj.rockwood.Sergey.user
Normal file
65
DEC_GUI/DEC-0.0/DEC-0.0.vcproj.rockwood.Sergey.user
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioUserFile
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
ShowAllFiles="false"
|
||||
>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="ROCKWOOD"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="ROCKWOOD"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</VisualStudioUserFile>
|
||||
147
DEC_GUI/DEC-0.0/DEC-0.0.vcxproj
Normal file
147
DEC_GUI/DEC-0.0/DEC-0.0.vcxproj
Normal file
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{40B43ED1-51FA-4A77-9057-945EFC442A7B}</ProjectGuid>
|
||||
<RootNamespace>DEC00</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>11.0.61030.0</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>C:\Programs\boost_1_46_1\;C:\Programming\boost_1_45_0\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>C:\Programs\boost_1_46_1\;C:\Programming\boost_1_45_0\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DEC-0.0.cpp" />
|
||||
<ClCompile Include="DerevyankoReport2014.cpp" />
|
||||
<ClCompile Include="environment\Environment.cpp" />
|
||||
<ClCompile Include="environment\Region.cpp" />
|
||||
<ClCompile Include="individual\Individual.cpp" />
|
||||
<ClCompile Include="individual\InnerSubstratesPool.cpp" />
|
||||
<ClCompile Include="individual\Phenotype.cpp" />
|
||||
<ClCompile Include="individual\Trait.cpp" />
|
||||
<ClCompile Include="individual\genome\Chromosome.cpp" />
|
||||
<ClCompile Include="individual\genome\Gene.cpp" />
|
||||
<ClCompile Include="individual\genome\Genotype.cpp" />
|
||||
<ClCompile Include="individual\genome\strategies\ChromosomeRearrangementStrategy.cpp" />
|
||||
<ClCompile Include="individual\genome\strategies\GenotypeToPhenotypeStrategy.cpp" />
|
||||
<ClCompile Include="individual\genome\strategies\PhenotypeToFitnessStrategy.cpp" />
|
||||
<ClCompile Include="individual\genome\strategies\InOutBreeding\InOutBreedingPhenToFitStrategy.cpp" />
|
||||
<ClCompile Include="individual\genome\strategies\InOutBreeding\InOutBreedingPopulationBreedingStrategy.cpp" />
|
||||
<ClCompile Include="individual\genome\strategies\InOutBreeding\InOutBreeginGenToPhenStrategy.cpp" />
|
||||
<ClCompile Include="individual\genome\strategies\KolchShindyal\KolchShindyalBreedingStrategy.cpp" />
|
||||
<ClCompile Include="individual\genome\strategies\KolchShindyal\KolchShindyalGenotypeToPhenotypeStrategy.cpp" />
|
||||
<ClCompile Include="individual\genome\strategies\KolchShindyal\KolchShindyalPhenToFitnessStrategy.cpp" />
|
||||
<ClCompile Include="population\BisexualPopulation.cpp" />
|
||||
<ClCompile Include="population\Population.cpp" />
|
||||
<ClCompile Include="population\BreedingStrategies\NeutralEvolutionBreedStrat.cpp" />
|
||||
<ClCompile Include="population\BreedingStrategies\PopulationBreedingStrategy.cpp" />
|
||||
<ClCompile Include="population\BreedingStrategies\VerhulstBreedingStrategy.cpp" />
|
||||
<ClCompile Include="DerevyankoReport.cpp" />
|
||||
<ClCompile Include="processor\KolchShindyalov.cpp" />
|
||||
<ClCompile Include="processor\Processor.cpp" />
|
||||
<ClCompile Include="processor\Settings.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DerevyankoReport2014.h" />
|
||||
<ClInclude Include="Environment\AbstractEnvironment.h" />
|
||||
<ClInclude Include="environment\AbstractRegion.h" />
|
||||
<ClInclude Include="Individual\AbstractIndividual.h" />
|
||||
<ClInclude Include="Individual\InnerSubstratesPool.h" />
|
||||
<ClInclude Include="Individual\Phenotype.h" />
|
||||
<ClInclude Include="individual\Trait.h" />
|
||||
<ClInclude Include="individual\genome\AbstractGenome.h" />
|
||||
<ClInclude Include="individual\genome\Chromosome.h" />
|
||||
<ClInclude Include="individual\genome\Gene.h" />
|
||||
<ClInclude Include="individual\genome\strategies\ChromosomeRearrangementStrategy.h" />
|
||||
<ClInclude Include="individual\genome\strategies\GenotypeToPhenotypeStrategy.h" />
|
||||
<ClInclude Include="individual\genome\strategies\PhenotypeToFitnessStrategy.h" />
|
||||
<ClInclude Include="individual\genome\strategies\InOutBreeding\InOutBreedingPhenToFitStrategy.h" />
|
||||
<ClInclude Include="individual\genome\strategies\InOutBreeding\InOutBreedingPopulationBreedingStrategy.h" />
|
||||
<ClInclude Include="individual\genome\strategies\KolchShindyal\KolchShindyalBreedingStrategy.h" />
|
||||
<ClInclude Include="individual\genome\strategies\KolchShindyal\KolchShindyalGenotypeToPhenotypeStrategy.h" />
|
||||
<ClInclude Include="individual\genome\strategies\KolchShindyal\KolchShindyalPhenToFitnessStrategy.h" />
|
||||
<ClInclude Include="population\Population.h" />
|
||||
<ClInclude Include="population\BreedingStrategies\NeutralEvolutionBreedStrat.h" />
|
||||
<ClInclude Include="population\BreedingStrategies\PopulationBreedingStrategy.h" />
|
||||
<ClInclude Include="population\BreedingStrategies\VerhulstBreedingStrategy.h" />
|
||||
<ClInclude Include="DerevyankoReport.h" />
|
||||
<ClInclude Include="processor\KolchShindyalov.h" />
|
||||
<ClInclude Include="processor\Processor.h" />
|
||||
<ClInclude Include="processor\Settings.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ToDoList.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
216
DEC_GUI/DEC-0.0/DEC-0.0.vcxproj.filters
Normal file
216
DEC_GUI/DEC-0.0/DEC-0.0.vcxproj.filters
Normal file
@@ -0,0 +1,216 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\environment">
|
||||
<UniqueIdentifier>{1543172e-803c-444e-8cda-6a2308e41db2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\individual">
|
||||
<UniqueIdentifier>{01603e36-7499-4442-a781-b13e2af1fd98}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\individual\genome">
|
||||
<UniqueIdentifier>{05942c27-3dc6-45ca-8cc0-accdf0dc3b86}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\individual\genome\strategies">
|
||||
<UniqueIdentifier>{7c9f48d2-5ac8-4755-a0a2-536a0eacf1e8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\individual\genome\strategies\InOutBreeding">
|
||||
<UniqueIdentifier>{651fa082-b05e-41a5-a43b-0698a5dce75c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\individual\genome\strategies\KolchShindyal">
|
||||
<UniqueIdentifier>{a12457ad-86da-429a-b79c-59cfe2ad991d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\population">
|
||||
<UniqueIdentifier>{831c8153-9898-45b7-81d8-a65c0aa1e297}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\population\BreedingStrategies">
|
||||
<UniqueIdentifier>{f7bd5858-9457-4195-9b6e-50b7db3bfc5f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\processor">
|
||||
<UniqueIdentifier>{5dfc1f18-3517-4edd-8a1a-ab0a9993ba0f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="DEC-0.0.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DerevyankoReport2014.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="environment\Environment.cpp">
|
||||
<Filter>Header Files\environment</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="environment\Region.cpp">
|
||||
<Filter>Header Files\environment</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\Individual.cpp">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\InnerSubstratesPool.cpp">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\Phenotype.cpp">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\Trait.cpp">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\Chromosome.cpp">
|
||||
<Filter>Header Files\individual\genome</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\Gene.cpp">
|
||||
<Filter>Header Files\individual\genome</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\Genotype.cpp">
|
||||
<Filter>Header Files\individual\genome</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\ChromosomeRearrangementStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\GenotypeToPhenotypeStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\PhenotypeToFitnessStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\InOutBreeding\InOutBreedingPhenToFitStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies\InOutBreeding</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\InOutBreeding\InOutBreedingPopulationBreedingStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies\InOutBreeding</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\InOutBreeding\InOutBreeginGenToPhenStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies\InOutBreeding</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\KolchShindyal\KolchShindyalBreedingStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies\KolchShindyal</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\KolchShindyal\KolchShindyalGenotypeToPhenotypeStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies\KolchShindyal</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="individual\genome\strategies\KolchShindyal\KolchShindyalPhenToFitnessStrategy.cpp">
|
||||
<Filter>Header Files\individual\genome\strategies\KolchShindyal</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="population\BisexualPopulation.cpp">
|
||||
<Filter>Header Files\population</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="population\Population.cpp">
|
||||
<Filter>Header Files\population</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="population\BreedingStrategies\NeutralEvolutionBreedStrat.cpp">
|
||||
<Filter>Header Files\population\BreedingStrategies</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="population\BreedingStrategies\PopulationBreedingStrategy.cpp">
|
||||
<Filter>Header Files\population\BreedingStrategies</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="population\BreedingStrategies\VerhulstBreedingStrategy.cpp">
|
||||
<Filter>Header Files\population\BreedingStrategies</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DerevyankoReport.cpp">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="processor\KolchShindyalov.cpp">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="processor\Processor.cpp">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="processor\Settings.cpp">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DerevyankoReport2014.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Environment\AbstractEnvironment.h">
|
||||
<Filter>Header Files\environment</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="environment\AbstractRegion.h">
|
||||
<Filter>Header Files\environment</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Individual\AbstractIndividual.h">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Individual\InnerSubstratesPool.h">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Individual\Phenotype.h">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\Trait.h">
|
||||
<Filter>Header Files\individual</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\AbstractGenome.h">
|
||||
<Filter>Header Files\individual\genome</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\Chromosome.h">
|
||||
<Filter>Header Files\individual\genome</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\Gene.h">
|
||||
<Filter>Header Files\individual\genome</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\ChromosomeRearrangementStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\GenotypeToPhenotypeStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\PhenotypeToFitnessStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\InOutBreeding\InOutBreedingPhenToFitStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies\InOutBreeding</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\InOutBreeding\InOutBreedingPopulationBreedingStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies\InOutBreeding</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\KolchShindyal\KolchShindyalBreedingStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies\KolchShindyal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\KolchShindyal\KolchShindyalGenotypeToPhenotypeStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies\KolchShindyal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="individual\genome\strategies\KolchShindyal\KolchShindyalPhenToFitnessStrategy.h">
|
||||
<Filter>Header Files\individual\genome\strategies\KolchShindyal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="population\Population.h">
|
||||
<Filter>Header Files\population</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="population\BreedingStrategies\NeutralEvolutionBreedStrat.h">
|
||||
<Filter>Header Files\population\BreedingStrategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="population\BreedingStrategies\PopulationBreedingStrategy.h">
|
||||
<Filter>Header Files\population\BreedingStrategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="population\BreedingStrategies\VerhulstBreedingStrategy.h">
|
||||
<Filter>Header Files\population\BreedingStrategies</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DerevyankoReport.h">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="processor\KolchShindyalov.h">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="processor\Processor.h">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="processor\Settings.h">
|
||||
<Filter>Header Files\processor</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ToDoList.txt" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
18
DEC_GUI/DEC-0.0/DecScript.txt
Normal file
18
DEC_GUI/DEC-0.0/DecScript.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
//////////
|
||||
|
||||
fullstat=1
|
||||
generations=100
|
||||
popsize=100
|
||||
kmax=2000
|
||||
|
||||
offsprings=3
|
||||
|
||||
|
||||
coadaptive_threshold=0
|
||||
disease_threshold=1
|
||||
|
||||
// Coadaptive genes interact (possible: onechromosome, mean, maxmodule)
|
||||
cgi=mean
|
||||
|
||||
// Disease genes interact (possible: add1, addmax, mult, meanadd, meanmult )
|
||||
dgi=addmax
|
||||
611
DEC_GUI/DEC-0.0/DerevyankoReport.cpp
Normal file
611
DEC_GUI/DEC-0.0/DerevyankoReport.cpp
Normal file
@@ -0,0 +1,611 @@
|
||||
#include "DerevyankoReport.h"
|
||||
#include "individual/Trait.h"
|
||||
#include "individual/Phenotype.h"
|
||||
//#include "population/BreedingStrategies/PopulationBreedingStrategy.h"
|
||||
#include "population/BreedingStrategies/NeutralEvolutionBreedStrat.h"
|
||||
|
||||
#include <list>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
using std::string;
|
||||
|
||||
string DerevyankoReport::initMtDNA;
|
||||
string DerevyankoReport::initMtDNA_G;
|
||||
std::vector<std::string> DerevyankoReport::initMtDNAgui;
|
||||
std::vector<std::string> DerevyankoReport::initMtDNA_Ggui;
|
||||
|
||||
BisexualPopulation* DerevyankoReport::pop_f;
|
||||
BisexualPopulation* DerevyankoReport::pop_G;
|
||||
BisexualPopulation* DerevyankoReport::pop_e;
|
||||
BisexualPopulation* DerevyankoReport::pop_F;
|
||||
BisexualPopulation* DerevyankoReport::pop_d;
|
||||
BisexualPopulation* DerevyankoReport::pop_E;
|
||||
BisexualPopulation* DerevyankoReport::pop_c;
|
||||
BisexualPopulation* DerevyankoReport::pop_D;
|
||||
BisexualPopulation* DerevyankoReport::pop_b;
|
||||
BisexualPopulation* DerevyankoReport::pop_a;
|
||||
BisexualPopulation* DerevyankoReport::pop_A;
|
||||
BisexualPopulation* DerevyankoReport::pop_B;
|
||||
BisexualPopulation* DerevyankoReport::pop_C;
|
||||
|
||||
int DerevyankoReport::basePopSize = 5000;
|
||||
float DerevyankoReport::initBirthRate = 0.25f;
|
||||
float DerevyankoReport::deltaBirthRate = 0.0002f;
|
||||
|
||||
int DerevyankoReport::genPerMigr_f_G;
|
||||
float DerevyankoReport::part_f_to_G;
|
||||
float DerevyankoReport::part_G_to_f;
|
||||
|
||||
int DerevyankoReport::genPerMigr_A_B;
|
||||
int DerevyankoReport::genPerMigr_A_C;
|
||||
int DerevyankoReport::genPerMigr_A_D;
|
||||
int DerevyankoReport::genPerMigr_A_E;
|
||||
int DerevyankoReport::genPerMigr_A_F;
|
||||
|
||||
float DerevyankoReport::part_A_to_B;
|
||||
float DerevyankoReport::part_B_to_A;
|
||||
float DerevyankoReport::part_A_to_C;
|
||||
float DerevyankoReport::part_A_to_D;
|
||||
float DerevyankoReport::part_A_to_E;
|
||||
float DerevyankoReport::part_A_to_F;
|
||||
|
||||
float DerevyankoReport::fraction_e_founder;
|
||||
float DerevyankoReport::fraction_F_founder;
|
||||
float DerevyankoReport::fraction_E_founder;
|
||||
float DerevyankoReport::fraction_D_founder;
|
||||
float DerevyankoReport::fraction_C_founder;
|
||||
float DerevyankoReport::fraction_B_founder;
|
||||
|
||||
QVector<double> DerevyankoReport::popSize_f;
|
||||
QVector<double> DerevyankoReport::popSize_G;
|
||||
QVector<double> DerevyankoReport::popSize_e;
|
||||
QVector<double> DerevyankoReport::popSize_F;
|
||||
QVector<double> DerevyankoReport::popSize_d;
|
||||
QVector<double> DerevyankoReport::popSize_E;
|
||||
QVector<double> DerevyankoReport::popSize_c;
|
||||
QVector<double> DerevyankoReport::popSize_D;
|
||||
QVector<double> DerevyankoReport::popSize_b;
|
||||
QVector<double> DerevyankoReport::popSize_a;
|
||||
QVector<double> DerevyankoReport::popSize_A;
|
||||
QVector<double> DerevyankoReport::popSize_B;
|
||||
QVector<double> DerevyankoReport::popSize_C;
|
||||
|
||||
QVector<BisexualPopulation*> DerevyankoReport::pops;
|
||||
QVector<QString> DerevyankoReport::populNames;
|
||||
QVector<int> DerevyankoReport::maxYval(2);
|
||||
// if uncomment report, set size to 13
|
||||
//QVector<int> DerevyankoReport::globalGenerations(13);
|
||||
int DerevyankoReport::globalGenerations;
|
||||
QVector< QVector<double> > DerevyankoReport::popSizes(2);
|
||||
QVector< QVector<double> > DerevyankoReport::generations(2);
|
||||
|
||||
|
||||
|
||||
void DerevyankoReport::initVectors()
|
||||
{
|
||||
DerevyankoReport::popSizes[0].push_back(DerevyankoReport::basePopSize);
|
||||
|
||||
DerevyankoReport::popSizes[1].push_back(DerevyankoReport::basePopSize);
|
||||
DerevyankoReport::generations[0].push_back(0);
|
||||
DerevyankoReport::generations[1].push_back(0);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
DerevyankoReport::maxYval[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DerevyankoReport::fillVectors(BisexualPopulation *pop, int popNum)
|
||||
{
|
||||
|
||||
DerevyankoReport::generations[popNum].push_back(globalGenerations);
|
||||
DerevyankoReport::popSizes[popNum].push_back(pop->males.size() + pop->males.size());
|
||||
if (pop->males.size() + pop->males.size() > DerevyankoReport::maxYval[popNum])
|
||||
{
|
||||
DerevyankoReport::maxYval[popNum] = pop->males.size() + pop->males.size();
|
||||
}
|
||||
}
|
||||
|
||||
BisexualPopulation* DerevyankoReport::populationFactory(int size, std::string initMtGenome){
|
||||
BisexualPopulation* ans;
|
||||
|
||||
std::list<Individual*> males;
|
||||
std::list<Individual*> females;
|
||||
|
||||
Gene gene1(Gene::Sequence, "mtDna1", initMtGenome);
|
||||
Chromosome chrom1("Mitochondrial chromosome");
|
||||
chrom1.insertGeneToEnd(gene1);
|
||||
|
||||
std::vector<Chromosome> fGenome;
|
||||
std::vector<Chromosome> mGenome;
|
||||
fGenome.push_back(chrom1);
|
||||
mGenome.push_back(chrom1);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Trait trait1(Trait::Discrete, "Age", 20);
|
||||
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
InnerSubstratesPool* subPool = 0;
|
||||
// (END) <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
for(int i = 0; i < size/2; i++){
|
||||
Genotype* genotype = new Genotype(fGenome, mGenome);
|
||||
Phenotype* phenotype = new Phenotype(trait1);
|
||||
males.push_back(new Individual(genotype, phenotype, subPool, Individual::male, 0));
|
||||
|
||||
genotype = new Genotype(fGenome, mGenome);
|
||||
phenotype = new Phenotype(trait1);
|
||||
females.push_back(new Individual(genotype, phenotype, subPool, Individual::female, 0));
|
||||
}
|
||||
|
||||
ans = new BisexualPopulation(males,females);
|
||||
return ans;
|
||||
}
|
||||
|
||||
void DerevyankoReport::separatePop(QString popName, double founder, int sepPopInd)
|
||||
{
|
||||
//Derfraction_founder = founder;
|
||||
BisexualPopulation* population = DerevyankoReport::pops[sepPopInd]->createSubpopulation(founder);
|
||||
|
||||
|
||||
BisexualPopulation* population_rest = DerevyankoReport::pops[sepPopInd]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> d
|
||||
NeutralEvolutionBreedingStrategy* breedStrat_d =
|
||||
dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
breedStrat_d->setBirthRate(initBirthRate);
|
||||
breedStrat_d->setDeathRate(initBirthRate-deltaBirthRate*2);
|
||||
population_rest->setBreedingStrategy(breedStrat_d);
|
||||
DerevyankoReport::pops.push_back(population);
|
||||
DerevyankoReport::pops.push_back(population_rest);
|
||||
|
||||
QVector<double> pop_gen;
|
||||
QVector<double> pop_size;
|
||||
|
||||
QVector<double> pop_gen_2;
|
||||
QVector<double> pop_size_2;
|
||||
|
||||
DerevyankoReport::popSizes.push_back(pop_size);
|
||||
DerevyankoReport::generations.push_back(pop_gen);
|
||||
DerevyankoReport::maxYval.push_back(0);
|
||||
|
||||
DerevyankoReport::popSizes.push_back(pop_size_2);
|
||||
DerevyankoReport::generations.push_back(pop_gen_2);
|
||||
DerevyankoReport::maxYval.push_back(0);
|
||||
|
||||
DerevyankoReport::populNames.push_back(popName);
|
||||
QString name = DerevyankoReport::populNames[sepPopInd] + "_rest";
|
||||
DerevyankoReport::populNames.push_back(name);
|
||||
}
|
||||
|
||||
void DerevyankoReport::evolution(int evol_time)
|
||||
{
|
||||
for(int i = 0; i < evol_time; i++)
|
||||
{
|
||||
for (int j = 0; j < DerevyankoReport::pops.size(); j++)
|
||||
{
|
||||
DerevyankoReport::pops[j]->breedAll();
|
||||
DerevyankoReport::pops[j]->mutationAll();
|
||||
DerevyankoReport::fillVectors(DerevyankoReport::pops[j], j);
|
||||
}
|
||||
DerevyankoReport::globalGenerations++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void DerevyankoReport::reportRFBR2013_01(){
|
||||
|
||||
std::cout << "ReportRFBR" << std::endl;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> f)
|
||||
// DerevyankoReport::initMtDNA = "TTCTTTCATGGGGAAGCAGATTTGGGTACCACCCAAGTATTGACTCACCCATCAACAACC";
|
||||
// DerevyankoReport::initMtDNA += "GCTATGTATTTCGTACATTACTGCCAGCCACCATGAATATTGTACGGTACCATAAATACT";
|
||||
// DerevyankoReport::initMtDNA += "TGACCACCTGTAGTACATAAAAACCCAATCCACATCAAAACCCCCCCCTCATGCTTACAA";
|
||||
// DerevyankoReport::initMtDNA += "GCAAGTACAGCAATCAACCTTCAACTATCACACATCAACTGCAACTCCAAAGCCACCCCT";
|
||||
// DerevyankoReport::initMtDNA += "CACCCACTAGGATATCAACAAACCTACCCATCCTTAACAGTACATGGTACATAAAGCCAT";
|
||||
// DerevyankoReport::initMtDNA += "TTACCGTACATAGCACATTACAGTCAAATCCCTTCTCGTCCCCATGGATGACCCCCCTCA";
|
||||
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> G)
|
||||
// DerevyankoReport::initMtDNA_G = DerevyankoReport::initMtDNA;
|
||||
// DerevyankoReport::initMtDNA_G.replace(60,1,"T");
|
||||
// DerevyankoReport::initMtDNA_G.replace(120,1,"A");
|
||||
// DerevyankoReport::initMtDNA_G.replace(180,1,"C");
|
||||
// DerevyankoReport::initMtDNA_G.replace(240,1,"G");
|
||||
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// //
|
||||
// DerevyankoReport::basePopSize = 5000;
|
||||
// DerevyankoReport::initBirthRate = 0.25f;
|
||||
// DerevyankoReport::deltaBirthRate = 0.0002f;
|
||||
BisexualPopulation *pop_f = populationFactory(basePopSize, DerevyankoReport::initMtDNA);
|
||||
NeutralEvolutionBreedingStrategy* breedStrat_f =
|
||||
dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
breedStrat_f->setBirthRate(initBirthRate);
|
||||
breedStrat_f->setDeathRate(initBirthRate-deltaBirthRate);
|
||||
pop_f->setBreedingStrategy(breedStrat_f);
|
||||
|
||||
BisexualPopulation *pop_G = populationFactory(basePopSize, DerevyankoReport::initMtDNA_G);
|
||||
NeutralEvolutionBreedingStrategy* breedStrat_G =
|
||||
dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
breedStrat_G->setBirthRate(initBirthRate);
|
||||
breedStrat_G->setDeathRate(initBirthRate-deltaBirthRate);
|
||||
pop_G->setBreedingStrategy(breedStrat_G);
|
||||
DerevyankoReport::pops.push_back(pop_f);
|
||||
DerevyankoReport::pops.push_back(pop_G);
|
||||
|
||||
DerevyankoReport::populNames.push_back("Pop_f");
|
||||
DerevyankoReport::populNames.push_back("Pop_G");
|
||||
|
||||
///////////////////////////////////////////
|
||||
//
|
||||
// <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
|
||||
unsigned int generation;
|
||||
|
||||
// <20><><EFBFBD> 1.
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1
|
||||
DerevyankoReport::genPerMigr_f_G = 100;
|
||||
DerevyankoReport::part_f_to_G = 0.01f;
|
||||
DerevyankoReport::part_G_to_f = 0.01f;
|
||||
std::cout<<"Variant 1"<<std::endl;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2
|
||||
//int genPerMigr_f_G = 1000;
|
||||
//float part_f_to_G = 0.1f;
|
||||
//float part_G_to_f = 0.1f;
|
||||
//std::cout<<"Variant 2"<<std::endl;
|
||||
DerevyankoReport::initVectors();
|
||||
for(generation = 0; generation < 7/*7000*/; generation++){
|
||||
std::cout<<"gen\t"<<generation<<std::endl;
|
||||
DerevyankoReport::pops[0]->breedAll();
|
||||
DerevyankoReport::pops[0]->mutationAll();
|
||||
|
||||
DerevyankoReport::pops[1]->breedAll();
|
||||
DerevyankoReport::pops[1]->mutationAll();
|
||||
|
||||
if(generation != 0 && ((generation % genPerMigr_f_G) == 0)){
|
||||
std::string code = BisexualPopulation::mutualMigration(DerevyankoReport::pops[0], DerevyankoReport::pops[1], part_f_to_G, part_G_to_f);
|
||||
std::cout<<"Migration f<->G\t"<<code<<std::endl;
|
||||
}
|
||||
|
||||
DerevyankoReport::globalGenerations++;
|
||||
DerevyankoReport::fillVectors(DerevyankoReport::pops[0], 0);
|
||||
DerevyankoReport::fillVectors(DerevyankoReport::pops[1], 1);
|
||||
|
||||
}
|
||||
|
||||
// // <20><><EFBFBD> 2.
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> e <20> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> (10 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) f <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// DerevyankoReport::fraction_e_founder = 0.5f;
|
||||
// DerevyankoReport::pop_e = DerevyankoReport::pop_f->createSubpopulation(fraction_e_founder);
|
||||
// std::cout<<"pop_e has been created"<<std::endl;
|
||||
|
||||
// for(; generation < 15/*7010*/; generation++){
|
||||
// std::cout<<"gen\t"<<generation<<std::endl;
|
||||
// DerevyankoReport::pop_e->breedAll();
|
||||
// DerevyankoReport::pop_e->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_G->breedAll();
|
||||
// DerevyankoReport::pop_G->mutationAll();
|
||||
// DerevyankoReport::globalGenerations++;
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_e, 2);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_G, 1);
|
||||
// }
|
||||
|
||||
// // <20><><EFBFBD> 3.
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><> F <20> d
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 50 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> d, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 90% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// DerevyankoReport::fraction_F_founder = 0.1f;
|
||||
// DerevyankoReport::pop_F = DerevyankoReport::pop_e->createSubpopulation(fraction_F_founder);
|
||||
// std::cout<<"pop_F has been created"<<std::endl;
|
||||
|
||||
// DerevyankoReport::pop_d = DerevyankoReport::pop_e; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> d
|
||||
// NeutralEvolutionBreedingStrategy* breedStrat_d =
|
||||
// dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
// breedStrat_d->setBirthRate(initBirthRate);
|
||||
// breedStrat_d->setDeathRate(initBirthRate-deltaBirthRate*2);
|
||||
// DerevyankoReport::pop_d->setBreedingStrategy(breedStrat_d);
|
||||
// std::cout<<"pop_e -> pop_d\tPop dynamics coeffs have been changed:\td =\t";
|
||||
// std::cout<<(initBirthRate-deltaBirthRate*2)<<std::endl;
|
||||
|
||||
// for(; generation < 25/*7060*/; generation++){
|
||||
// std::cout<<"gen\t"<<generation<<std::endl;
|
||||
// DerevyankoReport::pop_d->breedAll();
|
||||
// DerevyankoReport::pop_d->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_F->breedAll();
|
||||
// DerevyankoReport::pop_F->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_G->breedAll();
|
||||
// DerevyankoReport::pop_G->mutationAll();
|
||||
// DerevyankoReport::globalGenerations++;
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_F, 3);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_d, 4);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_G, 1);
|
||||
// }
|
||||
|
||||
// // <20><><EFBFBD> 4.
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> d <20><> E <20> c
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 100 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> c, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 90% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// DerevyankoReport::fraction_E_founder = 0.1f;
|
||||
// DerevyankoReport::pop_E = DerevyankoReport::pop_d->createSubpopulation(fraction_E_founder);
|
||||
// std::cout<<"pop_E has been created"<<std::endl;
|
||||
|
||||
// DerevyankoReport::pop_c = DerevyankoReport::pop_d; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> c
|
||||
// NeutralEvolutionBreedingStrategy* breedStrat_c =
|
||||
// dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
// breedStrat_c->setBirthRate(initBirthRate);
|
||||
// breedStrat_c->setDeathRate(initBirthRate-deltaBirthRate*2.5f);
|
||||
// DerevyankoReport::pop_c->setBreedingStrategy(breedStrat_c);
|
||||
// std::cout<<"pop_d -> pop_c\tPop dynamics coeffs have been changed:\td =\t";
|
||||
// std::cout<<(initBirthRate-deltaBirthRate*2.5f)<<std::endl;
|
||||
|
||||
// for(; generation < 35/*7160*/; generation++){
|
||||
// std::cout<<"gen\t"<<generation<<std::endl;
|
||||
// DerevyankoReport::pop_c->breedAll();
|
||||
// DerevyankoReport::pop_c->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_E->breedAll();
|
||||
// DerevyankoReport::pop_E->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_F->breedAll();
|
||||
// DerevyankoReport::pop_F->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_G->breedAll();
|
||||
// DerevyankoReport::pop_G->mutationAll();
|
||||
// DerevyankoReport::globalGenerations++;
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_F, 3);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_c, 5);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_G, 1);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_E, 6);
|
||||
// }
|
||||
|
||||
// // <20><><EFBFBD> 5.
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> c <20><> D <20> b
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 100 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> b, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 90% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// DerevyankoReport::fraction_D_founder = 0.1f;
|
||||
// DerevyankoReport::pop_D = DerevyankoReport::pop_c->createSubpopulation(fraction_D_founder);
|
||||
// std::cout<<"pop_D has been created"<<std::endl;
|
||||
|
||||
// DerevyankoReport::pop_b = DerevyankoReport::pop_c; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> b
|
||||
// NeutralEvolutionBreedingStrategy* breedStrat_b =
|
||||
// dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
// breedStrat_b->setBirthRate(initBirthRate);
|
||||
// breedStrat_b->setDeathRate(initBirthRate-deltaBirthRate*3.f);
|
||||
// DerevyankoReport::pop_b->setBreedingStrategy(breedStrat_b);
|
||||
// std::cout<<"pop_c -> pop_b\tPop dynamics coeffs have been changed:\td =\t";
|
||||
// std::cout<<(initBirthRate-deltaBirthRate*3.f)<<std::endl;
|
||||
|
||||
// for(; generation < 45/*7260*/; generation++){
|
||||
// std::cout<<"gen\t"<<generation<<std::endl;
|
||||
// DerevyankoReport::pop_b->breedAll();
|
||||
// DerevyankoReport::pop_b->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_D->breedAll();
|
||||
// DerevyankoReport::pop_D->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_E->breedAll();
|
||||
// DerevyankoReport::pop_E->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_F->breedAll();
|
||||
// DerevyankoReport::pop_F->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_G->breedAll();
|
||||
// DerevyankoReport::pop_G->mutationAll();
|
||||
// DerevyankoReport::globalGenerations++;
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_F, 3);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_b, 7);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_G, 1);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_E, 6);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_D, 8);
|
||||
|
||||
// }
|
||||
|
||||
// // <20><><EFBFBD> 6.
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> b <20><> C <20> a
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 200 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> a, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 90% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// DerevyankoReport::fraction_C_founder = 0.1f;
|
||||
// DerevyankoReport::pop_C = DerevyankoReport::pop_b->createSubpopulation(fraction_C_founder);
|
||||
// std::cout<<"pop_C has been created"<<std::endl;
|
||||
|
||||
// DerevyankoReport::pop_a = DerevyankoReport::pop_b; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> b
|
||||
// NeutralEvolutionBreedingStrategy* breedStrat_a =
|
||||
// dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
// breedStrat_a->setBirthRate(initBirthRate);
|
||||
// breedStrat_a->setDeathRate(initBirthRate-deltaBirthRate*3.5f);
|
||||
// DerevyankoReport::pop_a->setBreedingStrategy(breedStrat_a);
|
||||
// std::cout<<"pop_b -> pop_a\tPop dynamics coeffs have been changed:\td =\t";
|
||||
// std::cout<<(initBirthRate-deltaBirthRate*3.5f)<<std::endl;
|
||||
|
||||
// for(; generation < 55/*7460*/; generation++){
|
||||
// std::cout<<"gen\t"<<generation<<std::endl;
|
||||
// DerevyankoReport::pop_a->breedAll();
|
||||
// DerevyankoReport::pop_a->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_C->breedAll();
|
||||
// DerevyankoReport::pop_C->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_D->breedAll();
|
||||
// DerevyankoReport::pop_D->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_E->breedAll();
|
||||
// DerevyankoReport::pop_E->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_F->breedAll();
|
||||
// DerevyankoReport::pop_F->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_G->breedAll();
|
||||
// DerevyankoReport::pop_G->mutationAll();
|
||||
// DerevyankoReport::globalGenerations++;
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_F, 3);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_a, 9);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_G, 1);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_E, 6);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_D, 8);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_C, 10);
|
||||
// }
|
||||
|
||||
// // <20><><EFBFBD> 7.
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> a <20><> A <20> B
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2540 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> A, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 50% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||||
// // <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
// // <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> A <20> B, <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> A <20> C, D, E, F (G <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
// DerevyankoReport::fraction_B_founder = 0.5f;
|
||||
// DerevyankoReport::pop_B = DerevyankoReport::pop_a->createSubpopulation(fraction_B_founder);
|
||||
// std::cout<<"pop_B has been created"<<std::endl;
|
||||
|
||||
// DerevyankoReport::pop_A = DerevyankoReport::pop_a; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> A
|
||||
// NeutralEvolutionBreedingStrategy* breedStrat_A =
|
||||
// dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
// breedStrat_A->setBirthRate(initBirthRate);
|
||||
// breedStrat_A->setDeathRate(initBirthRate-deltaBirthRate*4.f);
|
||||
// DerevyankoReport::pop_A->setBreedingStrategy(breedStrat_A);
|
||||
// std::cout<<"pop_a -> pop_A\tPop dynamics coeffs have been changed:\td =\t";
|
||||
// std::cout<<(initBirthRate-deltaBirthRate*4.f)<<std::endl;
|
||||
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1
|
||||
// DerevyankoReport::genPerMigr_A_B = 100;
|
||||
// DerevyankoReport::genPerMigr_A_C = 150;
|
||||
// DerevyankoReport::genPerMigr_A_D = 200;
|
||||
// DerevyankoReport::genPerMigr_A_E = 250;
|
||||
// DerevyankoReport::genPerMigr_A_F = 300;
|
||||
|
||||
// DerevyankoReport::part_A_to_B = 0.01f;
|
||||
// DerevyankoReport::part_B_to_A = 0.01f;
|
||||
// DerevyankoReport::part_A_to_C = 0.005f;
|
||||
// DerevyankoReport::part_A_to_D = 0.005f;
|
||||
// DerevyankoReport::part_A_to_E = 0.005f;
|
||||
// DerevyankoReport::part_A_to_F = 0.005f;
|
||||
|
||||
// for(; generation < 65/*10001*/; generation++){
|
||||
// std::cout<<"gen\t"<<generation<<std::endl;
|
||||
// DerevyankoReport::pop_A->breedAll();
|
||||
// DerevyankoReport::pop_A->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_B->breedAll();
|
||||
// DerevyankoReport::pop_B->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_C->breedAll();
|
||||
// DerevyankoReport::pop_C->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_D->breedAll();
|
||||
// DerevyankoReport::pop_D->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_E->breedAll();
|
||||
// DerevyankoReport::pop_E->mutationAll();
|
||||
|
||||
// DerevyankoReport::pop_F->breedAll();
|
||||
// DerevyankoReport::pop_F->mutationAll();
|
||||
|
||||
// if((generation % genPerMigr_A_B) == 0){
|
||||
// std::string code = BisexualPopulation::mutualMigration(DerevyankoReport::pop_A, DerevyankoReport::pop_B, part_A_to_B, part_B_to_A);
|
||||
// std::cout<<"Migration A<->B\t"<<code<<std::endl;
|
||||
// }
|
||||
// if((generation % genPerMigr_A_C) == 0){
|
||||
// std::string code = BisexualPopulation::mutualMigration(DerevyankoReport::pop_A, DerevyankoReport::pop_C, part_A_to_C, 0.f);
|
||||
// std::cout<<"Migration A->C\t"<<code<<std::endl;
|
||||
// }
|
||||
// if((generation % genPerMigr_A_D) == 0){
|
||||
// std::string code = BisexualPopulation::mutualMigration(DerevyankoReport::pop_A, DerevyankoReport::pop_D, part_A_to_D, 0.f);
|
||||
// std::cout<<"Migration A->D\t"<<code<<std::endl;
|
||||
// }
|
||||
// if((generation % genPerMigr_A_E) == 0){
|
||||
// std::string code = BisexualPopulation::mutualMigration(DerevyankoReport::pop_A, DerevyankoReport::pop_E, part_A_to_E, 0.f);
|
||||
// std::cout<<"Migration A->E\t"<<code<<std::endl;
|
||||
// }
|
||||
// if((generation % genPerMigr_A_F) == 0){
|
||||
// std::string code = BisexualPopulation::mutualMigration(DerevyankoReport::pop_A, DerevyankoReport::pop_F, part_A_to_F, 0.f);
|
||||
// std::cout<<"Migration A->F\t"<<code<<std::endl;
|
||||
// }
|
||||
// DerevyankoReport::globalGenerations++;
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_F, 3);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_A, 11);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_B, 12);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_E, 6);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_D, 8);
|
||||
// DerevyankoReport::fillVectors(DerevyankoReport::pop_C, 10);
|
||||
// }
|
||||
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
// std::ofstream file("GenStatistics.pop_A.fasta");
|
||||
// DerevyankoReport::pop_A->putGeneticStatisticsToStream(file);
|
||||
// file.close();
|
||||
|
||||
// file.open("GenStatistics.pop_A.txt");
|
||||
// DerevyankoReport::pop_A->putGeneticSimpleStatisticsToStream(file);
|
||||
// file.close();
|
||||
|
||||
// ////////////////////////////////////////
|
||||
// file.open("GenStatistics.pop_B.fasta");
|
||||
// DerevyankoReport::pop_B->putGeneticStatisticsToStream(file);
|
||||
// file.close();
|
||||
|
||||
// file.open("GenStatistics.pop_B.txt");
|
||||
// DerevyankoReport::pop_B->putGeneticSimpleStatisticsToStream(file);
|
||||
// file.close();
|
||||
// ////////////////////////////////////////
|
||||
|
||||
// ////////////////////////////////////////
|
||||
// file.open("GenStatistics.pop_C.fasta");
|
||||
// DerevyankoReport::pop_C->putGeneticStatisticsToStream(file);
|
||||
// file.close();
|
||||
|
||||
// file.open("GenStatistics.pop_C.txt");
|
||||
// DerevyankoReport::pop_C->putGeneticSimpleStatisticsToStream(file);
|
||||
// file.close();
|
||||
// ////////////////////////////////////////
|
||||
|
||||
// ////////////////////////////////////////
|
||||
// file.open("GenStatistics.pop_D.fasta");
|
||||
// DerevyankoReport::pop_D->putGeneticStatisticsToStream(file);
|
||||
// file.close();
|
||||
|
||||
// file.open("GenStatistics.pop_D.txt");
|
||||
// DerevyankoReport::pop_D->putGeneticSimpleStatisticsToStream(file);
|
||||
// file.close();
|
||||
// ////////////////////////////////////////
|
||||
|
||||
// ////////////////////////////////////////
|
||||
// file.open("GenStatistics.pop_E.fasta");
|
||||
// DerevyankoReport::pop_E->putGeneticStatisticsToStream(file);
|
||||
// file.close();
|
||||
|
||||
// file.open("GenStatistics.pop_E.txt");
|
||||
// DerevyankoReport::pop_E->putGeneticSimpleStatisticsToStream(file);
|
||||
// file.close();
|
||||
// ////////////////////////////////////////
|
||||
|
||||
// ////////////////////////////////////////
|
||||
// file.open("GenStatistics.pop_F.fasta");
|
||||
// DerevyankoReport::pop_F->putGeneticStatisticsToStream(file);
|
||||
// file.close();
|
||||
|
||||
// file.open("GenStatistics.pop_F.txt");
|
||||
// DerevyankoReport::pop_F->putGeneticSimpleStatisticsToStream(file);
|
||||
// file.close();
|
||||
// ////////////////////////////////////////
|
||||
|
||||
// ////////////////////////////////////////
|
||||
// file.open("GenStatistics.pop_G.fasta");
|
||||
// DerevyankoReport::pop_G->putGeneticStatisticsToStream(file);
|
||||
// file.close();
|
||||
|
||||
// file.open("GenStatistics.pop_G.txt");
|
||||
// DerevyankoReport::pop_G->putGeneticSimpleStatisticsToStream(file);
|
||||
// file.close();
|
||||
// ////////////////////////////////////////
|
||||
|
||||
// ////////////////////////////////////////
|
||||
// file.open("GenStatistics.pop_flittle.fasta");
|
||||
// DerevyankoReport::pop_f->putGeneticStatisticsToStream(file);
|
||||
// file.close();
|
||||
|
||||
// file.open("GenStatistics.pop_flittle.txt");
|
||||
// DerevyankoReport::pop_f->putGeneticSimpleStatisticsToStream(file);
|
||||
// file.close();
|
||||
// ////////////////////////////////////////
|
||||
}
|
||||
85
DEC_GUI/DEC-0.0/DerevyankoReport.h
Normal file
85
DEC_GUI/DEC-0.0/DerevyankoReport.h
Normal file
@@ -0,0 +1,85 @@
|
||||
#pragma once
|
||||
#include "population/Population.h"
|
||||
#include <QVector>
|
||||
#include <QString>
|
||||
|
||||
class DerevyankoReport{
|
||||
public:
|
||||
static void reportRFBR2013_01();
|
||||
static BisexualPopulation* populationFactory(int size, std::string initMtGenome);
|
||||
static void separatePop(QString popName, double founder, int sepPopInd);
|
||||
static void evolution(int evol_time);
|
||||
|
||||
static std::string initMtDNA;
|
||||
static std::string initMtDNA_G;
|
||||
static std::vector<std::string> initMtDNAgui;
|
||||
static std::vector<std::string> initMtDNA_Ggui;
|
||||
static int basePopSize;
|
||||
static float initBirthRate;
|
||||
static float deltaBirthRate;
|
||||
static BisexualPopulation* pop_f;
|
||||
static BisexualPopulation* pop_G;
|
||||
static BisexualPopulation* pop_e;
|
||||
static BisexualPopulation* pop_F;
|
||||
static BisexualPopulation* pop_d;
|
||||
static BisexualPopulation* pop_E;
|
||||
static BisexualPopulation* pop_c;
|
||||
static BisexualPopulation* pop_D;
|
||||
static BisexualPopulation* pop_b;
|
||||
static BisexualPopulation* pop_a;
|
||||
static BisexualPopulation* pop_A;
|
||||
static BisexualPopulation* pop_B;
|
||||
static BisexualPopulation* pop_C;
|
||||
|
||||
static int genPerMigr_f_G;
|
||||
static float part_f_to_G;
|
||||
static float part_G_to_f;
|
||||
|
||||
static int genPerMigr_A_B;
|
||||
static int genPerMigr_A_C;
|
||||
static int genPerMigr_A_D;
|
||||
static int genPerMigr_A_E;
|
||||
static int genPerMigr_A_F;
|
||||
|
||||
static float part_A_to_B;
|
||||
static float part_B_to_A;
|
||||
static float part_A_to_C;
|
||||
static float part_A_to_D;
|
||||
static float part_A_to_E;
|
||||
static float part_A_to_F;
|
||||
|
||||
static float fraction_e_founder;
|
||||
static float fraction_F_founder;
|
||||
static float fraction_E_founder;
|
||||
static float fraction_D_founder;
|
||||
static float fraction_C_founder;
|
||||
static float fraction_B_founder;
|
||||
|
||||
|
||||
static QVector<double> popSize_f;
|
||||
static QVector<double> popSize_G;
|
||||
static QVector<double> popSize_e;
|
||||
static QVector<double> popSize_F;
|
||||
static QVector<double> popSize_d;
|
||||
static QVector<double> popSize_E;
|
||||
static QVector<double> popSize_c;
|
||||
static QVector<double> popSize_D;
|
||||
static QVector<double> popSize_b;
|
||||
static QVector<double> popSize_a;
|
||||
static QVector<double> popSize_A;
|
||||
static QVector<double> popSize_B;
|
||||
static QVector<double> popSize_C;
|
||||
|
||||
static QVector<BisexualPopulation*> pops;
|
||||
static QVector<QString> populNames;
|
||||
//static QVector<int> globalGenerations;
|
||||
static int globalGenerations;
|
||||
static QVector<int> maxYval;
|
||||
static QVector< QVector<double> > popSizes;
|
||||
static QVector< QVector<double> > generations;
|
||||
|
||||
static void initVectors();
|
||||
static void fillVectors(BisexualPopulation* pop, int popNum);
|
||||
|
||||
|
||||
};
|
||||
414
DEC_GUI/DEC-0.0/DerevyankoReport2014.cpp
Normal file
414
DEC_GUI/DEC-0.0/DerevyankoReport2014.cpp
Normal file
@@ -0,0 +1,414 @@
|
||||
#include "DerevyankoReport2014.h"
|
||||
#include "individual/Trait.h"
|
||||
#include "individual/Phenotype.h"
|
||||
//#include "population/BreedingStrategies/PopulationBreedingStrategy.h"
|
||||
#include "population/BreedingStrategies/NeutralEvolutionBreedStrat.h"
|
||||
#include "processor/Settings.h"
|
||||
|
||||
#include <list>
|
||||
#include <fstream>
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <cstdlib>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <QTime>
|
||||
|
||||
#define sscanf_s sscanf
|
||||
|
||||
using std::string;
|
||||
|
||||
BisexualPopulation* DerevyankoReport2014::pop_Sapiens;
|
||||
BisexualPopulation* DerevyankoReport2014::pop_Ancient;
|
||||
|
||||
|
||||
std::string DerevyankoReport2014::getInitGene(int type, int num){
|
||||
|
||||
|
||||
string seq, initSeq = "";
|
||||
//srand((unsigned int)time(NULL));
|
||||
//QTime time = QTime::currentTime();
|
||||
//qsrand((uint)time.msec());
|
||||
QTime midnight(0, 0, 0);
|
||||
qsrand(midnight.secsTo(QTime::currentTime()));
|
||||
for(unsigned int i = 0; i < Settings::locusLength; i++){
|
||||
//int nucl = rand()%4;
|
||||
int nucl = qrand() % 4;
|
||||
if(nucl == 0){initSeq += 'A';}
|
||||
else if(nucl == 1){initSeq += 'T';}
|
||||
else if(nucl == 2){initSeq += 'G';}
|
||||
else if(nucl == 3){initSeq += 'C';}
|
||||
}
|
||||
//initSeq = "TTCTTTCATGGGGAAGCAGATTTGGGTACCACCCAAGTATTGACTCACCCATCAACAACC";
|
||||
//std::cout << initSeq << std::endl;
|
||||
if(type == 0){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD>")
|
||||
seq = initSeq;
|
||||
}
|
||||
else{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
seq = initSeq;
|
||||
seq.replace(10,1,"T");
|
||||
seq.replace(20,1,"A");
|
||||
seq.replace(30,1,"C");
|
||||
seq.replace(40,1,"G");
|
||||
seq.replace(50,1,"G");
|
||||
}
|
||||
|
||||
return seq;
|
||||
}
|
||||
|
||||
BisexualPopulation* DerevyankoReport2014::populationFactory(int size, const std::vector<std::string>& genome){
|
||||
BisexualPopulation* ans;
|
||||
|
||||
std::list<Individual*> males;
|
||||
std::list<Individual*> females;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Chromosome chrom1("Mitochondrial chromosome");
|
||||
for(unsigned int i = 0; i < genome.size(); i++){
|
||||
string gName = "mtDna_" + boost::lexical_cast<std::string>(i+1);
|
||||
Gene gene(Gene::Sequence, gName, genome.at(i));
|
||||
chrom1.insertGeneToEnd(gene);
|
||||
}
|
||||
|
||||
std::vector<Chromosome> fGenome;
|
||||
std::vector<Chromosome> mGenome;
|
||||
fGenome.push_back(chrom1);
|
||||
mGenome.push_back(chrom1);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Trait trait1(Trait::Discrete, "Age", 20);
|
||||
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
InnerSubstratesPool* subPool = 0;
|
||||
// (END) <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
for(int i = 0; i < size/2; i++){
|
||||
Genotype* genotype = new Genotype(fGenome, mGenome);
|
||||
Phenotype* phenotype = new Phenotype(trait1);
|
||||
males.push_back(new Individual(genotype, phenotype, subPool, Individual::male, 0));
|
||||
|
||||
genotype = new Genotype(fGenome, mGenome);
|
||||
phenotype = new Phenotype(trait1);
|
||||
females.push_back(new Individual(genotype, phenotype, subPool, Individual::female, 0));
|
||||
}
|
||||
|
||||
ans = new BisexualPopulation(males,females);
|
||||
return ans;
|
||||
}
|
||||
|
||||
void DerevyankoReport2014::evolution(int iter)
|
||||
{
|
||||
for(unsigned int i = 0; i < iter; i++)
|
||||
{
|
||||
pop_Sapiens->breedAll();
|
||||
pop_Sapiens->mutationAll();
|
||||
pop_Ancient->breedAll();
|
||||
pop_Ancient->mutationAll();
|
||||
Settings::fillVectors(pop_Sapiens, pop_Ancient);
|
||||
}
|
||||
}
|
||||
|
||||
void DerevyankoReport2014::evolution_migr(int iter)
|
||||
{
|
||||
for(unsigned int i = 0; i < iter; i++){
|
||||
|
||||
pop_Sapiens->breedAll();
|
||||
pop_Sapiens->mutationAll();
|
||||
|
||||
pop_Ancient->breedAll();
|
||||
pop_Ancient->mutationAll();
|
||||
|
||||
|
||||
|
||||
if(i != 0 && ((i % Settings::generationsPerMigration) == 0)){
|
||||
std::string code = BisexualPopulation::mutualMigration(pop_Sapiens, pop_Ancient,
|
||||
Settings::migrationPartHomoToAncient, Settings::migrationPartAncientToHomo);
|
||||
//std::cout<<"Migration Sapienti<->Ancient\t"<<code<<"\tIter\t"<<generation<<std::endl;
|
||||
}
|
||||
Settings::fillVectors(pop_Sapiens, pop_Ancient);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void DerevyankoReport2014::migration()
|
||||
{
|
||||
std::string code = BisexualPopulation::mutualMigration(pop_Sapiens, pop_Ancient,
|
||||
Settings::migrationPartHomoToAncient, Settings::migrationPartAncientToHomo);
|
||||
Settings::fillVectors(pop_Sapiens, pop_Ancient);
|
||||
}
|
||||
|
||||
void DerevyankoReport2014::report2014_01(/*int argc, char** argv*/){
|
||||
//std::vector<std::string> calcScript;
|
||||
|
||||
// if(argc > 1){
|
||||
// calcScript = parseScript(argv[1]);
|
||||
// }
|
||||
// else{
|
||||
//calcScript = parseScript("script.txt");
|
||||
// }
|
||||
// calcScript = parseScript("script.txt");
|
||||
// //std::cout << "report2014" << std::endl;
|
||||
Settings::initGUIvect();
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// int numLoci = Settings::numLoci;
|
||||
// std::vector<string> initMtDNA(numLoci);
|
||||
// std::vector<string> initMtDNA_ancient(numLoci);
|
||||
// for(unsigned int i = 0; i < initMtDNA.size(); i++){
|
||||
// initMtDNA.at(i) = getInitGene(0,i);
|
||||
// if(i<= numLoci*Settings::percentDiffLoci){
|
||||
// string seq = initMtDNA.at(i);
|
||||
// for(int j = 0; j < 5; j++){
|
||||
// int pos = (int)(j/5.*Settings::locusLength);
|
||||
// if(seq.at(pos)=='T')
|
||||
// seq.replace(pos,1,"G");
|
||||
// else
|
||||
// seq.replace(pos,1,"T");
|
||||
// }
|
||||
// initMtDNA_ancient.at(i) = seq;
|
||||
// }
|
||||
// else{
|
||||
// initMtDNA_ancient.at(i) = initMtDNA.at(i);
|
||||
// }
|
||||
// }
|
||||
|
||||
int popSizeH = Settings::PopulationHomoInitSize;
|
||||
int popSizeA = Settings::PopulationAncientInitSize;
|
||||
float initBirthRate = Settings::BirthRate;
|
||||
float deathRate = Settings::NaturalDeathRate;
|
||||
|
||||
|
||||
|
||||
pop_Sapiens = populationFactory(popSizeH, Settings::initMtDNA);
|
||||
NeutralEvolutionBreedingStrategy* breedStrat_Sapiens =
|
||||
dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
breedStrat_Sapiens->setBirthRate(initBirthRate);
|
||||
breedStrat_Sapiens->setDeathRate(deathRate);
|
||||
pop_Sapiens->setBreedingStrategy(breedStrat_Sapiens);
|
||||
|
||||
pop_Ancient = populationFactory(popSizeA, Settings::initMtDNA_ancient);
|
||||
NeutralEvolutionBreedingStrategy* breedStrat_Ancient =
|
||||
dynamic_cast<NeutralEvolutionBreedingStrategy*>(PopulationBreedingStrategy::getInstance("neutral"));
|
||||
breedStrat_Ancient->setBirthRate(initBirthRate);
|
||||
breedStrat_Ancient->setDeathRate(deathRate);
|
||||
pop_Ancient->setBreedingStrategy(breedStrat_Ancient);
|
||||
|
||||
///////////////////////////////////////////
|
||||
//
|
||||
// <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//
|
||||
///////////////////////////////////////////
|
||||
//Settings::ProbMtDNARecomb = 1e-4;
|
||||
|
||||
// <20><><EFBFBD> 1.
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1
|
||||
int genPerMigr_H_A = Settings::generationsPerMigration;
|
||||
float part_H_to_A = Settings::migrationPartHomoToAncient;
|
||||
float part_A_to_H = Settings::migrationPartAncientToHomo;
|
||||
|
||||
unsigned int generation = 0;
|
||||
for(unsigned int curLine = 0; curLine < Settings::calcScript.size(); curLine++){
|
||||
if(Settings::calcScript.at(curLine).at(0) == '/' || Settings::calcScript.at(curLine).at(0) == '#')
|
||||
continue;
|
||||
|
||||
std::vector<std::string > tokensVector; // Search for tokens
|
||||
boost::split(tokensVector, Settings::calcScript.at(curLine), boost::is_any_of("=") );
|
||||
std::string instr = tokensVector.at(0);
|
||||
boost::to_lower(instr);
|
||||
boost::trim(instr);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
if(instr == "evolution"){
|
||||
int iter = 0;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%d", &iter);
|
||||
for(unsigned int i = 0; i < iter; i++, generation++){
|
||||
std::cout<<"gen\t"<<generation<<std::endl;
|
||||
pop_Sapiens->breedAll();
|
||||
pop_Sapiens->mutationAll();
|
||||
|
||||
pop_Ancient->breedAll();
|
||||
pop_Ancient->mutationAll();
|
||||
Settings::fillVectors(pop_Sapiens, pop_Ancient);
|
||||
std::cout << pop_Ancient->females.size() + pop_Ancient->males.size() << " evol_size " <<std::endl;
|
||||
std::cout << pop_Sapiens->females.size() + pop_Sapiens->males.size() << " evol_size " <<std::endl;
|
||||
}
|
||||
}
|
||||
else if(instr == "evolution_m"){
|
||||
int iter = 0;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%d", &iter);
|
||||
for(unsigned int i = 0; i < iter; i++, generation++){
|
||||
std::cout<<"gen\t"<<generation<<std::endl;
|
||||
pop_Sapiens->breedAll();
|
||||
pop_Sapiens->mutationAll();
|
||||
|
||||
pop_Ancient->breedAll();
|
||||
pop_Ancient->mutationAll();
|
||||
|
||||
Settings::fillVectors(pop_Sapiens, pop_Ancient);
|
||||
std::cout << pop_Ancient->females.size() + pop_Ancient->males.size() << " evol/migr_size " <<std::endl;
|
||||
if(i != 0 && ((i % genPerMigr_H_A) == 0)){
|
||||
std::string code = BisexualPopulation::mutualMigration(pop_Sapiens, pop_Ancient, part_H_to_A, part_A_to_H);
|
||||
std::cout<<"Migration Sapienti<->Ancient\t"<<code<<"\tIter\t"<<generation<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(instr == "migration"){
|
||||
double part_H_to_A = 0.0;
|
||||
double part_A_to_H = 0.0;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%lg %lg", &part_H_to_A, &part_A_to_H);
|
||||
std::string code = BisexualPopulation::mutualMigration(pop_Sapiens, pop_Ancient, part_H_to_A, part_A_to_H);
|
||||
Settings::fillVectors(pop_Sapiens, pop_Ancient);
|
||||
std::cout<<"Migration Sapienti<->Ancient\t"<<code<<"\tIter\t"<<generation<<std::endl;
|
||||
}
|
||||
} // (END)for(unsigned int curLine = 0; curLine < calcScript.size(); curLine++)
|
||||
|
||||
|
||||
/* for(generation = 0; generation < 5000; generation++){
|
||||
std::cout<<"gen\t"<<generation<<std::endl;
|
||||
pop_Sapiens->breedAll();
|
||||
pop_Sapiens->mutationAll();
|
||||
|
||||
pop_Ancient->breedAll();
|
||||
pop_Ancient->mutationAll();
|
||||
|
||||
if(generation != 0 && ((generation % genPerMigr_H_A) == 0)){
|
||||
std::string code = BisexualPopulation::mutualMigration(pop_Sapiens, pop_Ancient, part_H_to_A, part_A_to_H);
|
||||
std::cout<<"Migration Sapienti<->Ancient\t"<<code<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::ofstream file("GenStatistics.pop_Sapiens.fasta");
|
||||
pop_Sapiens->putGeneticStatisticsToStream(file);
|
||||
file.close();
|
||||
|
||||
file.open("GenStatistics.pop_Sapiens.txt");
|
||||
pop_Sapiens->putGeneticSimpleStatisticsToStream(file);
|
||||
file.close();
|
||||
|
||||
////////////////////////////////////////
|
||||
file.open("GenStatistics.pop_Ancient.fasta");
|
||||
pop_Ancient->putGeneticStatisticsToStream(file);
|
||||
file.close();
|
||||
|
||||
file.open("GenStatistics.pop_Ancient.txt");
|
||||
pop_Ancient->putGeneticSimpleStatisticsToStream(file);
|
||||
file.close();
|
||||
////////////////////////////////////////
|
||||
|
||||
}
|
||||
|
||||
std::vector<std::string> DerevyankoReport2014::parseScript(std::string fileName){
|
||||
std::vector<std::string> script;
|
||||
std::ifstream file(fileName.c_str());
|
||||
std::string str;
|
||||
|
||||
if (!file.is_open())
|
||||
{
|
||||
std::cout << "Can't open file!" << std::endl;
|
||||
}
|
||||
|
||||
while(getline(file,str)){
|
||||
if(str.length() > 2)
|
||||
script.push_back(str);
|
||||
}
|
||||
file.close();
|
||||
|
||||
// process Script
|
||||
unsigned int curLine;
|
||||
for(curLine = 0; curLine < script.size(); curLine++){
|
||||
if(script.at(curLine).at(0) == '/' || script.at(curLine).at(0) == '#')
|
||||
continue;
|
||||
|
||||
std::vector<std::string > tokensVector; // Search for tokens
|
||||
boost::split(tokensVector, script.at(curLine), boost::is_any_of("=") );
|
||||
|
||||
std::string instr = tokensVector.at(0);
|
||||
boost::to_lower(instr);
|
||||
boost::trim(instr);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
if(instr == "model_start"){
|
||||
vector<std::string>::const_iterator first = script.begin() + curLine;
|
||||
vector<std::string>::const_iterator last = script.end();
|
||||
std::vector<std::string> ans(first, last);
|
||||
return ans;
|
||||
}
|
||||
else if(instr == "pop_homo_init"){
|
||||
int flag = 0;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%d", &flag);
|
||||
if(flag != 0)
|
||||
Settings::PopulationHomoInitSize = flag;
|
||||
}
|
||||
else if(instr == "pop_ancient_init"){
|
||||
int flag = 0;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%d", &flag);
|
||||
if(flag != 0)
|
||||
Settings::PopulationAncientInitSize = flag;
|
||||
}
|
||||
else if(instr == "generations_per_migration"){
|
||||
int flag = Settings::generationsPerMigration;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%d", &flag);
|
||||
if(flag != 0)
|
||||
Settings::generationsPerMigration = flag;
|
||||
}
|
||||
else if(instr == "migr_homo_ancient_ratio"){
|
||||
double ratio = Settings::migrationPartHomoToAncient;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%lg", &ratio);
|
||||
Settings::migrationPartHomoToAncient = ratio;
|
||||
}
|
||||
else if(instr == "migr_ancient_homo_ratio"){
|
||||
double ratio = Settings::migrationPartAncientToHomo;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%lg", &ratio);
|
||||
Settings::migrationPartAncientToHomo = ratio;
|
||||
}
|
||||
else if(instr == "birth" || instr == "birthrate" || instr == "birth_rate" ){
|
||||
double rate = Settings::BirthRate;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%lg", &rate);
|
||||
Settings::BirthRate = rate;
|
||||
}
|
||||
else if(instr == "death" || instr == "deathrate" || instr == "death_rate" ){
|
||||
double rate = Settings::NaturalDeathRate;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%lg", &rate);
|
||||
Settings::NaturalDeathRate = rate;
|
||||
}
|
||||
else if(instr == "percent_diff_loci" ){
|
||||
double value = Settings::percentDiffLoci;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%lg", &value);
|
||||
Settings::percentDiffLoci = value;
|
||||
}
|
||||
else if(instr == "num_loci"){
|
||||
int flag = 0;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%d", &flag);
|
||||
if(flag != 0)
|
||||
Settings::numLoci = flag;
|
||||
}
|
||||
else if(instr == "prob_recomb" ){
|
||||
double value = Settings::ProbMtDNARecomb;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%lg", &value);
|
||||
Settings::ProbMtDNARecomb = value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//*****************************
|
||||
else if(instr == "breedings"){
|
||||
//long int kMax = Settings::KMaxParameter;
|
||||
//sscanf_s(tokensVector.at(1).c_str(),"%ld", &kMax);
|
||||
std::string strategy = tokensVector.at(1);
|
||||
boost::to_lower(strategy);
|
||||
boost::trim(strategy);
|
||||
Settings::BreedingStrategy = strategy;
|
||||
}
|
||||
} // (END) for(curLine = 0; curLine < script.size(); curLine++)
|
||||
std::vector<std::string> a;
|
||||
return a;
|
||||
}
|
||||
|
||||
//void DerevyankoReport2014::parseCalc(std::vector<std::string> script){
|
||||
//
|
||||
//}
|
||||
22
DEC_GUI/DEC-0.0/DerevyankoReport2014.h
Normal file
22
DEC_GUI/DEC-0.0/DerevyankoReport2014.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "population/Population.h"
|
||||
#include <derrep2014window.h>
|
||||
#include <QWidget>
|
||||
|
||||
class DerevyankoReport2014
|
||||
{
|
||||
|
||||
public:
|
||||
static void report2014_01(/*int argc, char** argv*/);
|
||||
static std::string getInitGene(int type = 0, int num = 0);
|
||||
static BisexualPopulation* populationFactory(int size, const std::vector<std::string>& genome);
|
||||
static std::vector<std::string> parseScript(std::string fileName);
|
||||
//static void parseCalc(std::vector<std::string> script);
|
||||
static BisexualPopulation* pop_Sapiens;
|
||||
static BisexualPopulation* pop_Ancient;
|
||||
static void evolution(int iter);
|
||||
static void evolution_migr(int iter);
|
||||
static void migration();
|
||||
|
||||
};
|
||||
7
DEC_GUI/DEC-0.0/ToDoList.txt
Normal file
7
DEC_GUI/DEC-0.0/ToDoList.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" <20> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>").
|
||||
|
||||
2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>.
|
||||
|
||||
3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>.<2E>.).
|
||||
10
DEC_GUI/DEC-0.0/environment/AbstractEnvironment.h
Normal file
10
DEC_GUI/DEC-0.0/environment/AbstractEnvironment.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "AbstractRegion.h"
|
||||
#include <vector>
|
||||
|
||||
class Environment {
|
||||
protected:
|
||||
std::vector<Region> regions;
|
||||
public:
|
||||
|
||||
};
|
||||
40
DEC_GUI/DEC-0.0/environment/AbstractRegion.h
Normal file
40
DEC_GUI/DEC-0.0/environment/AbstractRegion.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
template<class T>
|
||||
class Position3D {
|
||||
public:
|
||||
T xOrigin;
|
||||
T yOrigin;
|
||||
T zOrigin;
|
||||
T length;
|
||||
T width;
|
||||
T height;
|
||||
//Position3D(T x0, T y0, T z0, T len, T wid, T hei):
|
||||
Position3D(T x0, T y0, T z0, T len, T wid, T heigh):
|
||||
xOrigin(x0), yOrigin(y0), zOrigin(z0),
|
||||
length(len), width(wid), height(heigh){};
|
||||
};
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
using std::vector;
|
||||
class Region {
|
||||
protected:
|
||||
long int capacity; // map<SpeciesID, long int> capacities
|
||||
std::vector<long int> currentSubstrates; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<long int> restorationSubstrates; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<long int> maxSubstrates; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<double> regulators; // temperature, humidity etc
|
||||
|
||||
/////////////////////
|
||||
Position3D<double> position3D;
|
||||
|
||||
public:
|
||||
Region(Position3D<double> pos, long int capac);
|
||||
Region(Position3D<double> pos, long int capac,
|
||||
const vector<long int>&, const vector<long int>&,
|
||||
const vector<long int>&, const vector<double>&);
|
||||
void restoreSubstrate();
|
||||
long int getCapacity() const { return this->capacity;}
|
||||
};
|
||||
2
DEC_GUI/DEC-0.0/environment/Environment.cpp
Normal file
2
DEC_GUI/DEC-0.0/environment/Environment.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "AbstractEnvironment.h"
|
||||
|
||||
39
DEC_GUI/DEC-0.0/environment/Region.cpp
Normal file
39
DEC_GUI/DEC-0.0/environment/Region.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "AbstractRegion.h"
|
||||
#include <iostream>
|
||||
|
||||
//template<class T>
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
Region::Region(Position3D<double> pos, long capac):
|
||||
position3D(pos), capacity(capac)
|
||||
{}
|
||||
|
||||
Region::Region(Position3D<double> pos, long capac,
|
||||
const std::vector<long int> & curS, const std::vector<long int> & restS,
|
||||
const std::vector<long int> & maxS, const std::vector<double> & regS):
|
||||
position3D(pos), capacity(capac),
|
||||
currentSubstrates(curS), restorationSubstrates(restS),
|
||||
maxSubstrates(maxS), regulators(regS)
|
||||
{
|
||||
if(currentSubstrates.size() != restorationSubstrates.size()){
|
||||
std::cerr<<"Warning! currentSubstrates size != restorationSubstrates size\n";
|
||||
}
|
||||
if(currentSubstrates.size() != maxSubstrates.size()){
|
||||
std::cerr<<"Warning! currentSubstrates size != maximumSubstrates size\n";
|
||||
}
|
||||
if(restorationSubstrates.size() != maxSubstrates.size()){
|
||||
std::cerr<<"Warning! restorationSubstrates size != maximumSubstrates size\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
**/
|
||||
void Region::restoreSubstrate(){
|
||||
for(unsigned int i = 0; i < this->currentSubstrates.size(); i++){
|
||||
this->currentSubstrates.at(i) = std::max(
|
||||
this->currentSubstrates.at(i) + this->restorationSubstrates.at(i),
|
||||
this->maxSubstrates.at(i));
|
||||
}
|
||||
}
|
||||
1480
DEC_GUI/DEC-0.0/generation.0.xls
Normal file
1480
DEC_GUI/DEC-0.0/generation.0.xls
Normal file
File diff suppressed because it is too large
Load Diff
2002
DEC_GUI/DEC-0.0/generation.1.xls
Normal file
2002
DEC_GUI/DEC-0.0/generation.1.xls
Normal file
File diff suppressed because it is too large
Load Diff
2002
DEC_GUI/DEC-0.0/generation.2.xls
Normal file
2002
DEC_GUI/DEC-0.0/generation.2.xls
Normal file
File diff suppressed because it is too large
Load Diff
2002
DEC_GUI/DEC-0.0/generation.3.xls
Normal file
2002
DEC_GUI/DEC-0.0/generation.3.xls
Normal file
File diff suppressed because it is too large
Load Diff
2002
DEC_GUI/DEC-0.0/generation.4.xls
Normal file
2002
DEC_GUI/DEC-0.0/generation.4.xls
Normal file
File diff suppressed because it is too large
Load Diff
59
DEC_GUI/DEC-0.0/individual/AbstractIndividual.h
Normal file
59
DEC_GUI/DEC-0.0/individual/AbstractIndividual.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
/*
|
||||
|
||||
|
||||
*/
|
||||
#include "../environment/AbstractEnvironment.h"
|
||||
#include "genome/AbstractGenome.h"
|
||||
#include "InnerSubstratesPool.h"
|
||||
#include "genome/strategies/PhenotypeToFitnessStrategy.h"
|
||||
class Phenotype;
|
||||
class GenotypeToPhenotypeStrategy;
|
||||
class Individual {
|
||||
public:
|
||||
enum Gender { male, female, hermaphrodite };
|
||||
friend class GenotypeToPhenotypeStrategy;
|
||||
friend class InOutBreedingGenotypeToPhenotypeStrategy;
|
||||
friend class KolchShindyalGenotypeToPhenotypeStrategy;
|
||||
friend class BisexualPopulation; // <20> <20><><EFBFBD><EFBFBD> <20><> MutationStrategy !!!
|
||||
protected:
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
GenotypeToPhenotypeStrategy* genToPhenStrategy;
|
||||
PhenotypeToFitnessStrategy* phenToFitStrategy;
|
||||
ChromosomeRearrangementStrategy* recombinationStrategy;
|
||||
|
||||
////
|
||||
//Environment* currentEnvironment;
|
||||
Region* region;
|
||||
|
||||
unsigned int age;
|
||||
Gender gender;
|
||||
Genotype* genotype;
|
||||
|
||||
InnerSubstratesPool* substrateCache ; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
Phenotype* phenotype;
|
||||
|
||||
double fitness;
|
||||
|
||||
/////////////////
|
||||
public:
|
||||
Individual(const Individual& father, const Individual& mother); // <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Individual(Genotype* gType, Phenotype* pType, InnerSubstratesPool* sub, Gender _gender = hermaphrodite, Region* reg = 0);
|
||||
virtual ~Individual();
|
||||
virtual const Genotype& getGenotype() const { return *genotype;}
|
||||
virtual const Phenotype& getPhenotype() const {return *phenotype;}
|
||||
//virtual void setEnvironment(Environment* env) { currentEnvironment = env; }
|
||||
virtual void setRegion(Region* _region) {};
|
||||
virtual void setGenToPhenStrategy(GenotypeToPhenotypeStrategy* s){ genToPhenStrategy = s;}
|
||||
virtual void setPhenToFitnessStrategy(PhenotypeToFitnessStrategy* p) { if(phenToFitStrategy != 0) {delete phenToFitStrategy;} phenToFitStrategy = p;}
|
||||
virtual void calculateFitness();
|
||||
virtual void calculatePhenotype();
|
||||
virtual double getFitness() const { return fitness; }
|
||||
|
||||
Gender getGender() const { return gender; }
|
||||
virtual bool operator<(const Individual* _ind) const { return this->fitness < _ind->fitness;}
|
||||
};
|
||||
|
||||
//bool compareOnFitness(const Individual& a, const Individual& b);
|
||||
bool compareOnFitness(const Individual* a, const Individual* b);
|
||||
68
DEC_GUI/DEC-0.0/individual/Individual.cpp
Normal file
68
DEC_GUI/DEC-0.0/individual/Individual.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
#include "AbstractIndividual.h"
|
||||
#include "genome/strategies/GenotypeToPhenotypeStrategy.h"
|
||||
#include <iostream>
|
||||
|
||||
Individual::Individual(const Individual& father, const Individual& mother)
|
||||
{
|
||||
this->genToPhenStrategy = GenotypeToPhenotypeStrategies::getInstance("inoutbreeding");
|
||||
this->phenToFitStrategy = PhenotypeToFitnessStrategy::getInstance("inoutbreeding");
|
||||
this->recombinationStrategy = RecombinationStrategies::getInstance("Simple recombination");
|
||||
|
||||
genotype = new Genotype(
|
||||
father.getGenotype().recombinantHaploidGenotype(recombinationStrategy),
|
||||
mother.getGenotype().recombinantHaploidGenotype(recombinationStrategy));
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
this->substrateCache = new InnerSubstratesPool();
|
||||
|
||||
phenotype= new Phenotype(father.getPhenotype());
|
||||
this->age = 0;
|
||||
this->calculateFitness();
|
||||
|
||||
}
|
||||
|
||||
Individual::Individual(Genotype* gType, Phenotype* pType, InnerSubstratesPool* sub, Gender _gender, Region* _reg):
|
||||
genotype(gType), phenotype(pType), substrateCache(sub),
|
||||
gender(_gender), region(_reg)
|
||||
{
|
||||
this->genToPhenStrategy = GenotypeToPhenotypeStrategies::getInstance("inoutbreeding");
|
||||
this->phenToFitStrategy = PhenotypeToFitnessStrategy::getInstance("inoutbreeding");
|
||||
this->recombinationStrategy = RecombinationStrategies::getInstance("Simple recombination");
|
||||
|
||||
this->age = 0;
|
||||
|
||||
//this->calculateFitness();
|
||||
//this->phenotype
|
||||
}
|
||||
|
||||
|
||||
Individual::~Individual(){
|
||||
// std::cerr<<"Destructor works"<<std::endl;
|
||||
delete this->genotype;
|
||||
delete this->phenotype;
|
||||
|
||||
delete this->genToPhenStrategy;
|
||||
delete this->phenToFitStrategy;
|
||||
delete this->recombinationStrategy;
|
||||
|
||||
if(this->substrateCache != 0)
|
||||
delete this->substrateCache;
|
||||
}
|
||||
|
||||
/*bool compareOnFitness(const Individual& a, const Individual& b){
|
||||
return a.getFitness() < b.getFitness();
|
||||
}*/
|
||||
|
||||
bool compareOnFitness(const Individual* a, const Individual* b){
|
||||
return a->getFitness() < b->getFitness();
|
||||
}
|
||||
|
||||
void Individual::calculateFitness(){
|
||||
this->genToPhenStrategy->calculatePhenotype(this);
|
||||
this->fitness = this->phenToFitStrategy->calculateFitness(this->phenotype);
|
||||
}
|
||||
|
||||
void Individual::calculatePhenotype(){
|
||||
this->genToPhenStrategy->calculatePhenotype(this);
|
||||
}
|
||||
1
DEC_GUI/DEC-0.0/individual/InnerSubstratesPool.cpp
Normal file
1
DEC_GUI/DEC-0.0/individual/InnerSubstratesPool.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "InnerSubstratesPool.h"
|
||||
40
DEC_GUI/DEC-0.0/individual/InnerSubstratesPool.h
Normal file
40
DEC_GUI/DEC-0.0/individual/InnerSubstratesPool.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
using std::vector;
|
||||
using std::map;
|
||||
|
||||
class InnerSubstratesPool {
|
||||
protected:
|
||||
std::vector<float> subConcentrations; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::map<std::string, int> subNamesMap; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
// P.S. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...
|
||||
|
||||
std::vector<float> regConcentrations; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::map<std::string, int> regNamesMap; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
|
||||
public:
|
||||
InnerSubstratesPool(){};
|
||||
InnerSubstratesPool(const vector<float>& _subs, const map<std::string, int>& _subNames)
|
||||
: subConcentrations(_subs), subNamesMap(_subNames){}
|
||||
|
||||
InnerSubstratesPool(const vector<float>& _subs, const map<std::string, int>& _subNames,
|
||||
const vector<float>& _regs, const map<std::string, int>& _regNames)
|
||||
: subConcentrations(_subs), subNamesMap(_subNames),
|
||||
regConcentrations(_regs), regNamesMap(_regNames){}
|
||||
|
||||
virtual void utilizeSubstrate(int num, float count) { subConcentrations.at(num) -= count; }
|
||||
virtual void utilizeRegulator(int num, float count) { regConcentrations.at(num) -= count; }
|
||||
|
||||
virtual void utilizeSubstrate(std::string name, float count) { subConcentrations.at(subNamesMap[name]) -= count; }
|
||||
virtual void utilizeRegulator(std::string name, float count) { subConcentrations.at(regNamesMap[name]) -= count; }
|
||||
|
||||
virtual void addSubstrate(int num, float count) { subConcentrations.at(num) += count; }
|
||||
virtual void addRegulator(int num, float count) { regConcentrations.at(num) += count; }
|
||||
|
||||
virtual void addSubstrate(std::string name, float count) { subConcentrations.at(subNamesMap[name]) += count; }
|
||||
virtual void addRegulator(std::string name, float count) { subConcentrations.at(regNamesMap[name]) += count; }
|
||||
|
||||
};
|
||||
38
DEC_GUI/DEC-0.0/individual/Phenotype.cpp
Normal file
38
DEC_GUI/DEC-0.0/individual/Phenotype.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "Phenotype.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
Phenotype::Phenotype(Trait _trait){
|
||||
this->traitsMap[_trait.getName()] = _trait;
|
||||
}
|
||||
|
||||
void Phenotype::addTrait(Trait _trait){
|
||||
std::map<std::string,Trait>::iterator it;
|
||||
it = this->traitsMap.find(_trait.getName());
|
||||
|
||||
if(it == this->traitsMap.end()){
|
||||
this->traitsMap[_trait.getName()] = _trait;
|
||||
}
|
||||
else{
|
||||
std::cerr<<"Phenotype.cpp(16): already has the trait: "<<it->first<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& operator << (std::ostream& os, const Phenotype& p){
|
||||
std::map<std::string,Trait>::const_iterator it;
|
||||
for(it = p.traitsMap.begin(); it != p.traitsMap.end(); it++){
|
||||
os<<(it->first)<<"\t"<<(it->second.getTraitValueCont())<<"\t";
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
std::string Phenotype::toSimpleString() const {
|
||||
std::stringstream os;
|
||||
std::map<std::string,Trait>::const_iterator it;
|
||||
for(it = this->traitsMap.begin(); it != this->traitsMap.end(); it++){
|
||||
os<<(it->second.getTraitValueCont())<<"\t";
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
26
DEC_GUI/DEC-0.0/individual/Phenotype.h
Normal file
26
DEC_GUI/DEC-0.0/individual/Phenotype.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "Trait.h"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
class Phenotype {
|
||||
friend class GenotypeToPhenotypeStrategy;
|
||||
friend class InOutBreedingGenotypeToPhenotypeStrategy;
|
||||
friend class KolchShindyalGenotypeToPhenotypeStrategy;
|
||||
friend class PhenotypeToFitnessStrategy;
|
||||
friend std::ostream& operator << (std::ostream& os, const Phenotype& p);
|
||||
protected:
|
||||
//std::vector<Trait> traits;
|
||||
std::map<std::string, Trait> traitsMap;
|
||||
public:
|
||||
Phenotype() { };
|
||||
Phenotype(const std::map<std::string, Trait>& _tm) : traitsMap(_tm) {}
|
||||
Phenotype(Trait _trait);
|
||||
|
||||
Trait getTraitByName(std::string name) const {return this->traitsMap.find(name)->second;};
|
||||
void addTrait(Trait _trait);
|
||||
std::string toSimpleString() const;
|
||||
};
|
||||
|
||||
31
DEC_GUI/DEC-0.0/individual/Trait.cpp
Normal file
31
DEC_GUI/DEC-0.0/individual/Trait.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "Trait.h"
|
||||
#include <iostream>
|
||||
|
||||
//Trait::Trait(const Trait& _t)
|
||||
//{
|
||||
// *this = _t;
|
||||
//}
|
||||
|
||||
Trait::Trait(Trait::idType _ID, std::string _name, float value):
|
||||
ID(_ID), name(_name), traitValueCont(value), traitType(Continious)
|
||||
{}
|
||||
|
||||
Trait::Trait(Trait::idType _ID, std::string _name, int value):
|
||||
ID(_ID), name(_name), traitValueDiscr(value), traitType(Discrete)
|
||||
{}
|
||||
|
||||
void Trait::setTraitValue(float _value){
|
||||
if(this->traitType == Continious){
|
||||
this->traitValueCont = _value;
|
||||
return;
|
||||
}
|
||||
/*throw*/std::cerr<<"Trait.cpp(17) Warning: can't assign float value to discrete trait\n";
|
||||
}
|
||||
|
||||
void Trait::setTraitValue(int _value){
|
||||
if(this->traitType == Discrete){
|
||||
this->traitValueDiscr = _value;
|
||||
return;
|
||||
}
|
||||
/*throw*/std::cerr<<"Trait.cpp(25) Warning: can't assign int value to continious trait\n";
|
||||
}
|
||||
32
DEC_GUI/DEC-0.0/individual/Trait.h
Normal file
32
DEC_GUI/DEC-0.0/individual/Trait.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class Trait {
|
||||
public:
|
||||
enum TraitType { Continious, Discrete };
|
||||
typedef unsigned int idType;
|
||||
|
||||
protected:
|
||||
TraitType traitType; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
idType ID; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::string name; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float traitValueCont; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int traitValueDiscr; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
public:
|
||||
Trait(){};
|
||||
Trait(idType _ID, std::string _name, float value);
|
||||
Trait(idType _ID, std::string _name, int value);
|
||||
|
||||
TraitType getTraitType() const { return traitType; }
|
||||
idType getID() const { return ID; }
|
||||
std::string getName() const { return name; }
|
||||
float getTraitValueCont() const { return traitValueCont; }
|
||||
int getTraitValueDiscr() const { return traitValueDiscr; }
|
||||
|
||||
void setName(const std::string& _name) { name = _name; }
|
||||
void setID(idType _ID) { ID = _ID; }
|
||||
void setTraitValue(float _value);
|
||||
void setTraitValue(int _value);
|
||||
};
|
||||
56
DEC_GUI/DEC-0.0/individual/genome/AbstractGenome.h
Normal file
56
DEC_GUI/DEC-0.0/individual/genome/AbstractGenome.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
#include "Chromosome.h"
|
||||
#include "strategies/ChromosomeRearrangementStrategy.h"
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
/*
|
||||
|
||||
*/
|
||||
class ChromosomeRearrangementStrategy; // forward declaration
|
||||
class Genotype;
|
||||
|
||||
class HaploidGenotype {
|
||||
friend class Genotype;
|
||||
friend class ChromosomeRearrangementStrategy;
|
||||
friend std::ostream& operator << (std::ostream& os, const Genotype& g);
|
||||
friend class Processor;
|
||||
protected:
|
||||
std::vector<Chromosome> chromosomes;
|
||||
|
||||
public:
|
||||
const Chromosome& getChromosome(unsigned int i) const { return this->chromosomes.at(i);}
|
||||
|
||||
public:
|
||||
HaploidGenotype(const std::vector<Chromosome>& _chrom) : chromosomes(_chrom){};
|
||||
|
||||
};
|
||||
|
||||
class Genotype {
|
||||
friend class ChromosomeRearrangementStrategy;
|
||||
friend std::ostream& operator<< (std::ostream& os, const Genotype& g);
|
||||
friend class Processor;
|
||||
protected:
|
||||
HaploidGenotype fatherGenome;
|
||||
HaploidGenotype motherGenome;
|
||||
|
||||
public:
|
||||
Genotype(const std::vector<Chromosome>& _fGenome, const std::vector<Chromosome>& _mGenome) : fatherGenome(HaploidGenotype(_fGenome)), motherGenome(HaploidGenotype(_mGenome)) {};
|
||||
Genotype(const HaploidGenotype& _fGenome, const HaploidGenotype& _mGenome) : fatherGenome(_fGenome), motherGenome(_mGenome) {};
|
||||
Genotype(const Genotype& _fDiplGenome, const Genotype& _mDiplGenome);
|
||||
HaploidGenotype recombinantHaploidGenotype(ChromosomeRearrangementStrategy*) const;
|
||||
const HaploidGenotype& getFatherGenome() const { return this->fatherGenome;}
|
||||
const HaploidGenotype& getMotherGenome() const { return this->motherGenome;}
|
||||
std::string toSimpleString() const;
|
||||
std::string toSimpleFasta(bool onlyMother = true) const;
|
||||
std::string toMaxModuleAB() const;
|
||||
|
||||
std::string getRawGene(unsigned int fatherMother, unsigned int chromoNum, unsigned int geneNum) const;
|
||||
void doRawMutationSequence(unsigned int fatherMother, unsigned int chromoNum, unsigned int geneNum, std::string newSeq);
|
||||
};
|
||||
|
||||
|
||||
//!!!!!!!!!!
|
||||
class PolyploidGenotype {
|
||||
|
||||
};
|
||||
11
DEC_GUI/DEC-0.0/individual/genome/Chromosome.cpp
Normal file
11
DEC_GUI/DEC-0.0/individual/genome/Chromosome.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "Chromosome.h"
|
||||
|
||||
void Chromosome::insertGene(Gene gene, int pos){
|
||||
std::vector<Gene>::iterator it = this->genes.begin();
|
||||
this->genes.insert(it+pos, gene);
|
||||
}
|
||||
|
||||
void Chromosome::insertGeneToEnd(Gene gene, int pos){
|
||||
std::vector<Gene>::iterator it = this->genes.end();
|
||||
this->genes.insert(it-pos, gene);
|
||||
}
|
||||
26
DEC_GUI/DEC-0.0/individual/genome/Chromosome.h
Normal file
26
DEC_GUI/DEC-0.0/individual/genome/Chromosome.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "Gene.h"
|
||||
/*
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
|
||||
class Chromosome {
|
||||
friend class ChromosomeRearrangementStrategy;
|
||||
friend class Genotype;
|
||||
protected:
|
||||
std::string name;
|
||||
std::vector<Gene> genes;
|
||||
|
||||
public:
|
||||
Chromosome(std::string _name) : name(_name) {};
|
||||
Chromosome(std::string _name, Gene gene) : name(_name), genes(1, gene) {};
|
||||
Chromosome(std::string _name, const std::vector<Gene>& _genes) : name(_name), genes(_genes) {};
|
||||
|
||||
void insertGene(Gene gene, int pos = 0);
|
||||
void insertGeneToEnd(Gene gene, int pos = 0);
|
||||
std::string getName() const { return name;}
|
||||
const std::vector<Gene>& getGenesAsVector() const { return genes;}
|
||||
};
|
||||
39
DEC_GUI/DEC-0.0/individual/genome/Gene.cpp
Normal file
39
DEC_GUI/DEC-0.0/individual/genome/Gene.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "Gene.h"
|
||||
#include <iostream>
|
||||
|
||||
Gene::Gene(idType _ID, std::string _name, float value):
|
||||
ID(_ID), name(_name), geneValueCont(value), geneType(Continious)
|
||||
{}
|
||||
|
||||
Gene::Gene(idType _ID, std::string _name, int value):
|
||||
ID(_ID), name(_name), geneValueDiscr(value), geneType(Discrete)
|
||||
{}
|
||||
|
||||
Gene::Gene(idType _ID, std::string _name, std::string _seq):
|
||||
ID(_ID), name(_name), sequence(_seq), geneType(Sequence)
|
||||
{}
|
||||
|
||||
void Gene::setGeneValue(float _value){
|
||||
if(this->geneType == Continious){
|
||||
this->geneValueCont = _value;
|
||||
return;
|
||||
}
|
||||
/*throw*/std::cerr<<"Gene.cpp(17) Warning: can't assign float value to discrete Gene\n";
|
||||
}
|
||||
|
||||
void Gene::setGeneValue(int _value){
|
||||
if(this->geneType == Discrete){
|
||||
this->geneValueDiscr = _value;
|
||||
return;
|
||||
}
|
||||
/*throw*/std::cerr<<"Gene.cpp(25) Warning: can't assign int value to continious Gene\n";
|
||||
}
|
||||
|
||||
void Gene::setGeneValue(std::string _seq){
|
||||
if(this->geneType == Sequence){
|
||||
this->sequence = _seq;
|
||||
return;
|
||||
}
|
||||
/*throw*/std::cerr<<"Gene.cpp(37) Warning: can't assign numerical value to sequence Gene\n";
|
||||
|
||||
}
|
||||
44
DEC_GUI/DEC-0.0/individual/genome/Gene.h
Normal file
44
DEC_GUI/DEC-0.0/individual/genome/Gene.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
/*
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD>, <20><><EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD> <20><><EFBFBD><EFBFBD>" (<28><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>),
|
||||
<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
|
||||
1) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
2) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>/<2F><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
3) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>/<2F><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
4) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28> <20>.<2E>. <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>???)
|
||||
5) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>.<2E>.
|
||||
*/
|
||||
|
||||
class Gene {
|
||||
public:
|
||||
enum GeneType { Continious, Discrete, Sequence };
|
||||
typedef unsigned int idType;
|
||||
|
||||
protected:
|
||||
GeneType geneType; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
idType ID; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::string name; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float geneValueCont;// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int geneValueDiscr; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::string sequence;
|
||||
|
||||
public:
|
||||
Gene(idType _ID, std::string _name, float value);
|
||||
Gene(idType _ID, std::string _name, int value);
|
||||
Gene(idType _ID, std::string _name, std::string seq);
|
||||
|
||||
GeneType getGeneType() const { return geneType; }
|
||||
idType getID() const { return ID; }
|
||||
std::string getName() const { return name; }
|
||||
float getGeneValueCont() const { return geneValueCont; }
|
||||
int getGeneValueDiscr() const { return geneValueDiscr; }
|
||||
std::string getSequence()const { return sequence; }
|
||||
|
||||
void setName(const std::string& _name) { name = _name; }
|
||||
void setID(idType _ID) { ID = _ID; }
|
||||
void setGeneValue(float _value);
|
||||
void setGeneValue(int _value);
|
||||
void setGeneValue(std::string _seq);
|
||||
};
|
||||
119
DEC_GUI/DEC-0.0/individual/genome/Genotype.cpp
Normal file
119
DEC_GUI/DEC-0.0/individual/genome/Genotype.cpp
Normal file
@@ -0,0 +1,119 @@
|
||||
#include "AbstractGenome.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cmath>
|
||||
//Genotype::Genotype(const Genotype& _fDiplGenome, const Genotype& _mDiplGenome){
|
||||
//}
|
||||
|
||||
HaploidGenotype Genotype::recombinantHaploidGenotype(ChromosomeRearrangementStrategy* strategy) const {
|
||||
return strategy->buildRecombinantGenotype(this);
|
||||
}
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, const Genotype& g){
|
||||
os<<"F";
|
||||
for(unsigned int i = 0; i < g.fatherGenome.chromosomes.size(); i++){
|
||||
os<<"ch"<<(i+1)<<":";
|
||||
const std::vector<Gene> genesF = g.fatherGenome.chromosomes.at(i).getGenesAsVector();
|
||||
const std::vector<Gene> genesM = g.motherGenome.chromosomes.at(i).getGenesAsVector();
|
||||
for(unsigned int j = 0; j < genesF.size(); j++){
|
||||
os<<"\t";
|
||||
os<<genesF.at(j).getName();//<<", ";
|
||||
if(genesF.at(j).getGeneType() == Gene::Continious){
|
||||
os<<"\t"<<genesF.at(j).getGeneValueCont();//<<"\t";
|
||||
os<<"\t"<<genesM.at(j).getGeneValueCont();//<<"\t";
|
||||
}
|
||||
else{
|
||||
os<<"\t"<<genesF.at(j).getGeneValueDiscr();//<<"\t";
|
||||
os<<"\t"<<genesM.at(j).getGeneValueDiscr();//<<"\t";
|
||||
}
|
||||
os<<"\t";
|
||||
}
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
std::string Genotype::toSimpleString() const {
|
||||
std::stringstream os;
|
||||
for(unsigned int i = 0; i < this->fatherGenome.chromosomes.size(); i++){
|
||||
const std::vector<Gene> genesF = this->fatherGenome.chromosomes.at(i).getGenesAsVector();
|
||||
const std::vector<Gene> genesM = this->motherGenome.chromosomes.at(i).getGenesAsVector();
|
||||
for(unsigned int j = 0; j < genesF.size(); j++){
|
||||
if(genesF.at(j).getGeneType() == Gene::Continious){
|
||||
os<<genesF.at(j).getGeneValueCont()<<"\t";
|
||||
os<<genesM.at(j).getGeneValueCont()<<"\t";
|
||||
}
|
||||
else{
|
||||
os<<genesF.at(j).getGeneValueDiscr()<<"\t";
|
||||
os<<genesM.at(j).getGeneValueDiscr()<<"\t";
|
||||
}
|
||||
//os<<"\t";
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::string Genotype::toMaxModuleAB() const {
|
||||
std::stringstream os;
|
||||
for(unsigned int i = 0; i < this->fatherGenome.chromosomes.size(); i++){
|
||||
const std::vector<Gene> genesF = this->fatherGenome.chromosomes.at(i).getGenesAsVector();
|
||||
const std::vector<Gene> genesM = this->motherGenome.chromosomes.at(i).getGenesAsVector();
|
||||
for(unsigned int j = 0; j < genesF.size(); j++){
|
||||
if(genesF.at(j).getGeneType() == Gene::Continious){
|
||||
if(fabs(genesF.at(j).getGeneValueCont()) > fabs(genesM.at(j).getGeneValueCont())){
|
||||
os<<genesF.at(j).getGeneValueCont()<<"\t";
|
||||
}
|
||||
else{
|
||||
os<<genesM.at(j).getGeneValueCont()<<"\t";
|
||||
}
|
||||
}
|
||||
else{
|
||||
os<<genesF.at(j).getGeneValueDiscr()<<"\t";
|
||||
os<<genesM.at(j).getGeneValueDiscr()<<"\t";
|
||||
}
|
||||
//os<<"\t";
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string Genotype::getRawGene(unsigned int fatherMother, unsigned int chromoNum, unsigned int geneNum) const{
|
||||
const HaploidGenotype* genome = (fatherMother == 0) ? &(this->fatherGenome) : &(this->motherGenome);
|
||||
return genome->getChromosome(chromoNum).getGenesAsVector().at(geneNum).getSequence();
|
||||
}
|
||||
|
||||
void Genotype::doRawMutationSequence(unsigned int fatherMother, unsigned int chromoNum, unsigned int geneNum, std::string newSeq){
|
||||
if(fatherMother==2){
|
||||
this->fatherGenome.chromosomes.at(chromoNum).genes.at(geneNum).setGeneValue(newSeq);
|
||||
this->motherGenome.chromosomes.at(chromoNum).genes.at(geneNum).setGeneValue(newSeq);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Genotype::toSimpleFasta(bool onlyMother) const {
|
||||
std::stringstream os;
|
||||
for(unsigned int i = 0; i < this->motherGenome.chromosomes.size(); i++){
|
||||
const std::vector<Gene> genesF = this->fatherGenome.chromosomes.at(i).getGenesAsVector();
|
||||
const std::vector<Gene> genesM = this->motherGenome.chromosomes.at(i).getGenesAsVector();
|
||||
os<<"> "<<this->motherGenome.chromosomes.at(i).getName()<<"\n";
|
||||
for(unsigned int j = 0; j < genesM.size(); j++){
|
||||
if(genesM.at(i).getGeneType() == Gene::Sequence){
|
||||
os<<genesM.at(j).getSequence();
|
||||
}
|
||||
else if(genesM.at(j).getGeneType() == Gene::Continious){
|
||||
os<<genesF.at(j).getGeneValueCont()<<"\t";
|
||||
os<<genesM.at(j).getGeneValueCont()<<"\t";
|
||||
}
|
||||
else{
|
||||
os<<genesF.at(j).getGeneValueDiscr()<<"\t";
|
||||
os<<genesM.at(j).getGeneValueDiscr()<<"\t";
|
||||
}
|
||||
//os<<"\t";
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
#include "ChromosomeRearrangementStrategy.h"
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
HaploidGenotype ChromosomeRearrangementStrategy::buildRecombinantGenotype(const Genotype* parentGenotype){
|
||||
std::vector<Chromosome> chromosomes;
|
||||
const std::vector<Chromosome>* fGenome = &parentGenotype->fatherGenome.chromosomes;
|
||||
const std::vector<Chromosome>* mGenome = &parentGenotype->motherGenome.chromosomes;
|
||||
|
||||
//srand((unsigned int)time(NULL));
|
||||
for (unsigned int i = 0; i < fGenome->size(); i++){
|
||||
int flag = rand() % 2;
|
||||
const std::vector<Gene>* first;
|
||||
const std::vector<Gene>* second;
|
||||
if(flag == 0){
|
||||
first = &fGenome->at(i).genes;
|
||||
second= &mGenome->at(i).genes;
|
||||
}
|
||||
else{
|
||||
first = &mGenome->at(i).genes;
|
||||
second= &fGenome->at(i).genes;
|
||||
}
|
||||
Chromosome childChromosome(fGenome->at(i).name, *first);
|
||||
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
int bound = rand() % first->size();
|
||||
for(unsigned int j = bound; j < first->size(); j++){
|
||||
childChromosome.genes.at(j) = second->at(j);
|
||||
}
|
||||
chromosomes.push_back(childChromosome);
|
||||
|
||||
}
|
||||
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD>. <20> <20> <20>),
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
return HaploidGenotype(chromosomes);
|
||||
}
|
||||
|
||||
HaploidGenotype ChromosomeRearrangementStrategy::
|
||||
buildRecombinantGenotype(const HaploidGenotype& fatherGenome, const HaploidGenotype& motherGenome){
|
||||
std::vector<Chromosome> chromosomes;
|
||||
const std::vector<Chromosome> fGenome = fatherGenome.chromosomes;
|
||||
const std::vector<Chromosome> mGenome = motherGenome.chromosomes;
|
||||
|
||||
//srand((unsigned int)time(NULL));
|
||||
for (unsigned int i = 0; i < fGenome.size(); i++){
|
||||
int flag = rand() % 2;
|
||||
std::vector<Gene> first;
|
||||
std::vector<Gene> second;
|
||||
if(flag == 0){
|
||||
first = fGenome.at(i).genes;
|
||||
second= mGenome.at(i).genes;
|
||||
}
|
||||
else{
|
||||
first = mGenome.at(i).genes;
|
||||
second= fGenome.at(i).genes;
|
||||
}
|
||||
Chromosome childChromosome(fGenome.at(i).name, first);
|
||||
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
int bound = rand() % first.size();
|
||||
for(unsigned int j = bound; j < first.size(); j++){
|
||||
childChromosome.genes.at(j) = second.at(j);
|
||||
}
|
||||
chromosomes.push_back(childChromosome);
|
||||
|
||||
}
|
||||
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD>. <20> <20> <20>),
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
return HaploidGenotype(chromosomes);
|
||||
}
|
||||
|
||||
ChromosomeRearrangementStrategy* RecombinationStrategies::getInstance(std::string _name){
|
||||
return new ChromosomeRearrangementStrategy();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include "../AbstractGenome.h"
|
||||
|
||||
class HaploidGenotype;
|
||||
class Genotype;
|
||||
|
||||
class ChromosomeRearrangementStrategy {
|
||||
public:
|
||||
virtual HaploidGenotype buildRecombinantGenotype(const Genotype*);
|
||||
virtual HaploidGenotype buildRecombinantGenotype(const HaploidGenotype&, const HaploidGenotype&);
|
||||
};
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
class RecombinationStrategies {
|
||||
public:
|
||||
static ChromosomeRearrangementStrategy* getInstance(std::string _name);
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "GenotypeToPhenotypeStrategy.h"
|
||||
#include "KolchShindyal/KolchShindyalGenotypeToPhenotypeStrategy.h"
|
||||
#include <cmath>
|
||||
|
||||
void GenotypeToPhenotypeStrategy::calculatePhenotype(Individual* individ){
|
||||
Genotype* genotype = individ->genotype;
|
||||
Phenotype* phenotype = individ->phenotype;
|
||||
InnerSubstratesPool* substrates = individ->substrateCache;
|
||||
|
||||
// Chromosome 1
|
||||
Chromosome chr1F = individ->genotype->getFatherGenome().getChromosome(0);
|
||||
Chromosome chr1M = individ->genotype->getMotherGenome().getChromosome(0);
|
||||
|
||||
const std::vector<Gene>& genesF = chr1F.getGenesAsVector();
|
||||
const std::vector<Gene>& genesM = chr1M.getGenesAsVector();
|
||||
|
||||
for(unsigned int i = 0; i < genesF.size(); i++){
|
||||
float geneVal = std::min(
|
||||
genesF.at(i).getGeneValueCont(),
|
||||
genesM.at(i).getGeneValueCont());
|
||||
phenotype->traitsMap[genesF.at(i).getName()].setTraitValue(geneVal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GenotypeToPhenotypeStrategy* GenotypeToPhenotypeStrategies::getInstance(std::string _name){
|
||||
if(_name.compare("inoutbreeding") == 0){
|
||||
return new InOutBreedingGenotypeToPhenotypeStrategy();
|
||||
}
|
||||
if(_name.compare("kolchan_shindyal_gen_to_phen") == 0){
|
||||
return new KolchShindyalGenotypeToPhenotypeStrategy();
|
||||
}
|
||||
// default
|
||||
return new GenotypeToPhenotypeStrategy();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "../../AbstractIndividual.h"
|
||||
#include "../AbstractGenome.h"
|
||||
#include "../../Phenotype.h"
|
||||
class GenotypeToPhenotypeStrategy {
|
||||
public:
|
||||
virtual void calculatePhenotype(Individual*);
|
||||
//virtual void calculatePhenotype(const Genotype*, Phenotype*);
|
||||
//Phenotype* calculatePhenotype(const Genotype*);
|
||||
};
|
||||
|
||||
class InOutBreedingGenotypeToPhenotypeStrategy : public GenotypeToPhenotypeStrategy {
|
||||
public:
|
||||
virtual void calculatePhenotype(Individual*);
|
||||
};
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
class GenotypeToPhenotypeStrategies {
|
||||
public:
|
||||
static GenotypeToPhenotypeStrategy* getInstance(std::string _name);
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "InOutBreedingPhenToFitStrategy.h"
|
||||
#include "../../../Phenotype.h"
|
||||
|
||||
double InOutBreedingPhenToFitStrategy::calculateFitness(Phenotype *phen){
|
||||
double ans = 0.0;
|
||||
|
||||
|
||||
ans = phen->getTraitByName("coadaptive").getTraitValueCont();
|
||||
//float coef = phen->getTraitByName("disease")
|
||||
return ans;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../PhenotypeToFitnessStrategy.h"
|
||||
|
||||
class InOutBreedingPhenToFitStrategy : public PhenotypeToFitnessStrategy {
|
||||
virtual double calculateFitness(Phenotype* phen);
|
||||
};
|
||||
@@ -0,0 +1,85 @@
|
||||
#include "InOutBreedingPopulationBreedingStrategy.h"
|
||||
#include "../../../../processor/Settings.h"
|
||||
#include "../../../Phenotype.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
void InOutBreedingPopulationBreedingStrategy::breed(Population *_pop){
|
||||
// N = const
|
||||
|
||||
AsexualPopulation* pop = dynamic_cast<AsexualPopulation*>(_pop);
|
||||
if(pop == NULL){
|
||||
std::cerr<<"Wrong dynamic cast to AsexualPopulation\n";
|
||||
return;
|
||||
}
|
||||
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
int offsprings = Settings::OffspringsMean;
|
||||
std::vector<Individual*> newIndivids;
|
||||
|
||||
long int inds;
|
||||
for(inds = pop->individs.size();inds >=2; inds -= 2){
|
||||
int motherIndex = rand()%inds;
|
||||
int fatherIndex = rand()%inds;
|
||||
if(fatherIndex == motherIndex){
|
||||
fatherIndex = (fatherIndex+1)%inds;
|
||||
}
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
for(int i = 0; i < offsprings; i++){
|
||||
Individual* ind = new Individual(*(pop->individs.at(motherIndex)), *(pop->individs.at(fatherIndex)));
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ind->calculatePhenotype();
|
||||
Phenotype phen = ind->getPhenotype();
|
||||
float coadapt = phen.getTraitByName("coadaptive").getTraitValueCont();
|
||||
float disease = phen.getTraitByName("disease").getTraitValueCont();
|
||||
|
||||
if(disease > Settings::DiseaseThreshold){ // <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float probSurvive = 1.f;
|
||||
if(coadapt < Settings::CoadaptiveThreshold){ // TODO: <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
probSurvive = Settings::CoadaptiveMinimumP;
|
||||
}
|
||||
else{
|
||||
probSurvive = (1-Settings::CoadaptiveMinimumP)/(Settings::CoadaptiveMaximumTrait-Settings::CoadaptiveThreshold);
|
||||
probSurvive *= coadapt - Settings::CoadaptiveMaximumTrait;
|
||||
probSurvive += 1;
|
||||
}
|
||||
int order = 1000;
|
||||
int prob = rand()%order;
|
||||
if(prob < order*probSurvive){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20>.<2E>.
|
||||
newIndivids.push_back(ind);
|
||||
}
|
||||
}
|
||||
} // (END) for(int i = 0; i < offsprings; i++)
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
delete pop->individs.at(motherIndex);
|
||||
delete pop->individs.at(fatherIndex);
|
||||
if(motherIndex > fatherIndex){
|
||||
pop->individs.erase(pop->individs.begin()+motherIndex);
|
||||
pop->individs.erase(pop->individs.begin()+fatherIndex);
|
||||
}
|
||||
else{
|
||||
pop->individs.erase(pop->individs.begin()+fatherIndex);
|
||||
pop->individs.erase(pop->individs.begin()+motherIndex);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(newIndivids.size() >= Settings::KMaxParameter){
|
||||
for(unsigned int i = 0; i < pop->individs.size(); i++){
|
||||
delete pop->individs.at(i);
|
||||
}
|
||||
pop->individs.clear();
|
||||
break;
|
||||
}
|
||||
} // (END) for(inds = pop->individs.size();inds >=2; inds -= 2)
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
pop->individs.insert(pop->individs.begin(), newIndivids.begin(), newIndivids.end());
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../../../population/BreedingStrategies/PopulationBreedingStrategy.h"
|
||||
|
||||
class InOutBreedingPopulationBreedingStrategy : public PopulationBreedingStrategy {
|
||||
public:
|
||||
virtual void breed(Population* pop);
|
||||
};
|
||||
@@ -0,0 +1,102 @@
|
||||
#include "../GenotypeToPhenotypeStrategy.h"
|
||||
#include "../../../../processor/Settings.h"
|
||||
#include <cmath>
|
||||
#include <qmath.h>
|
||||
|
||||
void InOutBreedingGenotypeToPhenotypeStrategy::calculatePhenotype(Individual* individ){
|
||||
Genotype* genotype = individ->genotype;
|
||||
Phenotype* phenotype = individ->phenotype;
|
||||
InnerSubstratesPool* substrates = individ->substrateCache;
|
||||
|
||||
// Chromosome 1
|
||||
Chromosome chr1F = individ->genotype->getFatherGenome().getChromosome(0);
|
||||
Chromosome chr1M = individ->genotype->getMotherGenome().getChromosome(0);
|
||||
|
||||
const std::vector<Gene>& genesF = chr1F.getGenesAsVector();
|
||||
const std::vector<Gene>& genesM = chr1M.getGenesAsVector();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float a1 = genesF.at(0).getGeneValueCont();
|
||||
float a2 = genesM.at(0).getGeneValueCont();
|
||||
|
||||
float b1 = genesF.at(1).getGeneValueCont();
|
||||
float b2 = genesM.at(1).getGeneValueCont();
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<float> diseaseAllelesF(4);
|
||||
std::vector<float> diseaseAllelesM(4);
|
||||
|
||||
for(unsigned int i = 0; i < diseaseAllelesF.size(); i++){
|
||||
diseaseAllelesF.at(i) = genesF.at(i+2).getGeneValueCont();
|
||||
diseaseAllelesM.at(i) = genesM.at(i+2).getGeneValueCont();
|
||||
}
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float trait1 = 0, trait2 = 0;
|
||||
float a, b;
|
||||
|
||||
// 1) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
if(Settings::CoadaptiveGenesInteraction == "onechromosome"){
|
||||
// 1.1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
a = a1;
|
||||
b = b1;
|
||||
}
|
||||
else if(Settings::CoadaptiveGenesInteraction == "mean"){
|
||||
// 1.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
a = 0.5f*(a1+a2);
|
||||
b = 0.5f*(b1+b2);
|
||||
}
|
||||
else{ // Settings::CoadaptiveGenesInteraction == "maxmodule"
|
||||
// 1.3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
a = std::fabs(a1) >= std::fabs(a2) ? a1 : a2;
|
||||
b = std::fabs(b1) >= std::fabs(b2) ? b1 : b2;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1
|
||||
trait1 = std::max(a*b - (std::fabs(a*a*a) + std::fabs(b*b*b))/20, 0.0f);
|
||||
//trait1 = std::max(a*b - (a*a*a*a + b*b*b*b)/250, 0.0f);
|
||||
|
||||
// 2) <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(Settings::DiseaseGenesInteraction == "add1"){
|
||||
// 2.1<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float sum1 = 0.0f, sum2 = 0.0f;
|
||||
for(unsigned int i = 0; i < diseaseAllelesF.size(); i++){
|
||||
sum1 += diseaseAllelesF.at(i);
|
||||
sum2 += diseaseAllelesM.at(i);
|
||||
}
|
||||
trait2 = std::max(sum1,sum2);
|
||||
}
|
||||
else if(Settings::DiseaseGenesInteraction == "addmax"){
|
||||
// 2.1<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD>)
|
||||
for(unsigned int i = 0; i < diseaseAllelesF.size(); i++){
|
||||
trait2 += std::max(diseaseAllelesF.at(i), diseaseAllelesM.at(i));
|
||||
}
|
||||
}
|
||||
else if(Settings::DiseaseGenesInteraction == "mult"){
|
||||
// 2.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
for(unsigned int i = 0; i < diseaseAllelesF.size(); i++){
|
||||
trait2 *= std::max(diseaseAllelesF.at(i), diseaseAllelesM.at(i));
|
||||
}
|
||||
}
|
||||
else if(Settings::DiseaseGenesInteraction == "meanadd"){
|
||||
// 2.3<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
for(unsigned int i = 0; i < diseaseAllelesF.size(); i++){
|
||||
trait2 += diseaseAllelesF.at(i) + diseaseAllelesM.at(i);
|
||||
}
|
||||
trait2 /= 2.0f;
|
||||
}
|
||||
else{// if(Settings::DiseaseGenesInteraction == "meanmult"){
|
||||
// 2.3<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
for(unsigned int i = 0; i < diseaseAllelesF.size(); i++){
|
||||
trait2 *= (diseaseAllelesF.at(i) + diseaseAllelesM.at(i))/2;
|
||||
}
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
phenotype->traitsMap["coadaptive"].setTraitValue(trait1);
|
||||
phenotype->traitsMap["disease"].setTraitValue(trait2);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#include "KolchShindyalBreedingStrategy.h"
|
||||
#include "../../../../processor/Settings.h"
|
||||
#include "../../../Phenotype.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
void KolchShindyalBreedingStrategy::breed(Population *_pop){
|
||||
// N = const
|
||||
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
|
||||
AsexualPopulation* pop = dynamic_cast<AsexualPopulation*>(_pop);
|
||||
if(pop == NULL){
|
||||
std::cerr<<"Wrong dynamic cast to AsexualPopulation\n";
|
||||
return;
|
||||
}
|
||||
std::sort(pop->individs.begin(), pop->individs.end(), compareOnFitness);
|
||||
int inds = pop->individs.size();
|
||||
|
||||
// <20><> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SelectionAll
|
||||
// <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float deathRate = 0.01f; //Settings::DeathRate
|
||||
int toDie = int (inds * deathRate);
|
||||
std::vector<Individual*>::iterator start = pop->individs.begin();
|
||||
std::vector<Individual*>::iterator end = pop->individs.begin()+toDie;
|
||||
//advance(end,toDie);
|
||||
for(std::vector<Individual*>::iterator it = start; it != end; it++){
|
||||
delete *it;
|
||||
}
|
||||
pop->individs.erase(start, end);
|
||||
|
||||
std::cout<<"PopulationBreedingStrategy::breed: "<<toDie<<" individs have died\n";
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float birthRate = Settings::BirthRate;//0.02f;
|
||||
int toBorn = int (inds * birthRate);
|
||||
inds = pop->individs.size();
|
||||
srand((unsigned int)time(NULL));
|
||||
for(int i = 0; i < toBorn; i++) {
|
||||
int male = rand() % inds;
|
||||
int female = rand() % inds;
|
||||
female = (female != male ? female : (female + 1) % inds);
|
||||
|
||||
Individual* ind = new Individual(*(pop->individs.at(male)), *(pop->individs.at(female)));
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> !!!
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20>.<2E>.
|
||||
pop->individs.push_back(ind);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../../../population/BreedingStrategies/PopulationBreedingStrategy.h"
|
||||
|
||||
class KolchShindyalBreedingStrategy : public PopulationBreedingStrategy {
|
||||
public:
|
||||
virtual void breed(Population* pop);
|
||||
};
|
||||
@@ -0,0 +1,63 @@
|
||||
#include "KolchShindyalGenotypeToPhenotypeStrategy.h"
|
||||
//#include "../GenotypeToPhenotypeStrategy.h"
|
||||
#include "../../../../processor/Settings.h"
|
||||
#include <cmath>
|
||||
|
||||
void KolchShindyalGenotypeToPhenotypeStrategy::calculatePhenotype(Individual* individ){
|
||||
Genotype* genotype = individ->genotype;
|
||||
Phenotype* phenotype = individ->phenotype;
|
||||
InnerSubstratesPool* substrates = individ->substrateCache;
|
||||
|
||||
// Chromosome 1
|
||||
Chromosome chr1F = individ->genotype->getFatherGenome().getChromosome(0);
|
||||
Chromosome chr1M = individ->genotype->getMotherGenome().getChromosome(0);
|
||||
|
||||
const std::vector<Gene>& genesF = chr1F.getGenesAsVector();
|
||||
const std::vector<Gene>& genesM = chr1M.getGenesAsVector();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float c1m = genesM.at(0).getGeneValueCont();
|
||||
float c2m = genesM.at(1).getGeneValueCont();
|
||||
float c3m = genesM.at(2).getGeneValueCont();
|
||||
float c4m = genesM.at(3).getGeneValueCont();
|
||||
float c5m = genesM.at(4).getGeneValueCont();
|
||||
float Em = genesM.at(5).getGeneValueCont();
|
||||
|
||||
float c1f = genesF.at(0).getGeneValueCont();
|
||||
float c2f = genesF.at(1).getGeneValueCont();
|
||||
float c3f = genesF.at(2).getGeneValueCont();
|
||||
float c4f = genesF.at(3).getGeneValueCont();
|
||||
float c5f = genesF.at(4).getGeneValueCont();
|
||||
float Ef = genesF.at(5).getGeneValueCont();
|
||||
|
||||
float X = 0;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/*
|
||||
// 1) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <09>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int feedBackM = genesM.at(6).getGeneValueDiscr();
|
||||
int feedBackF = genesF.at(6).getGeneValueDiscr();
|
||||
if( (feedBackF+feedBackM) != 0) {
|
||||
X = -c2/2 + sqrt( c2*c2/4 + c5*c2/c3*(E+c4));
|
||||
}
|
||||
else{
|
||||
X = c1/c3*(E+c4);
|
||||
}
|
||||
|
||||
// <09>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
int feedBackM = genesM.at(6).getGeneValueDiscr();
|
||||
int feedBackF = genesF.at(6).getGeneValueDiscr();
|
||||
if( (feedBackF+feedBackM) == 2) {
|
||||
X = -c2/2 + sqrt( c2*c2/4 + c5*c2/c3*(E+c4));
|
||||
}
|
||||
else{
|
||||
X = c1/c3*(E+c4);
|
||||
}
|
||||
|
||||
// 2) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
phenotype->traitsMap["X"].setTraitValue(X);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "../GenotypeToPhenotypeStrategy.h"
|
||||
class KolchShindyalGenotypeToPhenotypeStrategy: public GenotypeToPhenotypeStrategy {
|
||||
public:
|
||||
virtual void calculatePhenotype(Individual*);
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "KolchShindyalPhenToFitnessStrategy.h"
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <cmath>
|
||||
|
||||
double KolchShindyalPhenToFitnessStrategy::calculateFitness(Phenotype *phen){
|
||||
|
||||
double X = phen->getTraitByName("X").getTraitValueCont();
|
||||
double Xopt = phen->getTraitByName("Xopt").getTraitValueCont();
|
||||
double sigmaX = phen->getTraitByName("sigmaX").getTraitValueCont();
|
||||
|
||||
double ans = 1/(sqrt(2*M_PI)) * exp(-0.5*pow((X-Xopt)/sigmaX,2.));
|
||||
|
||||
return ans;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include "../PhenotypeToFitnessStrategy.h"
|
||||
#include "../../../Phenotype.h"
|
||||
|
||||
class KolchShindyalPhenToFitnessStrategy : public PhenotypeToFitnessStrategy {
|
||||
virtual double calculateFitness(Phenotype* phen);
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
#include "PhenotypeToFitnessStrategy.h"
|
||||
#include "../../Phenotype.h"
|
||||
#include "InOutBreeding/InOutBreedingPhenToFitStrategy.h"
|
||||
#include "KolchShindyal/KolchShindyalPhenToFitnessStrategy.h"
|
||||
#include <cmath>
|
||||
|
||||
double PhenotypeToFitnessStrategy::calculateFitness(Phenotype *phen){
|
||||
double ans = 0.0;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::map<std::string, Trait>::iterator it;
|
||||
for(it = phen->traitsMap.begin(); it != phen->traitsMap.end(); it++){
|
||||
float trait = it->second.getTraitValueCont();
|
||||
ans += trait*trait;
|
||||
}
|
||||
return std::pow(ans,0.5);
|
||||
}
|
||||
|
||||
PhenotypeToFitnessStrategy* PhenotypeToFitnessStrategy::getInstance(std::string name){
|
||||
if(name.compare("inoutbreeding") == 0){
|
||||
return new InOutBreedingPhenToFitStrategy();
|
||||
}
|
||||
if(name.compare("kolch_shindyal_phen_to_fit") == 0){
|
||||
return new KolchShindyalPhenToFitnessStrategy();
|
||||
}
|
||||
return new PhenotypeToFitnessStrategy();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class Phenotype;
|
||||
|
||||
class PhenotypeToFitnessStrategy {
|
||||
public:
|
||||
static PhenotypeToFitnessStrategy* getInstance(std::string);
|
||||
virtual double calculateFitness(Phenotype* phen);
|
||||
};
|
||||
189
DEC_GUI/DEC-0.0/population/BisexualPopulation.cpp
Normal file
189
DEC_GUI/DEC-0.0/population/BisexualPopulation.cpp
Normal file
@@ -0,0 +1,189 @@
|
||||
#include "Population.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
BisexualPopulation::~BisexualPopulation(){
|
||||
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
void BisexualPopulation::calculateFitnessAll(){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
void BisexualPopulation::breedAll(){
|
||||
this->breedingStrategy->breed(this);
|
||||
}
|
||||
|
||||
void BisexualPopulation::selectionAll(){
|
||||
|
||||
}
|
||||
|
||||
void BisexualPopulation::mutationAll(){
|
||||
// !!! <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
float mutProb = 1 / 1e+6f; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::list<Individual*>::iterator it;
|
||||
for(it = this->females.begin(); it != this->females.end(); it++){
|
||||
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2014
|
||||
Chromosome chrom = (*it)->genotype->getMotherGenome().getChromosome(0);
|
||||
std::vector<Gene> genes = chrom.getGenesAsVector();
|
||||
int wholeSeqLength = 0;
|
||||
for(unsigned int i = 0; i < genes.size(); i++){
|
||||
wholeSeqLength += genes.at(i).getSequence().size();
|
||||
}
|
||||
|
||||
//std::string seq = (*it)->genotype->getRawGene(0,0,0); // <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2013
|
||||
int positionToMutate = rand() % (int)(1/mutProb);
|
||||
if(positionToMutate < wholeSeqLength){
|
||||
std::string seq = genes.at(0).getSequence();
|
||||
int geneNum = positionToMutate / seq.size(); // <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2014
|
||||
positionToMutate = positionToMutate % seq.size(); // <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2014
|
||||
//Gene geneToMutate = genes.at(geneNum);
|
||||
int nucl = rand() % 3;
|
||||
switch(seq.c_str()[positionToMutate]){
|
||||
case 'A':
|
||||
if(nucl == 0) seq.replace(positionToMutate,1,"C");
|
||||
if(nucl == 1) seq.replace(positionToMutate,1,"G");
|
||||
if(nucl == 2) seq.replace(positionToMutate,1,"T");
|
||||
break;
|
||||
case 'C':
|
||||
if(nucl == 0) seq.replace(positionToMutate,1,"A");
|
||||
if(nucl == 1) seq.replace(positionToMutate,1,"G");
|
||||
if(nucl == 2) seq.replace(positionToMutate,1,"T");
|
||||
break;
|
||||
case 'G':
|
||||
if(nucl == 0) seq.replace(positionToMutate,1,"C");
|
||||
if(nucl == 1) seq.replace(positionToMutate,1,"A");
|
||||
if(nucl == 2) seq.replace(positionToMutate,1,"T");
|
||||
break;
|
||||
case 'T':
|
||||
if(nucl == 0) seq.replace(positionToMutate,1,"C");
|
||||
if(nucl == 1) seq.replace(positionToMutate,1,"G");
|
||||
if(nucl == 2) seq.replace(positionToMutate,1,"A");
|
||||
break;
|
||||
} // (END) switch(...)
|
||||
(*it)->genotype->doRawMutationSequence(2, 0, geneNum, seq);
|
||||
} // (END) if (mutate)
|
||||
} // (END) for
|
||||
|
||||
// !!! --------------------------------
|
||||
}
|
||||
|
||||
std::string BisexualPopulation::getSatistics(){
|
||||
std::string ans;
|
||||
return ans;
|
||||
}
|
||||
|
||||
void BisexualPopulation::putGeneticStatisticsToStream(std::ostream& out){
|
||||
out<<"Females\n=======\n";
|
||||
int i = 1;
|
||||
for(std::list<Individual*>::iterator it = females.begin(); it != females.end(); it++){
|
||||
|
||||
//out<<"> Female seq mitochondrial"<<(i++)<<"\n";
|
||||
out<<(*it)->getGenotype().toSimpleFasta()<<std::endl;
|
||||
out<<std::endl;
|
||||
}
|
||||
|
||||
out<<"\nMales\n=======\n";
|
||||
i = 1;
|
||||
for(std::list<Individual*>::iterator it = males.begin(); it != males.end(); it++){
|
||||
out<<"> Male seq "<<(i++)<<"\n";
|
||||
out<<(*it)->getGenotype().toSimpleFasta()<<std::endl;
|
||||
out<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void BisexualPopulation::putGeneticSimpleStatisticsToStream(std::ostream& out){
|
||||
out<<"Population statistics:\tMales =\t"<<males.size();
|
||||
out<<"\tFemales =\t"<<females.size()<<std::endl;
|
||||
//out<<"Genome statistics (mitochondrial DNA sequence):\n\n";
|
||||
}
|
||||
|
||||
void BisexualPopulation::putGeneticMaxModuleStatisticsToStream(std::ostream& out){
|
||||
|
||||
}
|
||||
|
||||
std::string BisexualPopulation::mutualMigration(BisexualPopulation* p1, BisexualPopulation* p2, float frac1, float frac2){
|
||||
std::stringstream ss;
|
||||
|
||||
int sizeP1 = p1->males.size() + p1->females.size();
|
||||
int sizeP2 = p2->males.size() + p2->females.size();
|
||||
|
||||
int indsP1toP2 = (int) (frac1*sizeP1)/2;
|
||||
int indsP2toP1 = (int) (frac2*sizeP2)/2;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::list<Individual*> malesTemp;
|
||||
std::list<Individual*> femalesTemp;
|
||||
|
||||
// P1 -> temp
|
||||
// males
|
||||
std::list<Individual*>::iterator it1 = p1->males.begin();
|
||||
std::list<Individual*>::iterator it2 = it1;
|
||||
std::advance(it2, indsP1toP2);
|
||||
malesTemp.splice(malesTemp.begin(), p1->males, it1, it2);
|
||||
|
||||
// females
|
||||
it1 = p1->females.begin();
|
||||
it2 = it1;
|
||||
std::advance(it2, indsP1toP2);
|
||||
femalesTemp.splice(femalesTemp.begin(), p1->females, it1, it2);
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
// P2 -> P1
|
||||
// males
|
||||
it1 = p2->males.begin();
|
||||
it2 = it1;
|
||||
std::advance(it2, indsP2toP1);
|
||||
p1->males.splice(p1->males.end(), p2->males, it1, it2);
|
||||
|
||||
// females
|
||||
it1 = p2->females.begin();
|
||||
it2 = it1;
|
||||
std::advance(it2, indsP2toP1);
|
||||
p1->females.splice(p1->females.end(), p2->females, it1, it2);
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
// temp -> P2
|
||||
// males
|
||||
p2->males.splice(p2->males.end(), malesTemp);
|
||||
|
||||
// females
|
||||
p2->females.splice(p2->females.end(), femalesTemp);
|
||||
|
||||
ss<<"Migration:\tP1->P2\t"<<indsP1toP2*2<<"\t\tP2->P1\t"<<indsP2toP1*2<<std::endl;
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
BisexualPopulation* BisexualPopulation::createSubpopulation(float frac){
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
int malesFounders = (int) (frac*this->males.size());
|
||||
int femalesFounders = (int) (frac*this->females.size());
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::list<Individual*> malesTemp;
|
||||
std::list<Individual*> femalesTemp;
|
||||
|
||||
// P1 -> temp
|
||||
// males
|
||||
std::list<Individual*>::iterator it1 = this->males.begin();
|
||||
std::list<Individual*>::iterator it2 = it1;
|
||||
std::advance(it2, malesFounders);
|
||||
malesTemp.splice(malesTemp.begin(), this->males, it1, it2);
|
||||
|
||||
// females
|
||||
it1 = this->females.begin();
|
||||
it2 = it1;
|
||||
std::advance(it2, femalesFounders);
|
||||
femalesTemp.splice(femalesTemp.begin(), this->females, it1, it2);
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
return new BisexualPopulation(malesTemp,femalesTemp, this->breedingStrategy);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
#include "NeutralEvolutionBreedStrat.h"
|
||||
#include "../../individual/Phenotype.h"
|
||||
#include "../../processor/Settings.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
void NeutralEvolutionBreedingStrategy::breed(Population* _pop){
|
||||
|
||||
BisexualPopulation* pop = dynamic_cast<BisexualPopulation*>(_pop);
|
||||
if(pop == NULL){
|
||||
std::cerr<<"Wrong dynamic cast to BisexualPopulation\n";
|
||||
return;
|
||||
}
|
||||
|
||||
int numMales = pop->males.size();
|
||||
int numFemales = pop->females.size();
|
||||
int inds = numMales + numFemales;
|
||||
|
||||
srand((unsigned int)time(NULL));
|
||||
//srand(0);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int toDie = int (inds * deathRate);
|
||||
for(int i = 0; i < toDie; i++){
|
||||
int indToDie = rand() % (inds-i);
|
||||
if(indToDie < numMales){
|
||||
std::list<Individual*>::iterator it = pop->males.begin();
|
||||
std::advance(it,indToDie); // it += indToDie;
|
||||
delete *it;
|
||||
pop->males.erase(it);
|
||||
numMales--;
|
||||
}
|
||||
else{
|
||||
std::list<Individual*>::iterator it = pop->females.begin();
|
||||
std::advance(it,indToDie-numMales); // it += indToDie;
|
||||
delete *it;
|
||||
pop->females.erase(it);
|
||||
numFemales--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//std::cout<<"PopulationBreedingStrategy::breed: "<<toDie<<" individs have died\n";
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int toBorn = int (inds * birthRate);
|
||||
numMales = pop->males.size();
|
||||
numFemales = pop->females.size();
|
||||
inds = numMales + numFemales;
|
||||
|
||||
for(int i = 0; i < toBorn; i++) {
|
||||
int fatherNum = rand() % numMales;
|
||||
int motherNum = rand() % numFemales;
|
||||
int gender = rand() % 2;
|
||||
|
||||
std::list<Individual*>::iterator itFather = pop->males.begin();
|
||||
std::advance(itFather, fatherNum);
|
||||
std::list<Individual*>::iterator itMother = pop->females.begin();
|
||||
std::advance(itMother, motherNum);
|
||||
|
||||
Genotype* genotype;
|
||||
|
||||
double prob = Settings::ProbMtDNARecomb;
|
||||
if(prob > 0.0){
|
||||
int invProb = (int)(1/prob);
|
||||
int recombine = rand() % invProb;
|
||||
if(recombine == 0){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//std::cerr<<"Recomb\n";
|
||||
ChromosomeRearrangementStrategy* recombinator = RecombinationStrategies::getInstance("dummy");
|
||||
HaploidGenotype recombGenotype = recombinator->buildRecombinantGenotype(
|
||||
(*itFather)->getGenotype().getMotherGenome(), (*itMother)->getGenotype().getMotherGenome());
|
||||
genotype = new Genotype(recombGenotype, recombGenotype);
|
||||
}
|
||||
else{
|
||||
genotype = new Genotype(
|
||||
(*itMother)->getGenotype().getMotherGenome(), (*itMother)->getGenotype().getMotherGenome());
|
||||
}
|
||||
}
|
||||
else{
|
||||
genotype = new Genotype(
|
||||
(*itMother)->getGenotype().getMotherGenome(), (*itMother)->getGenotype().getMotherGenome());
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
|
||||
Phenotype* phenotype= new Phenotype((*itFather)->getPhenotype());
|
||||
|
||||
Individual* ind = new Individual(genotype, phenotype, 0, Individual::Gender(gender));
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20>.<2E>.
|
||||
if(gender == 0){
|
||||
pop->males.push_back(ind);
|
||||
}
|
||||
else{
|
||||
pop->females.push_back(ind);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "PopulationBreedingStrategy.h"
|
||||
|
||||
class NeutralEvolutionBreedingStrategy : public PopulationBreedingStrategy {
|
||||
float birthRate;
|
||||
float deathRate;
|
||||
public:
|
||||
void setBirthRate(float b) {birthRate = b;}
|
||||
void setDeathRate(float d) {deathRate = d;}
|
||||
|
||||
virtual void breed(Population* pop);
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
#include "PopulationBreedingStrategy.h"
|
||||
#include "VerhulstBreedingStrategy.h"
|
||||
#include "NeutralEvolutionBreedStrat.h"
|
||||
#include "../../individual/genome/strategies/InOutBreeding/InOutBreedingPopulationBreedingStrategy.h"
|
||||
#include "../../individual/genome/strategies/KolchShindyal/KolchShindyalBreedingStrategy.h"
|
||||
|
||||
#include "../../processor/Settings.h"
|
||||
//#include <vector>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
void PopulationBreedingStrategy::breed(Population* _pop){
|
||||
float deathRate = Settings::NaturalDeathRate;//0.01f; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
|
||||
AsexualPopulation* pop = dynamic_cast<AsexualPopulation*>(_pop);
|
||||
if(pop == NULL){
|
||||
std::cerr<<"Wrong dynamic cast to AsexualPopulation\n";
|
||||
return;
|
||||
}
|
||||
std::sort(pop->individs.begin(), pop->individs.end(), compareOnFitness);
|
||||
int inds = pop->individs.size();
|
||||
|
||||
// <20><> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SelectionAll
|
||||
// <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int toDie = int (inds * deathRate);
|
||||
std::vector<Individual*>::iterator start = pop->individs.begin();
|
||||
std::vector<Individual*>::iterator end = pop->individs.begin()+toDie;
|
||||
//advance(end,toDie);
|
||||
for(std::vector<Individual*>::iterator it = start; it != end; it++){
|
||||
delete *it;
|
||||
}
|
||||
pop->individs.erase(start, end);
|
||||
|
||||
std::cout<<"PopulationBreedingStrategy::breed: "<<toDie<<" individs have died\n";
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float birthRate = Settings::BirthRate;//0.02f;
|
||||
int toBorn = int (inds * birthRate);
|
||||
inds = pop->individs.size();
|
||||
srand((unsigned int)time(NULL));
|
||||
for(int i = 0; i < toBorn; i++) {
|
||||
int male = rand() % inds;
|
||||
int female = rand() % inds;
|
||||
female = (female != male ? female : (female + 1) % inds);
|
||||
|
||||
Individual* ind = new Individual(*(pop->individs.at(male)), *(pop->individs.at(female)));
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20>.<2E>.
|
||||
pop->individs.push_back(ind);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PopulationBreedingStrategy* PopulationBreedingStrategy::getInstance(std::string name){
|
||||
if(name.compare("Verhulst") == 0){
|
||||
return new VerhulstBreedingStrategy();
|
||||
}
|
||||
if(name.compare("inoutbreeding") == 0){
|
||||
return new InOutBreedingPopulationBreedingStrategy();
|
||||
}
|
||||
if(name.compare("kolchan_shindyal_breeding") == 0){
|
||||
return new KolchShindyalBreedingStrategy();
|
||||
}
|
||||
if(name.compare("neutral") == 0){
|
||||
return new NeutralEvolutionBreedingStrategy();
|
||||
}
|
||||
return new PopulationBreedingStrategy();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "../Population.h"
|
||||
|
||||
class Population;
|
||||
|
||||
class PopulationBreedingStrategy {
|
||||
public:
|
||||
virtual void breed(Population* pop);
|
||||
static PopulationBreedingStrategy* getInstance(std::string name);
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "VerhulstBreedingStrategy.h"
|
||||
#include "../../processor/Settings.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
void VerhulstBreedingStrategy::breed(Population *_pop) {
|
||||
// <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// rX * (1 - X/K) = rX - (r/K)X^2
|
||||
|
||||
double birthRate = Settings::BirthRate;// 0.03;
|
||||
double r = 1 + birthRate;
|
||||
double K = _pop->region->getCapacity();
|
||||
|
||||
AsexualPopulation* pop = dynamic_cast<AsexualPopulation*>(_pop);
|
||||
if(pop == NULL){
|
||||
std::cerr<<"Wrong dynamic cast to AsexualPopulation\n";
|
||||
return;
|
||||
}
|
||||
|
||||
long int inds = pop->individs.size();
|
||||
long int toDie = (long int) inds*inds * r/K + 0.5; // 0.5 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
long int toBorn = (long int) inds*birthRate + 0.5; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
|
||||
std::sort(pop->individs.begin(), pop->individs.end(), compareOnFitness);
|
||||
std::vector<Individual*>::iterator start = pop->individs.begin();
|
||||
std::vector<Individual*>::iterator end = pop->individs.begin()+toDie;
|
||||
for(std::vector<Individual*>::iterator it = start; it != end; it++){
|
||||
delete *it;
|
||||
}
|
||||
pop->individs.erase(start, end);
|
||||
std::cout<<"VerhulstBreedingStrategy::breed: "<<toDie<<" individs have died\n";
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
inds = pop->individs.size();
|
||||
srand((unsigned int)time(NULL));
|
||||
for(long int i = 0; i < toBorn; i++) {
|
||||
int male = rand() % inds;
|
||||
int female = rand() % inds;
|
||||
female = (female != male ? female : (female + 1) % inds);
|
||||
|
||||
Individual* ind = new Individual(*(pop->individs.at(male)), *(pop->individs.at(female)));
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20>.<2E>.
|
||||
pop->individs.push_back(ind);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include "PopulationBreedingStrategy.h"
|
||||
|
||||
class VerhulstBreedingStrategy : public PopulationBreedingStrategy {
|
||||
public:
|
||||
virtual void breed(Population* pop);
|
||||
};
|
||||
162
DEC_GUI/DEC-0.0/population/Population.cpp
Normal file
162
DEC_GUI/DEC-0.0/population/Population.cpp
Normal file
@@ -0,0 +1,162 @@
|
||||
#include "Population.h"
|
||||
#include "../individual/Phenotype.h"
|
||||
#include "DEC-0.0/processor/Processor.h"
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
AsexualPopulation::~AsexualPopulation(){
|
||||
// TODO : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
|
||||
}
|
||||
AsexualPopulation::AsexualPopulation(int size, PopulationBreedingStrategy* _strategy) :
|
||||
Population(_strategy), individs(size/*, 0*/)
|
||||
{
|
||||
|
||||
srand(0);
|
||||
int RANGE = 1000;
|
||||
float gValue;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
for(int i = 0; i < size; i++){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<Chromosome> fGenome;
|
||||
std::vector<Chromosome> mGenome;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
gValue = (rand()%RANGE + 1) / (float) RANGE;
|
||||
Gene geneF1(Gene::Continious, "X", gValue);
|
||||
gValue = (rand()%RANGE + 1) / (float) RANGE;
|
||||
Gene geneF2(Gene::Continious, "Y", gValue);
|
||||
gValue = (rand()%RANGE + 1) / (float) RANGE;
|
||||
Gene geneF3(Gene::Continious, "Z", gValue);
|
||||
|
||||
Chromosome chromF("Chrom 1"); // <20><><EFBFBD><EFBFBD>
|
||||
chromF.insertGeneToEnd(geneF1);
|
||||
chromF.insertGeneToEnd(geneF2);
|
||||
chromF.insertGeneToEnd(geneF3);
|
||||
|
||||
|
||||
gValue = (rand()%RANGE + 1) / (float) RANGE;
|
||||
Gene geneM1(Gene::Continious, "X", gValue);
|
||||
gValue = (rand()%RANGE + 1) / (float) RANGE;
|
||||
Gene geneM2(Gene::Continious, "Y", gValue);
|
||||
gValue = (rand()%RANGE + 1) / (float) RANGE;
|
||||
Gene geneM3(Gene::Continious, "Z", gValue);
|
||||
|
||||
Chromosome chromM("Chrom 1"); // <20><><EFBFBD><EFBFBD>
|
||||
chromM.insertGeneToEnd(geneM1);
|
||||
chromM.insertGeneToEnd(geneM2);
|
||||
chromM.insertGeneToEnd(geneM3);
|
||||
|
||||
fGenome.push_back(chromF);
|
||||
mGenome.push_back(chromM);
|
||||
Genotype* genotype = new Genotype(fGenome, mGenome);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Trait trait1(Trait::Continious, "X", 0.0f);
|
||||
Trait trait2(Trait::Continious, "Y", 0.0f);
|
||||
Trait trait3(Trait::Continious, "Z", 0.0f);
|
||||
Phenotype* phenotype = new Phenotype(trait1);
|
||||
phenotype->addTrait(trait2);
|
||||
phenotype->addTrait(trait3);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
InnerSubstratesPool* subPool = 0;
|
||||
// (END) <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
this->individs.at(i) = new Individual(genotype, phenotype, subPool, Individual::hermaphrodite, 0);
|
||||
} // (END) for(int i = 0; i < size; i++)
|
||||
}
|
||||
|
||||
void AsexualPopulation::calculateFitnessAll(){
|
||||
for(unsigned int i = 0; i < this->individs.size(); i++){
|
||||
this->individs.at(i)->calculateFitness();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AsexualPopulation::breedAll(){
|
||||
this->breedingStrategy->breed(this);
|
||||
}
|
||||
|
||||
void AsexualPopulation::selectionAll(){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> breedAll
|
||||
}
|
||||
|
||||
void AsexualPopulation::mutationAll(){
|
||||
|
||||
}
|
||||
|
||||
void AsexualPopulation::setRegion(Region *_region){
|
||||
this->region = _region;
|
||||
for(unsigned int i = 0; i < this->individs.size(); i++){
|
||||
this->individs.at(i)->setRegion(_region);
|
||||
}
|
||||
}
|
||||
|
||||
std::string AsexualPopulation::getSatistics(){
|
||||
std::stringstream ans;
|
||||
long int pSize = this->individs.size();
|
||||
ans<<"Population size\t"<<pSize<<"\t";
|
||||
|
||||
//////////////////////////
|
||||
double totalFitness = 0.0;
|
||||
double best = 0.0;
|
||||
double worst= 1000.0;
|
||||
for(int i = 0; i < pSize; i++){
|
||||
double fitness = this->individs.at(i)->getFitness();
|
||||
best = fitness > best ? fitness : best;
|
||||
worst= fitness < worst? fitness : worst;
|
||||
totalFitness += fitness;
|
||||
}
|
||||
ans<<"Average fitness\t"<<(totalFitness/pSize);
|
||||
ans<<"\tBest\t"<<(best);
|
||||
ans<<"\tWorst\t"<<(worst);
|
||||
return ans.str();
|
||||
}
|
||||
|
||||
void AsexualPopulation::putGeneticStatisticsToStream(std::ostream &out){
|
||||
|
||||
out<<"Population size:\t"<<this->individs.size()<<std::endl;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//sort(this->individs.begin(),this->individs.end());
|
||||
//std::cout << "lol" << std::endl;
|
||||
for(unsigned int i = 0; i < this->individs.size(); i++){
|
||||
// out<<(i+1)<<"\t";
|
||||
// out<<"Fitness:\t"<<(this->individs.at(i)->getFitness());
|
||||
// out<<"\t";
|
||||
// out<<"Genotype:\t"<<(this->individs.at(i)->getGenotype());
|
||||
// out<<"\t";
|
||||
// out<<"Phenotype:\t"<<(this->individs.at(i)->getPhenotype());
|
||||
// out<<std::endl;
|
||||
std::cout << "lol" << std::endl;
|
||||
Processor::fillVectors(this->individs.at(i)->getGenotype());
|
||||
}
|
||||
}
|
||||
|
||||
void AsexualPopulation::putGeneticSimpleStatisticsToStream(std::ostream &out){
|
||||
for(unsigned int i = 0; i < this->individs.size(); i++){
|
||||
out<<(i+1)<<"\t"<<(this->individs.at(i)->getFitness());
|
||||
out<<"\t"<<(this->individs.at(i)->getGenotype().toSimpleString());
|
||||
//out<<"\t";
|
||||
out<<(this->individs.at(i)->getPhenotype().toSimpleString());
|
||||
out<<std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AsexualPopulation::putGeneticMaxModuleStatisticsToStream(std::ostream &out){
|
||||
for(unsigned int i = 0; i < this->individs.size(); i++){
|
||||
out<<(i+1)<<"\t"<<(this->individs.at(i)->getFitness());
|
||||
out<<"\t"<<(this->individs.at(i)->getGenotype().toMaxModuleAB());
|
||||
//out<<"\t";
|
||||
//out<<(this->individs.at(i)->getPhenotype().toSimpleString());
|
||||
out<<std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
90
DEC_GUI/DEC-0.0/population/Population.h
Normal file
90
DEC_GUI/DEC-0.0/population/Population.h
Normal file
@@ -0,0 +1,90 @@
|
||||
#pragma once
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include "../individual/AbstractIndividual.h"
|
||||
#include "BreedingStrategies/PopulationBreedingStrategy.h"
|
||||
#include "../environment/AbstractEnvironment.h"
|
||||
|
||||
|
||||
class PopulationBreedingStrategy;
|
||||
|
||||
class Population {
|
||||
friend class PopulationBreedingStrategy;
|
||||
friend class VerhulstBreedingStrategy;
|
||||
protected:
|
||||
PopulationBreedingStrategy* breedingStrategy;
|
||||
Region* region;
|
||||
public:
|
||||
Population(PopulationBreedingStrategy* _strategy) : breedingStrategy(_strategy){}
|
||||
virtual ~Population() {};
|
||||
virtual void setBreedingStrategy(PopulationBreedingStrategy* _strategy) { breedingStrategy = _strategy;}
|
||||
virtual void setRegion(Region* _region) { region = _region;}
|
||||
virtual void calculateFitnessAll() = 0;
|
||||
virtual void breedAll() = 0;
|
||||
virtual void selectionAll() = 0;
|
||||
virtual void mutationAll() = 0;
|
||||
virtual std::string getSatistics() = 0;
|
||||
virtual void putGeneticStatisticsToStream(std::ostream& out) = 0;
|
||||
virtual void putGeneticSimpleStatisticsToStream(std::ostream& out) = 0;
|
||||
virtual void putGeneticMaxModuleStatisticsToStream(std::ostream& out) = 0;
|
||||
};
|
||||
|
||||
class AsexualPopulation : public Population {
|
||||
friend class PopulationBreedingStrategy;
|
||||
friend class VerhulstBreedingStrategy;
|
||||
friend class InOutBreedingPopulationBreedingStrategy;
|
||||
friend class KolchShindyalBreedingStrategy;
|
||||
friend class Processor;
|
||||
protected:
|
||||
std::vector<Individual*> individs;
|
||||
|
||||
public:
|
||||
AsexualPopulation(const std::vector<Individual*>& _inds, PopulationBreedingStrategy* _strategy = 0) : Population(_strategy), individs(_inds) {};
|
||||
AsexualPopulation(int size, PopulationBreedingStrategy* _strategy = 0);
|
||||
virtual ~AsexualPopulation();
|
||||
|
||||
virtual void setRegion(Region* _region);
|
||||
virtual void calculateFitnessAll();
|
||||
virtual void breedAll();
|
||||
virtual void selectionAll();
|
||||
virtual void mutationAll();
|
||||
virtual std::string getSatistics();
|
||||
virtual void putGeneticStatisticsToStream(std::ostream& out);
|
||||
virtual void putGeneticSimpleStatisticsToStream(std::ostream& out);
|
||||
virtual void putGeneticMaxModuleStatisticsToStream(std::ostream& out);
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
class BisexualPopulation : public Population {
|
||||
friend class NeutralEvolutionBreedingStrategy;
|
||||
friend class DerevyankoReport2014;
|
||||
friend class DerevyankoReport;
|
||||
friend class Settings;
|
||||
friend class DerRep2014Window;
|
||||
friend class DerRepRFBR2013window;
|
||||
protected:
|
||||
std::list<Individual*> males;
|
||||
std::list<Individual*> females;
|
||||
public:
|
||||
BisexualPopulation(const std::list<Individual*>& _males,
|
||||
const std::list<Individual*>& _females, PopulationBreedingStrategy* _strategy = 0) :
|
||||
Population(_strategy), males(_males), females(_females) {}
|
||||
|
||||
virtual ~BisexualPopulation();
|
||||
|
||||
//virtual void setRegion(Region* _region);
|
||||
virtual void calculateFitnessAll();
|
||||
virtual void breedAll();
|
||||
virtual void selectionAll();
|
||||
virtual void mutationAll();
|
||||
virtual std::string getSatistics();
|
||||
virtual void putGeneticStatisticsToStream(std::ostream& out);
|
||||
virtual void putGeneticSimpleStatisticsToStream(std::ostream& out);
|
||||
virtual void putGeneticMaxModuleStatisticsToStream(std::ostream& out);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
static std::string mutualMigration(BisexualPopulation* p1, BisexualPopulation* p2, float frac1, float frac2 = -1.f);
|
||||
BisexualPopulation* createSubpopulation(float frac);
|
||||
};
|
||||
127
DEC_GUI/DEC-0.0/processor/KolchShindyalov.cpp
Normal file
127
DEC_GUI/DEC-0.0/processor/KolchShindyalov.cpp
Normal file
@@ -0,0 +1,127 @@
|
||||
#include "Settings.h"
|
||||
#include "../population/Population.h"
|
||||
#include "../individual/Phenotype.h"
|
||||
#include "../individual/genome/strategies/GenotypeToPhenotypeStrategy.h"
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <QGlobal.h>
|
||||
#include <QTime>
|
||||
#include "KolchShindyalov.h"
|
||||
|
||||
void KolchShindyalov::test01(){
|
||||
std::ofstream statFile("statFile.txt");
|
||||
std::string stat;
|
||||
std::cout << "Kolch" << std::endl;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int maxGenerations = Settings::Iterations;
|
||||
long initPopSize = Settings::InitPopSize;
|
||||
float ratioBetweenPops = Settings::InitRatioBetweenPops;
|
||||
long int maxIndivids = Settings::KMaxParameter;
|
||||
|
||||
Position3D<double> position(0, 0, 0, 1000, 1000, 1000);
|
||||
Region region(position, maxIndivids);
|
||||
|
||||
qsrand(0);
|
||||
int RANGE = 1000;
|
||||
int PRECISION = 10;
|
||||
float gValue;
|
||||
|
||||
std::vector<Individual*> individs;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
for(int i = 0; i < initPopSize; i++){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<Chromosome> fGenome;
|
||||
std::vector<Chromosome> mGenome;
|
||||
|
||||
std::vector<Chromosome> chroms;
|
||||
for(int j = 0; j < 2; j++){
|
||||
//float gValue
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
RANGE = 10;
|
||||
gValue = -(float)(qrand()%(RANGE*PRECISION+1))/PRECISION;
|
||||
Gene geneF1(Gene::Continious, "C1", gValue);
|
||||
gValue = -(float)(rand()%(RANGE*PRECISION+1))/PRECISION;
|
||||
Gene geneF2(Gene::Continious, "C2", gValue);
|
||||
|
||||
PRECISION=1;
|
||||
RANGE = 2;
|
||||
gValue = (rand()%(RANGE*PRECISION + 1)) / (float) RANGE / PRECISION;
|
||||
Gene geneF3(Gene::Continious, "C3", gValue);
|
||||
gValue = (rand()%(RANGE*PRECISION + 1)) / (float) RANGE / PRECISION;
|
||||
Gene geneF4(Gene::Continious, "C4", gValue);
|
||||
gValue = (rand()%(RANGE*PRECISION + 1)) / (float) RANGE / PRECISION;
|
||||
Gene geneF5(Gene::Continious, "C5", gValue);
|
||||
gValue = (rand()%(RANGE*PRECISION + 1)) / (float) RANGE / PRECISION;
|
||||
Gene geneF6(Gene::Continious, "E", gValue);
|
||||
gValue = rand()%2;
|
||||
Gene geneF7(Gene::Discrete,"Feedback", gValue);
|
||||
|
||||
Chromosome chromF("Chrom 1"); // <20><><EFBFBD><EFBFBD> / <20><><EFBFBD><EFBFBD>
|
||||
chromF.insertGeneToEnd(geneF1);
|
||||
chromF.insertGeneToEnd(geneF2);
|
||||
chromF.insertGeneToEnd(geneF3);
|
||||
chromF.insertGeneToEnd(geneF4);
|
||||
chromF.insertGeneToEnd(geneF5);
|
||||
chromF.insertGeneToEnd(geneF6);
|
||||
chromF.insertGeneToEnd(geneF7);
|
||||
|
||||
chroms.push_back(chromF);
|
||||
} // (END) for(int i = 0; i < 2; i++)
|
||||
|
||||
fGenome.push_back(chroms.at(0));
|
||||
mGenome.push_back(chroms.at(1));
|
||||
Genotype* genotype = new Genotype(fGenome, mGenome);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Trait trait1(Trait::Continious, "X", 10.0f);
|
||||
Trait trait2(Trait::Continious, "Xopt", 10.0f);
|
||||
Trait trait3(Trait::Continious, "sigmaX", 3.0f);
|
||||
|
||||
Phenotype* phenotype = new Phenotype(trait1);
|
||||
phenotype->addTrait(trait2);
|
||||
phenotype->addTrait(trait3);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
Individual* newInd = new Individual(genotype, phenotype, 0, Individual::hermaphrodite, 0);
|
||||
newInd->setGenToPhenStrategy(GenotypeToPhenotypeStrategies::getInstance("kolchan_shindyal_gen_to_phen"));
|
||||
newInd->setPhenToFitnessStrategy(PhenotypeToFitnessStrategy::getInstance("kolch_shindyal_phen_to_fit"));
|
||||
individs.push_back(newInd);
|
||||
} // (END) for(int i = 0; i < size; i++)
|
||||
|
||||
AsexualPopulation population(individs);
|
||||
population.setBreedingStrategy(PopulationBreedingStrategy::getInstance("kolchan_shindyal_breeding"));
|
||||
population.setRegion(®ion);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
for(int i = 0; i < maxGenerations; i++){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
population.breedAll();
|
||||
//--- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ---
|
||||
stat = population.getSatistics();
|
||||
statFile<<stat<<std::endl;
|
||||
|
||||
if(Settings::WRITE_FULL_STATISTICS_TO_FILE){
|
||||
std::stringstream ss;
|
||||
std::stringstream ss2;
|
||||
std::stringstream ss3;
|
||||
ss<<"generation."<<(i)<<".xls";
|
||||
ss2<<"generation."<<(i)<<".txt";
|
||||
ss3<<"gmaxAB."<<(i)<<".txt";
|
||||
std::ofstream genFile(ss.str().c_str());
|
||||
std::ofstream genFile2(ss2.str().c_str());
|
||||
std::ofstream genFile3(ss3.str().c_str());
|
||||
population.putGeneticStatisticsToStream(genFile);
|
||||
population.putGeneticSimpleStatisticsToStream(genFile2);
|
||||
population.putGeneticMaxModuleStatisticsToStream(genFile3);
|
||||
genFile.close();
|
||||
genFile2.close();
|
||||
genFile3.close();
|
||||
}
|
||||
//------------------
|
||||
}
|
||||
statFile.close();
|
||||
}
|
||||
6
DEC_GUI/DEC-0.0/processor/KolchShindyalov.h
Normal file
6
DEC_GUI/DEC-0.0/processor/KolchShindyalov.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
class KolchShindyalov{
|
||||
public:
|
||||
static void test01(/*int, int*/);
|
||||
};
|
||||
534
DEC_GUI/DEC-0.0/processor/Processor.cpp
Normal file
534
DEC_GUI/DEC-0.0/processor/Processor.cpp
Normal file
@@ -0,0 +1,534 @@
|
||||
#include "Processor.h"
|
||||
#include "Settings.h"
|
||||
#include "../population/Population.h"
|
||||
#include "../individual/Phenotype.h"
|
||||
#include "../individual/genome/strategies/GenotypeToPhenotypeStrategy.h"
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <QGlobal.h>
|
||||
#include <QTime>
|
||||
#include <QVector>
|
||||
#include <QString>
|
||||
|
||||
AsexualPopulation* Processor::popul;
|
||||
//std::vector<Individual*> Processor::individs;
|
||||
|
||||
void Processor::test(/*int initPSize, int steps*/){
|
||||
std::ofstream statFile("statFile.txt");
|
||||
std::string stat;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int maxGenerations = Settings::Iterations;
|
||||
int initPopSize = Settings::InitPopSize;
|
||||
|
||||
AsexualPopulation population(initPopSize);
|
||||
population.setBreedingStrategy(PopulationBreedingStrategy::getInstance(Settings::BreedingStrategy));
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
for(int i = 0; i < maxGenerations; i++){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>)
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
population.calculateFitnessAll();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
population.breedAll();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
population.mutationAll();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD>)
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>.<2E>.)
|
||||
population.selectionAll();
|
||||
|
||||
//--- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ---
|
||||
stat = population.getSatistics();
|
||||
statFile<<stat<<std::endl;
|
||||
|
||||
if(Settings::WRITE_FULL_STATISTICS_TO_FILE){
|
||||
std::stringstream ss;
|
||||
ss<<"generation."<<(i)<<".txt";
|
||||
std::ofstream genFile(ss.str().c_str());
|
||||
population.putGeneticStatisticsToStream(genFile);
|
||||
genFile.close();
|
||||
}
|
||||
//------------------
|
||||
}
|
||||
statFile.close();
|
||||
}
|
||||
|
||||
void Processor::test01(/*int initPSize, int steps*/){
|
||||
std::ofstream statFile("statFile.txt");
|
||||
std::string stat;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int maxGenerations = Settings::Iterations;
|
||||
long initPopSize = Settings::InitPopSize;
|
||||
long int maxIndivids = Settings::KMaxParameter;
|
||||
|
||||
Position3D<double> position(0, 0, 0, 1000, 1000, 1000);
|
||||
Region region(position, maxIndivids);
|
||||
|
||||
AsexualPopulation population(initPopSize);
|
||||
population.setBreedingStrategy(PopulationBreedingStrategy::getInstance(Settings::BreedingStrategy));
|
||||
population.setRegion(®ion);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
for(int i = 0; i < maxGenerations; i++){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>)
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
population.calculateFitnessAll();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
population.breedAll();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
population.mutationAll();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD>)
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>.<2E>.)
|
||||
population.selectionAll();
|
||||
|
||||
//--- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ---
|
||||
stat = population.getSatistics();
|
||||
statFile<<stat<<std::endl;
|
||||
|
||||
if(Settings::WRITE_FULL_STATISTICS_TO_FILE){
|
||||
std::stringstream ss;
|
||||
ss<<"generation."<<(i)<<".txt";
|
||||
std::ofstream genFile(ss.str().c_str());
|
||||
population.putGeneticStatisticsToStream(genFile);
|
||||
genFile.close();
|
||||
}
|
||||
//------------------
|
||||
}
|
||||
statFile.close();
|
||||
}
|
||||
|
||||
///
|
||||
void Processor::testInOutBreeding01(){
|
||||
std::ofstream statFile("statFile.txt");
|
||||
std::string stat;
|
||||
std::cout << "breed" << std::endl;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int maxGenerations = Settings::Iterations;
|
||||
long initPopSize = Settings::InitPopSize;
|
||||
long int maxIndivids = Settings::KMaxParameter;
|
||||
|
||||
Position3D<double> position(0, 0, 0, 1000, 1000, 1000);
|
||||
Region region(position, maxIndivids);
|
||||
|
||||
|
||||
qsrand(0);
|
||||
int RANGE = 1000;
|
||||
int PRECISION = 10;
|
||||
float gValue;
|
||||
|
||||
std::vector<Individual*> individs;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
for(int i = 0; i < maxIndivids/2; i++){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<Chromosome> fGenome;
|
||||
std::vector<Chromosome> mGenome;
|
||||
|
||||
std::vector<Chromosome> chroms;
|
||||
for(int j = 0; j < 2; j++){
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
RANGE = 10;
|
||||
gValue = (float)(qrand()%(RANGE*PRECISION+1))/PRECISION;
|
||||
Gene geneF1(Gene::Continious, "A coadaptive", gValue);
|
||||
gValue = (float)(rand()%(RANGE*PRECISION+1))/PRECISION;
|
||||
Gene geneF2(Gene::Continious, "B coadaptive", gValue);
|
||||
|
||||
RANGE = 2;
|
||||
gValue = (rand()%(RANGE + 1)) / (float) RANGE;
|
||||
Gene geneF3(Gene::Continious, "C disease", gValue);
|
||||
gValue = (rand()%(RANGE + 1)) / (float) RANGE;
|
||||
Gene geneF4(Gene::Continious, "D disease", gValue);
|
||||
gValue = (rand()%(RANGE + 1)) / (float) RANGE;
|
||||
Gene geneF5(Gene::Continious, "E disease", gValue);
|
||||
gValue = (rand()%(RANGE + 1)) / (float) RANGE;
|
||||
Gene geneF6(Gene::Continious, "F disease", gValue);
|
||||
|
||||
Chromosome chromF("Chrom 1"); // <20><><EFBFBD><EFBFBD> / <20><><EFBFBD><EFBFBD>
|
||||
chromF.insertGeneToEnd(geneF1);
|
||||
chromF.insertGeneToEnd(geneF2);
|
||||
chromF.insertGeneToEnd(geneF3);
|
||||
chromF.insertGeneToEnd(geneF4);
|
||||
chromF.insertGeneToEnd(geneF5);
|
||||
chromF.insertGeneToEnd(geneF6);
|
||||
|
||||
chroms.push_back(chromF);
|
||||
} // (END) for(int i = 0; i < 2; i++)
|
||||
|
||||
fGenome.push_back(chroms.at(0));
|
||||
mGenome.push_back(chroms.at(1));
|
||||
Genotype* genotype = new Genotype(fGenome, mGenome);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Trait trait1(Trait::Continious, "coadaptive", 0.0f);
|
||||
Trait trait2(Trait::Continious, "disease", 0.0f);
|
||||
Phenotype* phenotype = new Phenotype(trait1);
|
||||
phenotype->addTrait(trait2);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
InnerSubstratesPool* subPool = 0;
|
||||
// (END) <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
Individual* newInd = new Individual(genotype, phenotype, subPool, Individual::hermaphrodite, 0);
|
||||
newInd->setGenToPhenStrategy(GenotypeToPhenotypeStrategies::getInstance("inoutbreeding"));
|
||||
individs.push_back(newInd);
|
||||
} // (END) for(int i = 0; i < size; i++)
|
||||
|
||||
AsexualPopulation population(individs);
|
||||
population.setBreedingStrategy(PopulationBreedingStrategy::getInstance("inoutbreeding"));
|
||||
population.setRegion(®ion);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
for(int i = 0; i < maxGenerations; i++){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
population.breedAll();
|
||||
//--- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ---
|
||||
stat = population.getSatistics();
|
||||
statFile<<stat<<std::endl;
|
||||
|
||||
if(Settings::WRITE_FULL_STATISTICS_TO_FILE){
|
||||
std::stringstream ss;
|
||||
std::stringstream ss2;
|
||||
ss<<"generation."<<(i)<<".xls";
|
||||
ss2<<"generation."<<(i)<<".txt";
|
||||
std::ofstream genFile(ss.str().c_str());
|
||||
std::ofstream genFile2(ss2.str().c_str());
|
||||
population.putGeneticStatisticsToStream(genFile);
|
||||
population.putGeneticSimpleStatisticsToStream(genFile2);
|
||||
genFile.close();
|
||||
genFile2.close();
|
||||
}
|
||||
//------------------
|
||||
}
|
||||
statFile.close();
|
||||
}
|
||||
|
||||
void Processor::fillVectors(const Genotype &g)
|
||||
{
|
||||
QVector<double> mGenes;
|
||||
QVector<double> fGenes;
|
||||
std::cout << "in fill" << std::endl;
|
||||
for(unsigned int i = 0; i < g.fatherGenome.chromosomes.size(); i++)
|
||||
{
|
||||
|
||||
std::cout <<"ch"<<(i+1)<<":";
|
||||
const std::vector<Gene> genesF = g.fatherGenome.chromosomes.at(i).getGenesAsVector();
|
||||
const std::vector<Gene> genesM = g.motherGenome.chromosomes.at(i).getGenesAsVector();
|
||||
std::cout << "i11111" << std::endl;
|
||||
Settings::geneName.clear();
|
||||
for(unsigned int j = 0; j < genesF.size(); j++){
|
||||
//std::cout<<"\t";
|
||||
std::cout<<genesF.at(j).getName();//<<", ";
|
||||
Settings::geneName.push_back(genesF.at(j).getName());
|
||||
if(genesF.at(j).getGeneType() == Gene::Continious){
|
||||
//std::cout<<"\t"<<genesF.at(j).getGeneValueCont() <<" " << genesM.at(j).getGeneValueCont() << std::endl;//<<"\t";
|
||||
//std::cout<<"\t"<< genesM.at(j).getGeneValueCont() << std::endl;//<<"\t";
|
||||
if (genesM.at(j).getGeneValueCont() < 0)
|
||||
{
|
||||
double val = genesM.at(j).getGeneValueCont() * (-1);
|
||||
mGenes.push_back(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
mGenes.push_back(genesM.at(j).getGeneValueCont());
|
||||
}
|
||||
|
||||
if (genesF.at(j).getGeneValueCont() < 0)
|
||||
{
|
||||
double val = genesF.at(j).getGeneValueCont() * (-1);
|
||||
fGenes.push_back(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
fGenes.push_back(genesF.at(j).getGeneValueCont());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
//std::cout<<"\t"<<genesF.at(j).getGeneValueDiscr();//<<"\t";
|
||||
//std::cout<<"\t"<<genesM.at(j).getGeneValueDiscr();//<<"\t";
|
||||
mGenes.push_back(genesM.at(j).getGeneValueDiscr());
|
||||
fGenes.push_back(genesF.at(j).getGeneValueDiscr());
|
||||
}
|
||||
//std::cout<<"\t";
|
||||
}
|
||||
}
|
||||
Settings::malesGene.push_back(mGenes);
|
||||
Settings::femalesGene.push_back(fGenes);
|
||||
}
|
||||
|
||||
void Processor::fillVectors(Genotype *g)
|
||||
{
|
||||
QVector<double> mGenes;
|
||||
QVector<double> fGenes;
|
||||
for(unsigned int i = 0; i < g->fatherGenome.chromosomes.size(); i++)
|
||||
{
|
||||
|
||||
//std::cout <<"ch"<<(i+1)<<":";
|
||||
const std::vector<Gene> genesF = g->fatherGenome.chromosomes.at(i).getGenesAsVector();
|
||||
const std::vector<Gene> genesM = g->motherGenome.chromosomes.at(i).getGenesAsVector();
|
||||
Settings::geneName.clear();
|
||||
for(unsigned int j = 0; j < genesF.size(); j++){
|
||||
//std::cout<<"\t";
|
||||
//std::cout<<genesF.at(j).getName();//<<", ";
|
||||
Settings::geneName.push_back(genesF.at(j).getName());
|
||||
if(genesF.at(j).getGeneType() == Gene::Continious){
|
||||
//std::cout<<"\t"<<genesF.at(j).getGeneValueCont() <<" " << genesM.at(j).getGeneValueCont() << std::endl;//<<"\t";
|
||||
//std::cout<<"\t"<< genesM.at(j).getGeneValueCont() << std::endl;//<<"\t";
|
||||
if (genesM.at(j).getGeneValueCont() < 0)
|
||||
{
|
||||
double val = genesM.at(j).getGeneValueCont() * (-1);
|
||||
mGenes.push_back(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
mGenes.push_back(genesM.at(j).getGeneValueCont());
|
||||
}
|
||||
|
||||
if (genesF.at(j).getGeneValueCont() < 0)
|
||||
{
|
||||
double val = genesF.at(j).getGeneValueCont() * (-1);
|
||||
fGenes.push_back(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
fGenes.push_back(genesF.at(j).getGeneValueCont());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
//std::cout<<"\t"<<genesF.at(j).getGeneValueDiscr();//<<"\t";
|
||||
//std::cout<<"\t"<<genesM.at(j).getGeneValueDiscr();//<<"\t";
|
||||
mGenes.push_back(genesM.at(j).getGeneValueDiscr());
|
||||
fGenes.push_back(genesF.at(j).getGeneValueDiscr());
|
||||
}
|
||||
//std::cout<<"\t";
|
||||
}
|
||||
}
|
||||
Settings::malesGene.push_back(mGenes);
|
||||
Settings::femalesGene.push_back(fGenes);
|
||||
}
|
||||
|
||||
void Processor::evolution(int generations)
|
||||
{
|
||||
for(int i = 0; i < generations; i++)
|
||||
{
|
||||
popul->breedAll();
|
||||
}
|
||||
//Settings::malesGene.clear();
|
||||
//Settings::femalesGene.clear();
|
||||
|
||||
std::stringstream ss;
|
||||
|
||||
//ss<<"generation."<<(i)<<".xls";
|
||||
|
||||
std::ofstream genFile(ss.str().c_str());
|
||||
|
||||
popul->putGeneticStatisticsToStream(genFile);
|
||||
// for(int i = 0; i < 10; i++)
|
||||
// {
|
||||
|
||||
// std::cout << Processor::individs.at(i)->getGenotype() << std::endl;
|
||||
// fillVectors(individs.at(i)->getGenotype());
|
||||
// }
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
void Processor::testInOutBreeding02(){
|
||||
std::ofstream statFile("statFile.txt");
|
||||
std::string stat;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int maxGenerations = Settings::Iterations;
|
||||
long initPopSize = Settings::InitPopSize;
|
||||
float ratioBetweenPops = Settings::InitRatioBetweenPops;
|
||||
long int maxIndivids = Settings::KMaxParameter;
|
||||
|
||||
Position3D<double> position(0, 0, 0, 1000, 1000, 1000);
|
||||
Region region(position, maxIndivids);
|
||||
|
||||
qsrand(0);
|
||||
int RANGE = 1000;
|
||||
int PRECISION = 10;
|
||||
float gValue;
|
||||
|
||||
std::vector<Individual*> individs;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD> 1
|
||||
for(int i = 0; i < initPopSize*ratioBetweenPops; i++){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<Chromosome> fGenome;
|
||||
std::vector<Chromosome> mGenome;
|
||||
|
||||
std::vector<Chromosome> chroms;
|
||||
for(int j = 0; j < 2; j++){
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
RANGE = 10;
|
||||
gValue = (float)(rand()%(RANGE*PRECISION+1))/PRECISION;
|
||||
Gene geneF1(Gene::Continious, "A coadaptive", gValue);
|
||||
gValue = (float)(rand()%(RANGE*PRECISION+1))/PRECISION;
|
||||
Gene geneF2(Gene::Continious, "B coadaptive", gValue);
|
||||
|
||||
RANGE = 2;
|
||||
gValue = (rand()%(RANGE*PRECISION + 1)) / (float) RANGE / PRECISION;
|
||||
Gene geneF3(Gene::Continious, "C disease", gValue);
|
||||
gValue = (rand()%(RANGE*PRECISION + 1)) / (float) RANGE / PRECISION;
|
||||
Gene geneF4(Gene::Continious, "D disease", gValue);
|
||||
gValue = (rand()%(RANGE*PRECISION + 1)) / (float) RANGE / PRECISION;
|
||||
Gene geneF5(Gene::Continious, "E disease", gValue);
|
||||
gValue = (rand()%(RANGE*PRECISION + 1)) / (float) RANGE / PRECISION;
|
||||
Gene geneF6(Gene::Continious, "F disease", gValue);
|
||||
|
||||
Chromosome chromF("Chrom 1"); // <20><><EFBFBD><EFBFBD> / <20><><EFBFBD><EFBFBD>
|
||||
chromF.insertGeneToEnd(geneF1);
|
||||
chromF.insertGeneToEnd(geneF2);
|
||||
chromF.insertGeneToEnd(geneF3);
|
||||
chromF.insertGeneToEnd(geneF4);
|
||||
chromF.insertGeneToEnd(geneF5);
|
||||
chromF.insertGeneToEnd(geneF6);
|
||||
|
||||
chroms.push_back(chromF);
|
||||
} // (END) for(int i = 0; i < 2; i++)
|
||||
|
||||
fGenome.push_back(chroms.at(0));
|
||||
mGenome.push_back(chroms.at(1));
|
||||
Genotype* genotype = new Genotype(fGenome, mGenome);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Trait trait1(Trait::Continious, "coadaptive", 0.0f);
|
||||
Trait trait2(Trait::Continious, "disease", 0.0f);
|
||||
Phenotype* phenotype = new Phenotype(trait1);
|
||||
phenotype->addTrait(trait2);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
Individual* newInd = new Individual(genotype, phenotype, 0, Individual::hermaphrodite, 0);
|
||||
newInd->setGenToPhenStrategy(GenotypeToPhenotypeStrategies::getInstance("inoutbreeding"));
|
||||
individs.push_back(newInd);
|
||||
} // (END) for(int i = 0; i < size; i++)
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD> 2
|
||||
for(int i = 0; i < initPopSize; i++){
|
||||
//std::cout << i << std::endl;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::vector<Chromosome> fGenome;
|
||||
std::vector<Chromosome> mGenome;
|
||||
|
||||
std::vector<Chromosome> chroms;
|
||||
for(int j = 0; j < 2; j++){
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
RANGE = 10;
|
||||
gValue = -(float)(rand()%(RANGE*PRECISION+1))/PRECISION;
|
||||
Gene geneF1(Gene::Continious, "A coadaptive", gValue);
|
||||
gValue = -(float)(rand()%(RANGE*PRECISION+1))/PRECISION;
|
||||
Gene geneF2(Gene::Continious, "B coadaptive", gValue);
|
||||
|
||||
PRECISION=1;
|
||||
RANGE = 2;
|
||||
gValue = (rand()%(RANGE*PRECISION + 1)) / (float) RANGE / PRECISION;
|
||||
Gene geneF3(Gene::Continious, "C disease", gValue);
|
||||
gValue = (rand()%(RANGE*PRECISION + 1)) / (float) RANGE / PRECISION;
|
||||
Gene geneF4(Gene::Continious, "D disease", gValue);
|
||||
gValue = (rand()%(RANGE*PRECISION + 1)) / (float) RANGE / PRECISION;
|
||||
Gene geneF5(Gene::Continious, "E disease", gValue);
|
||||
gValue = (rand()%(RANGE*PRECISION + 1)) / (float) RANGE / PRECISION;
|
||||
Gene geneF6(Gene::Continious, "F disease", gValue);
|
||||
|
||||
Chromosome chromF("Chrom 1"); // <20><><EFBFBD><EFBFBD> / <20><><EFBFBD><EFBFBD>
|
||||
chromF.insertGeneToEnd(geneF1);
|
||||
chromF.insertGeneToEnd(geneF2);
|
||||
chromF.insertGeneToEnd(geneF3);
|
||||
chromF.insertGeneToEnd(geneF4);
|
||||
chromF.insertGeneToEnd(geneF5);
|
||||
chromF.insertGeneToEnd(geneF6);
|
||||
|
||||
chroms.push_back(chromF);
|
||||
} // (END) for(int i = 0; i < 2; i++)
|
||||
|
||||
fGenome.push_back(chroms.at(0));
|
||||
mGenome.push_back(chroms.at(1));
|
||||
Genotype* genotype = new Genotype(fGenome, mGenome);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
fillVectors(genotype);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Trait trait1(Trait::Continious, "coadaptive", 0.0f);
|
||||
Trait trait2(Trait::Continious, "disease", 0.0f);
|
||||
Phenotype* phenotype = new Phenotype(trait1);
|
||||
phenotype->addTrait(trait2);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
Individual* newInd = new Individual(genotype, phenotype, 0, Individual::hermaphrodite, 0);
|
||||
newInd->setGenToPhenStrategy(GenotypeToPhenotypeStrategies::getInstance("inoutbreeding"));
|
||||
individs.push_back(newInd);
|
||||
} // (END) for(int i = 0; i < size; i++)
|
||||
|
||||
//popul = new AsexualPopulation(Processor::individs);
|
||||
AsexualPopulation population(individs);
|
||||
population.setBreedingStrategy(PopulationBreedingStrategy::getInstance("inoutbreeding"));
|
||||
population.setRegion(®ion);
|
||||
// (END) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
for(int i = 0; i < maxGenerations; i++){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
population.breedAll();
|
||||
// std::stringstream ss;
|
||||
// std::ofstream genFile(ss.str().c_str());
|
||||
// population.putGeneticStatisticsToStream(genFile);
|
||||
//--- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ---
|
||||
stat = population.getSatistics();
|
||||
statFile<<stat<<std::endl;
|
||||
|
||||
if(Settings::WRITE_FULL_STATISTICS_TO_FILE){
|
||||
std::stringstream ss;
|
||||
std::stringstream ss2;
|
||||
std::stringstream ss3;
|
||||
ss<<"generation."<<(i)<<".xls";
|
||||
ss2<<"generation."<<(i)<<".txt";
|
||||
ss3<<"gmaxAB."<<(i)<<".txt";
|
||||
std::ofstream genFile(ss.str().c_str());
|
||||
std::ofstream genFile2(ss2.str().c_str());
|
||||
std::ofstream genFile3(ss3.str().c_str());
|
||||
population.putGeneticStatisticsToStream(genFile);
|
||||
population.putGeneticSimpleStatisticsToStream(genFile2);
|
||||
population.putGeneticMaxModuleStatisticsToStream(genFile3);
|
||||
genFile.close();
|
||||
genFile2.close();
|
||||
genFile3.close();
|
||||
}
|
||||
//------------------
|
||||
|
||||
}
|
||||
statFile.close();
|
||||
//Settings::malesGene.clear();
|
||||
//Settings::femalesGene.clear();
|
||||
//std::stringstream ss;
|
||||
|
||||
//ss<<"generation."<<(i)<<".xls";
|
||||
|
||||
//std::ofstream genFile(ss.str().c_str());
|
||||
|
||||
//population.putGeneticStatisticsToStream(genFile);
|
||||
// for(int i = 0; i < individs.size(); i++)
|
||||
// {
|
||||
// std::cout <<"iterate" << i << std::endl;
|
||||
// //fillVectors(individs.at(i)->getGenotype());
|
||||
// std::cout <<"iterate after " << i << std::endl;
|
||||
// }
|
||||
|
||||
}
|
||||
19
DEC_GUI/DEC-0.0/processor/Processor.h
Normal file
19
DEC_GUI/DEC-0.0/processor/Processor.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include "DEC-0.0/individual/genome/AbstractGenome.h"
|
||||
#include "../population/Population.h"
|
||||
|
||||
class Processor{
|
||||
|
||||
public:
|
||||
static void test(/*int, int*/);
|
||||
static void test01(/*int, int*/);
|
||||
|
||||
static void testInOutBreeding01();
|
||||
static void testInOutBreeding02();
|
||||
static void fillVectors(Genotype *g);
|
||||
static void fillVectors(const Genotype& g);
|
||||
static void evolution(int generations);
|
||||
|
||||
static AsexualPopulation* popul;
|
||||
static std::vector<Individual*> individs;
|
||||
};
|
||||
228
DEC_GUI/DEC-0.0/processor/Settings.cpp
Normal file
228
DEC_GUI/DEC-0.0/processor/Settings.cpp
Normal file
@@ -0,0 +1,228 @@
|
||||
#include "Settings.h"
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstdio>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <QVector>
|
||||
#include <qmath.h>
|
||||
|
||||
#ifdef LINUX
|
||||
#define sscanf_s sscanf
|
||||
#endif
|
||||
|
||||
#define sscanf_s sscanf
|
||||
|
||||
// Default parameters
|
||||
bool Settings::WRITE_FULL_STATISTICS_TO_FILE = false;
|
||||
|
||||
int Settings::Iterations = 10;
|
||||
long int Settings::InitPopSize = 10;
|
||||
float Settings::InitRatioBetweenPops = 1.f;
|
||||
|
||||
|
||||
double Settings::BirthRate = 0.01;
|
||||
double Settings::NaturalDeathRate = 0.01;
|
||||
|
||||
long int Settings::KMaxParameter = 10000;
|
||||
|
||||
int Settings::OffspringsMean = 3;
|
||||
float Settings::CoadaptiveThreshold = 0;
|
||||
float Settings::CoadaptiveMinimumP = 0.2f;
|
||||
float Settings::CoadaptiveMaximumTrait = 15.f;
|
||||
|
||||
float Settings::DiseaseThreshold = 1;
|
||||
std::string Settings::CoadaptiveGenesInteraction = "onechromosome";
|
||||
std::string Settings::DiseaseGenesInteraction = "add";
|
||||
|
||||
|
||||
std::string Settings::BreedingStrategy = "default";
|
||||
std::string Settings::GenToPhenStrategy = "default";
|
||||
std::string Settings::PhenToFitStrategy = "default";
|
||||
std::string Settings::RecombinationStrategy = "default";
|
||||
|
||||
double Settings::ProbMtDNARecomb = 0.0;
|
||||
int Settings::PopulationHomoInitSize = 1000;
|
||||
int Settings::PopulationAncientInitSize = 1000;
|
||||
double Settings::migrationPartHomoToAncient = 0.1;
|
||||
double Settings::migrationPartAncientToHomo = 0.1;
|
||||
int Settings::generationsPerMigration = 100;
|
||||
int Settings::locusLength = 60;
|
||||
double Settings::percentDiffLoci = 0.1;
|
||||
int Settings::numLoci = 50;
|
||||
// (END) Default parameters
|
||||
int Settings::globalGenerations;
|
||||
int Settings::maxYval;
|
||||
int Settings::minYval;
|
||||
QVector<double> Settings::homoCommonSize;
|
||||
QVector<double> Settings::homoFemaleSize;
|
||||
QVector<double> Settings::homoMaleSize;
|
||||
QVector<double> Settings::ancientCommonSize;
|
||||
QVector<double> Settings::ancientFemaleSize;
|
||||
QVector<double> Settings::ancientMaleSize;
|
||||
QVector<double> Settings::generations;
|
||||
|
||||
std::vector<std::string> Settings::initMtDNA;
|
||||
std::vector<std::string> Settings::initMtDNA_ancient;
|
||||
std::vector<std::string> Settings::calcScript;
|
||||
|
||||
QVector<QVector<double> > Settings::malesGene;
|
||||
QVector<QVector<double> > Settings::femalesGene;
|
||||
QVector<std::string> Settings::geneName;
|
||||
|
||||
|
||||
void Settings::initGUIvect()
|
||||
{
|
||||
// Settings::globalGenerations = 1;
|
||||
// Settings::maxYval = 0;
|
||||
// Settings::minYval = 0;
|
||||
// Settings::homoCommonSize.clear();
|
||||
// Settings::homoFemaleSize.clear();
|
||||
// Settings::homoMaleSize.clear();
|
||||
// Settings::ancientCommonSize.clear();
|
||||
// Settings::ancientFemaleSize.clear();
|
||||
// Settings::ancientMaleSize.clear();
|
||||
// Settings::generations.clear();
|
||||
|
||||
// Settings::initMtDNA.clear();
|
||||
// Settings::initMtDNA_ancient.clear();
|
||||
// Settings::calcScript.clear();
|
||||
|
||||
Settings::generations.push_back(0);
|
||||
|
||||
Settings::homoCommonSize.push_back(Settings::PopulationHomoInitSize);
|
||||
Settings::homoFemaleSize.push_back(Settings::PopulationHomoInitSize / 2);
|
||||
Settings::homoMaleSize.push_back(Settings::PopulationHomoInitSize / 2);
|
||||
Settings::ancientCommonSize.push_back(Settings::PopulationAncientInitSize);
|
||||
Settings::ancientFemaleSize.push_back(Settings::PopulationAncientInitSize / 2);
|
||||
Settings::ancientMaleSize.push_back(Settings::PopulationAncientInitSize / 2);
|
||||
}
|
||||
|
||||
void Settings::fillVectors(BisexualPopulation* pop_Sapiens, BisexualPopulation* pop_Ancient)
|
||||
{
|
||||
Settings::globalGenerations++;
|
||||
Settings::generations.push_back(Settings::globalGenerations);
|
||||
Settings::ancientCommonSize.push_back(pop_Ancient->females.size() + pop_Ancient->males.size());
|
||||
Settings::homoCommonSize.push_back(pop_Sapiens->females.size() + pop_Sapiens->males.size());
|
||||
Settings::ancientMaleSize.push_back(pop_Ancient->males.size());
|
||||
Settings::ancientFemaleSize.push_back(pop_Ancient->females.size());
|
||||
Settings::homoMaleSize.push_back(pop_Sapiens->males.size());
|
||||
Settings::homoFemaleSize.push_back(pop_Sapiens->females.size());
|
||||
Settings::maxYval = qMax(pop_Ancient->females.size() + pop_Ancient->males.size(), pop_Sapiens->females.size() + pop_Sapiens->males.size());
|
||||
Settings::minYval = qMin(pop_Ancient->females.size() + pop_Ancient->males.size(), pop_Sapiens->females.size() + pop_Sapiens->males.size());
|
||||
}
|
||||
|
||||
void Settings::initScript(std::string fileName){
|
||||
std::vector<std::string> script;
|
||||
std::ifstream file(fileName.c_str());
|
||||
std::string str;
|
||||
|
||||
while(getline(file,str)){
|
||||
if(str.length() > 2)
|
||||
script.push_back(str);
|
||||
}
|
||||
file.close();
|
||||
|
||||
// process Script
|
||||
unsigned int curLine;
|
||||
for(curLine = 0; curLine < script.size(); curLine++){
|
||||
if(script.at(curLine).at(0) == '/' || script.at(curLine).at(0) == '#')
|
||||
continue;
|
||||
|
||||
std::vector<std::string > tokensVector; // Search for tokens
|
||||
boost::split(tokensVector, script.at(curLine), boost::is_any_of("=") );
|
||||
|
||||
std::string instr = tokensVector.at(0);
|
||||
boost::to_lower(instr);
|
||||
boost::trim(instr);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(instr == "fullstat"){
|
||||
int flag = 0;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%d", &flag);
|
||||
if(flag != 0)
|
||||
Settings::WRITE_FULL_STATISTICS_TO_FILE = true;
|
||||
}
|
||||
else if(instr == "generations" || instr == "iterations" ){
|
||||
int iter = Settings::Iterations;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%d", &iter);
|
||||
Settings::Iterations = iter;
|
||||
}
|
||||
else if(instr == "initpopsize" || instr == "init_pop_size" || instr == "popsize" ){
|
||||
long int size = Settings::InitPopSize;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%ld", &size);
|
||||
Settings::InitPopSize = size;
|
||||
}
|
||||
else if(instr == "initratio" || instr == "init_ratio" || instr == "init_ratio_between_pop_size" ){
|
||||
float size = Settings::InitRatioBetweenPops;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%f", &size);
|
||||
Settings::InitRatioBetweenPops = size;
|
||||
}
|
||||
else if(instr == "birth" || instr == "birthrate" || instr == "birth_rate" ){
|
||||
double rate = Settings::BirthRate;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%lg", &rate);
|
||||
Settings::BirthRate = rate;
|
||||
}
|
||||
else if(instr == "death" || instr == "deathrate" || instr == "death_rate" ){
|
||||
double rate = Settings::NaturalDeathRate;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%lg", &rate);
|
||||
Settings::NaturalDeathRate = rate;
|
||||
}
|
||||
else if(instr == "kmax"){
|
||||
long int kMax = Settings::KMaxParameter;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%ld", &kMax);
|
||||
Settings::KMaxParameter = kMax;
|
||||
}
|
||||
else if(instr == "offsprings" || instr == "offsprings_mean" ){
|
||||
int offsprings = Settings::OffspringsMean;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%d", &offsprings);
|
||||
Settings::OffspringsMean = offsprings;
|
||||
}
|
||||
else if(instr == "coadaptivet" || instr == "coadaptive_threshold" ){
|
||||
float coadaptive = Settings::CoadaptiveThreshold;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%f", &coadaptive);
|
||||
Settings::CoadaptiveThreshold = coadaptive;
|
||||
}
|
||||
else if(instr == "coadaptivemax" || instr == "coadaptive_maximum_trait" ){
|
||||
float coadaptive = Settings::CoadaptiveMaximumTrait;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%f", &coadaptive);
|
||||
Settings::CoadaptiveMaximumTrait = coadaptive;
|
||||
}
|
||||
else if(instr == "coadaptivemin" || instr == "coadaptive_minimum_p" ){
|
||||
float coadaptive = Settings::CoadaptiveMinimumP;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%f", &coadaptive);
|
||||
Settings::CoadaptiveMinimumP = coadaptive;
|
||||
}
|
||||
else if(instr == "diseaset" || instr == "disease_threshold" ){
|
||||
float disease = Settings::DiseaseThreshold;
|
||||
sscanf_s(tokensVector.at(1).c_str(),"%f", &disease);
|
||||
Settings::DiseaseThreshold = disease;
|
||||
}
|
||||
else if(instr == "coadaptivegenesinteract" || instr == "cgi"){
|
||||
//long int kMax = Settings::KMaxParameter;
|
||||
//sscanf_s(tokensVector.at(1).c_str(),"%ld", &kMax);
|
||||
std::string cgi = tokensVector.at(1);
|
||||
boost::to_lower(cgi);
|
||||
boost::trim(cgi);
|
||||
Settings::CoadaptiveGenesInteraction = cgi;
|
||||
}
|
||||
else if(instr == "diseasegenesinteract" || instr == "dgi"){
|
||||
//long int kMax = Settings::KMaxParameter;
|
||||
//sscanf_s(tokensVector.at(1).c_str(),"%ld", &kMax);
|
||||
std::string dgi = tokensVector.at(1);
|
||||
boost::to_lower(dgi);
|
||||
boost::trim(dgi);
|
||||
Settings::DiseaseGenesInteraction = dgi;
|
||||
}
|
||||
//*****************************
|
||||
else if(instr == "breedings"){
|
||||
//long int kMax = Settings::KMaxParameter;
|
||||
//sscanf_s(tokensVector.at(1).c_str(),"%ld", &kMax);
|
||||
std::string strategy = tokensVector.at(1);
|
||||
boost::to_lower(strategy);
|
||||
boost::trim(strategy);
|
||||
Settings::BreedingStrategy = strategy;
|
||||
}
|
||||
} // (END) for(curLine = 0; curLine < script.size(); curLine++)
|
||||
}
|
||||
69
DEC_GUI/DEC-0.0/processor/Settings.h
Normal file
69
DEC_GUI/DEC-0.0/processor/Settings.h
Normal file
@@ -0,0 +1,69 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <QVector>
|
||||
#include "DEC-0.0/population/Population.h"
|
||||
|
||||
class Settings {
|
||||
public:
|
||||
static bool WRITE_FULL_STATISTICS_TO_FILE;
|
||||
|
||||
static int Iterations;
|
||||
static long int InitPopSize;
|
||||
static float InitRatioBetweenPops;
|
||||
|
||||
// Common breeding strategies parameters
|
||||
static double BirthRate;
|
||||
static double NaturalDeathRate;
|
||||
|
||||
// Verhulst breeding strategy default parameters
|
||||
static long int KMaxParameter; // r*X*(1 - X/KMax)
|
||||
|
||||
// Inbreeding/Outbreeding model parameters
|
||||
static int OffspringsMean;
|
||||
static float CoadaptiveThreshold;
|
||||
static float CoadaptiveMinimumP;
|
||||
static float CoadaptiveMaximumTrait;
|
||||
static float DiseaseThreshold;
|
||||
static std::string CoadaptiveGenesInteraction;
|
||||
static std::string DiseaseGenesInteraction;
|
||||
|
||||
static std::string BreedingStrategy;
|
||||
static std::string GenToPhenStrategy;
|
||||
static std::string PhenToFitStrategy;
|
||||
static std::string RecombinationStrategy;
|
||||
|
||||
static double ProbMtDNARecomb;
|
||||
static int PopulationHomoInitSize;
|
||||
static int PopulationAncientInitSize;
|
||||
static double migrationPartHomoToAncient;
|
||||
static double migrationPartAncientToHomo;
|
||||
static int generationsPerMigration;
|
||||
static int locusLength;
|
||||
static double percentDiffLoci;
|
||||
static int numLoci;
|
||||
|
||||
static QVector<double> generations;
|
||||
static QVector<double> ancientCommonSize;
|
||||
static QVector<double> homoCommonSize;
|
||||
static QVector<double> ancientMaleSize;
|
||||
static QVector<double> ancientFemaleSize;
|
||||
static QVector<double> homoMaleSize;
|
||||
static QVector<double> homoFemaleSize;
|
||||
static int globalGenerations;
|
||||
static int maxYval;
|
||||
static int minYval;
|
||||
|
||||
static std::vector<std::string> initMtDNA;
|
||||
static std::vector<std::string> initMtDNA_ancient;
|
||||
static std::vector<std::string> calcScript;
|
||||
|
||||
static QVector<QVector<double> > malesGene;
|
||||
static QVector<QVector<double> > femalesGene;
|
||||
static QVector<std::string> geneName;
|
||||
|
||||
|
||||
public:
|
||||
static void initScript(std::string fileName);
|
||||
static void initGUIvect();
|
||||
static void fillVectors(BisexualPopulation* pop_Sapiens, BisexualPopulation* pop_Ancient);
|
||||
};
|
||||
44
DEC_GUI/DEC-0.0/script.txt
Normal file
44
DEC_GUI/DEC-0.0/script.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
## <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>: ## <20> <20><><EFBFBD><EFBFBD><EFBFBD>: //
|
||||
|
||||
## <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
pop_homo_init = 5000
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
pop_ancient_init = 5000
|
||||
|
||||
// <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
generations_per_migration = 100
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
migr_homo_ancient_ratio = 0.1
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
migr_ancient_homo_ratio = 0.1
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
birthrate = 0.1
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
deathrate = 0.095
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
num_loci = 50
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
percent_diff_loci = 0.1
|
||||
|
||||
model_start
|
||||
## <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
evolution = 200
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20> generations_per_migration <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// migr_homo_ancient_ratio <20> migr_ancient_homo_ratio (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>)
|
||||
evolution_m = 1000
|
||||
|
||||
// <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 20% <20><><EFBFBD><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><EFBFBD><EFBFBD> 30% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
migration = 0.2 0.3
|
||||
|
||||
evolution = 1000
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
147
DEC_GUI/DEC_GUI.pro
Normal file
147
DEC_GUI/DEC_GUI.pro
Normal file
@@ -0,0 +1,147 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2014-12-16T10:44:35
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||
|
||||
TARGET = DEC_GUI
|
||||
TEMPLATE = app
|
||||
DEFINES -= UNICODE DEFINES += _MBCS DEFINES += BOOST_SYSTEM_USE_LIB DEFINES += BOOST_FILESYSTEM_USE_LIB
|
||||
|
||||
|
||||
INCLUDEPATH += C:/Data/boost_1_55_0
|
||||
LIBPATH += C:/Data/boost_1_55_0/stage/lib
|
||||
|
||||
LIBS += -lboost_filesystem-mgw48-mt-s-1_55 -lboost_system-mgw48-mt-s-1_55
|
||||
|
||||
|
||||
SOURCES += main.cpp\
|
||||
mainwindow.cpp \
|
||||
DEC-0.0/DerevyankoReport.cpp \
|
||||
DEC-0.0/DerevyankoReport2014.cpp \
|
||||
DEC-0.0/environment/Environment.cpp \
|
||||
DEC-0.0/environment/Region.cpp \
|
||||
DEC-0.0/individual/genome/strategies/InOutBreeding/InOutBreedingPhenToFitStrategy.cpp \
|
||||
DEC-0.0/individual/genome/strategies/InOutBreeding/InOutBreedingPopulationBreedingStrategy.cpp \
|
||||
DEC-0.0/individual/genome/strategies/InOutBreeding/InOutBreeginGenToPhenStrategy.cpp \
|
||||
DEC-0.0/individual/genome/strategies/KolchShindyal/KolchShindyalBreedingStrategy.cpp \
|
||||
DEC-0.0/individual/genome/strategies/KolchShindyal/KolchShindyalGenotypeToPhenotypeStrategy.cpp \
|
||||
DEC-0.0/individual/genome/strategies/KolchShindyal/KolchShindyalPhenToFitnessStrategy.cpp \
|
||||
DEC-0.0/individual/genome/strategies/ChromosomeRearrangementStrategy.cpp \
|
||||
DEC-0.0/individual/genome/strategies/GenotypeToPhenotypeStrategy.cpp \
|
||||
DEC-0.0/individual/genome/strategies/PhenotypeToFitnessStrategy.cpp \
|
||||
DEC-0.0/individual/genome/Chromosome.cpp \
|
||||
DEC-0.0/individual/genome/Gene.cpp \
|
||||
DEC-0.0/individual/genome/Genotype.cpp \
|
||||
DEC-0.0/individual/Individual.cpp \
|
||||
DEC-0.0/individual/InnerSubstratesPool.cpp \
|
||||
DEC-0.0/individual/Phenotype.cpp \
|
||||
DEC-0.0/individual/Trait.cpp \
|
||||
DEC-0.0/population/BreedingStrategies/NeutralEvolutionBreedStrat.cpp \
|
||||
DEC-0.0/population/BreedingStrategies/PopulationBreedingStrategy.cpp \
|
||||
DEC-0.0/population/BreedingStrategies/VerhulstBreedingStrategy.cpp \
|
||||
DEC-0.0/population/BisexualPopulation.cpp \
|
||||
DEC-0.0/population/Population.cpp \
|
||||
DEC-0.0/processor/KolchShindyalov.cpp \
|
||||
DEC-0.0/processor/Processor.cpp \
|
||||
DEC-0.0/processor/Settings.cpp \
|
||||
createdialogs.cpp \
|
||||
Kolch_Shind/createrangedialog.cpp \
|
||||
Kolch_Shind/history.cpp \
|
||||
Kolch_Shind/Individ.cpp \
|
||||
Kolch_Shind/paintqwidget.cpp \
|
||||
Kolch_Shind/qcustomplot.cpp \
|
||||
Kolch_Shind/solver.cpp \
|
||||
kolchshindwindow.cpp \
|
||||
Agressor/agent.cpp \
|
||||
Agressor/agentitem.cpp \
|
||||
Agressor/aphistory.cpp \
|
||||
Agressor/manager.cpp \
|
||||
Agressor/manageritem.cpp \
|
||||
Agressor/model.cpp \
|
||||
derrep2014window.cpp \
|
||||
derrep2014qplot.cpp \
|
||||
derreprfbr2013window.cpp \
|
||||
breedingwindow.cpp \
|
||||
derrep2013qplot.cpp \
|
||||
breedqplot.cpp
|
||||
|
||||
|
||||
HEADERS += mainwindow.h \
|
||||
DEC-0.0/DerevyankoReport.h \
|
||||
DEC-0.0/DerevyankoReport2014.h \
|
||||
DEC-0.0/environment/AbstractEnvironment.h \
|
||||
DEC-0.0/environment/AbstractRegion.h \
|
||||
DEC-0.0/individual/genome/strategies/InOutBreeding/InOutBreedingPhenToFitStrategy.h \
|
||||
DEC-0.0/individual/genome/strategies/InOutBreeding/InOutBreedingPopulationBreedingStrategy.h \
|
||||
DEC-0.0/individual/genome/strategies/KolchShindyal/KolchShindyalBreedingStrategy.h \
|
||||
DEC-0.0/individual/genome/strategies/KolchShindyal/KolchShindyalGenotypeToPhenotypeStrategy.h \
|
||||
DEC-0.0/individual/genome/strategies/KolchShindyal/KolchShindyalPhenToFitnessStrategy.h \
|
||||
DEC-0.0/individual/genome/strategies/ChromosomeRearrangementStrategy.h \
|
||||
DEC-0.0/individual/genome/strategies/GenotypeToPhenotypeStrategy.h \
|
||||
DEC-0.0/individual/genome/strategies/PhenotypeToFitnessStrategy.h \
|
||||
DEC-0.0/individual/genome/AbstractGenome.h \
|
||||
DEC-0.0/individual/genome/Chromosome.h \
|
||||
DEC-0.0/individual/genome/Gene.h \
|
||||
DEC-0.0/individual/AbstractIndividual.h \
|
||||
DEC-0.0/individual/InnerSubstratesPool.h \
|
||||
DEC-0.0/individual/Phenotype.h \
|
||||
DEC-0.0/individual/Trait.h \
|
||||
DEC-0.0/population/BreedingStrategies/NeutralEvolutionBreedStrat.h \
|
||||
DEC-0.0/population/BreedingStrategies/PopulationBreedingStrategy.h \
|
||||
DEC-0.0/population/BreedingStrategies/VerhulstBreedingStrategy.h \
|
||||
DEC-0.0/population/Population.h \
|
||||
DEC-0.0/processor/KolchShindyalov.h \
|
||||
DEC-0.0/processor/Processor.h \
|
||||
DEC-0.0/processor/Settings.h \
|
||||
createdialogs.h \
|
||||
Kolch_Shind/constants.h \
|
||||
Kolch_Shind/createrangedialog.h \
|
||||
Kolch_Shind/history.h \
|
||||
Kolch_Shind/Individ.h \
|
||||
Kolch_Shind/paintqwidget.h \
|
||||
Kolch_Shind/qcustomplot.h \
|
||||
Kolch_Shind/solver.h \
|
||||
kolchshindwindow.h \
|
||||
Agressor/agent.h \
|
||||
Agressor/agentitem.h \
|
||||
Agressor/aphistory.h \
|
||||
Agressor/manager.h \
|
||||
Agressor/manageritem.h \
|
||||
Agressor/model.h \
|
||||
derrep2014window.h \
|
||||
derrep2014qplot.h \
|
||||
derreprfbr2013window.h \
|
||||
breedingwindow.h \
|
||||
derrep2013qplot.h \
|
||||
breedqplot.h
|
||||
|
||||
|
||||
FORMS += mainwindow.ui \
|
||||
kolchshindwindow.ui \
|
||||
derrep2014window.ui \
|
||||
derreprfbr2013window.ui \
|
||||
breedingwindow.ui
|
||||
|
||||
OTHER_FILES += \
|
||||
DEC-0.0/1.xls \
|
||||
DEC-0.0/DEC-0.0.vcproj \
|
||||
DEC-0.0/DEC-0.0.vcproj.NEPTUNE.lashin.user \
|
||||
DEC-0.0/DEC-0.0.vcproj.neptune2010.lashin.user \
|
||||
DEC-0.0/DEC-0.0.vcproj.ROCKWOOD.Family.user \
|
||||
DEC-0.0/DEC-0.0.vcproj.Rockwood.rock.user \
|
||||
DEC-0.0/DEC-0.0.vcproj.rockwood.Sergey.user \
|
||||
DEC-0.0/DEC-0.0.vcxproj \
|
||||
DEC-0.0/DEC-0.0.vcxproj.filters \
|
||||
DEC-0.0/DecScript.txt \
|
||||
DEC-0.0/generation.0.xls \
|
||||
DEC-0.0/generation.1.xls \
|
||||
DEC-0.0/generation.2.xls \
|
||||
DEC-0.0/generation.3.xls \
|
||||
DEC-0.0/generation.4.xls \
|
||||
DEC-0.0/script.txt \
|
||||
DEC-0.0/ToDoList.txt
|
||||
259
DEC_GUI/DEC_GUI.pro.user
Normal file
259
DEC_GUI/DEC_GUI.pro.user
Normal file
@@ -0,0 +1,259 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 3.4.0, 2016-01-05T21:27:27. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{d44007c9-c0eb-44ed-9384-5031df6de3df}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap"/>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.3 MinGW 32bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.3 MinGW 32bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.53.win32_mingw482_kit</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">H:/YaDisk/Src/DEC_GUI/build-DEC_GUI-Desktop_Qt_5_3_MinGW_32bit-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Отладка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">H:/YaDisk/Src/DEC_GUI/build-DEC_GUI-Desktop_Qt_5_3_MinGW_32bit-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Выпуск</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Установка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Локальная установка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">DEC_GUI</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:H:/YaDisk/Src/DEC_GUI/DEC_GUI/DEC_GUI.pro</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">DEC_GUI.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">18</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">18</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
440
DEC_GUI/DEC_GUI.pro.user.3d340fe.3.3-pre1
Normal file
440
DEC_GUI/DEC_GUI.pro.user.3d340fe.3.3-pre1
Normal file
@@ -0,0 +1,440 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 3.2.2, 2014-12-24T17:04:04. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{3d340fed-eb20-4be3-a608-75ed758b9040}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">windows-1251</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap"/>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.3 MinGW 32bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.3 MinGW 32bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.53.win32_mingw482_kit</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/DEC_GUI/build-DEC_GUI-Desktop_Qt_5_3_MinGW_32bit-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Data/build-DEC_GUI-Desktop_Qt_5_3_MinGW_32bit-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">DEC_GUI</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/DEC_GUI/DEC_GUI/DEC_GUI.pro</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">DEC_GUI.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.1</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Static MinGW48</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Static MinGW48</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{f493523b-7d44-46aa-8881-694dd976dae1}</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/DEC_GUI/Static_build</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Data/build-DEC_GUI-Static_MinGW48-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">DEC_GUI</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/DEC_GUI/DEC_GUI/DEC_GUI.pro</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">DEC_GUI.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">2</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">16</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">16</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
257
DEC_GUI/DEC_GUI.pro.user.cee8215
Normal file
257
DEC_GUI/DEC_GUI.pro.user.cee8215
Normal file
@@ -0,0 +1,257 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 3.3.0, 2015-08-14T16:41:46. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{cee82155-51cf-4832-9c30-8f50f9bc43af}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap"/>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.4.0 MinGW 32bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.4.0 MinGW 32bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.54.win32_mingw491_kit</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/YaDisk/Src/DEC_GUI/build-DEC_GUI-Desktop_Qt_5_4_0_MinGW_32bit-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Отладка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/YaDisk/Src/DEC_GUI/build-DEC_GUI-Desktop_Qt_5_4_0_MinGW_32bit-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Выпуск</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Установка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Локальная установка</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">DEC_GUI</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:F:/YaDisk/Src/DEC_GUI/DEC_GUI/DEC_GUI.pro</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">DEC_GUI.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">18</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">18</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
71
DEC_GUI/Kolch_Shind/Individ.cpp
Normal file
71
DEC_GUI/Kolch_Shind/Individ.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#include "Individ.h"
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <cmath>
|
||||
|
||||
float Individ::sigmaX = 1.f;
|
||||
float Individ::sigmaE = 0.1f;
|
||||
float Individ::sigmaC1 = 1.f;
|
||||
float Individ::sigmaC2 = 1.f;
|
||||
float Individ::sigmaC3= 1.f;
|
||||
float Individ::sigmaC4= 1.f;
|
||||
float Individ::sigmaC5= 1.f;
|
||||
float Individ::Xopt = 110.f;
|
||||
std::vector<float> Individ::c(5);
|
||||
|
||||
Individ::Individ(float _E) : E(_E) {};
|
||||
IndividFeedBack::IndividFeedBack(float _E) : Individ(_E), C2(Individ::c[1]) {}
|
||||
//IndividFeedBack(const IndividFeedBack& parent) : Individ(parent.E), C2(parent.C2) {}
|
||||
|
||||
float Individ::getFitness() const {
|
||||
float X = c[0]/c[2] * (E+c[3]);
|
||||
float fitness = 1/(sqrt(2*M_PI)) * exp(-0.5*pow((X-Xopt)/sigmaX,2.f));
|
||||
return fitness;
|
||||
}
|
||||
|
||||
float IndividFeedBack::getFitness() const {
|
||||
//float X = -c[1]/2 + sqrt( c[1]*c[1]/4 + c[4]*c[1]/c[2]*(E+c[3]));
|
||||
float X = -C2/2 + sqrt( C2*C2/4 + c[4]*C2/c[2]*(E+c[3]));
|
||||
float fitness = 1/(sqrt(2*M_PI)) * exp(-0.5*pow((X-Xopt)/sigmaX,2.f));
|
||||
return fitness;
|
||||
}
|
||||
|
||||
void Individ::initConstants(){
|
||||
c[0] = 10.f;
|
||||
c[1] = 100.f;
|
||||
c[2] = 1.f;
|
||||
c[3] = 1.f;
|
||||
c[4] = 21.f;
|
||||
Xopt = 110.f;
|
||||
sigmaX = 1.f;
|
||||
sigmaE = 0.1f;
|
||||
}
|
||||
|
||||
void Individ::initConstantsFromGUI(float c1, float c2, float c3, float c4, float c5, float Xoptim, float sigX, float sigE, float sigC1, float sigC2,
|
||||
float sigC3, float sigC4, float sigC5)
|
||||
{
|
||||
c[0] = c1;
|
||||
c[1] = c2;
|
||||
c[2] = c3;
|
||||
c[3] = c4;
|
||||
c[4] = c5;
|
||||
Xopt = Xoptim;
|
||||
sigmaX = sigX;
|
||||
sigmaE = sigE;
|
||||
sigmaC1 = sigC1;
|
||||
sigmaC2 = sigC2;
|
||||
sigmaC3 = sigC3;
|
||||
sigmaC4 = sigC4;
|
||||
sigmaC5 = sigC5;
|
||||
}
|
||||
|
||||
float IndividFeedBack::getOptimalE(){
|
||||
float a = (Xopt + c[1]/2)*(Xopt + c[1]/2);
|
||||
float b = c[1]*c[1]/4;
|
||||
|
||||
float ans = (a-b)*c[2]/(c[4]*c[1]) - c[3];
|
||||
return ans;
|
||||
}
|
||||
|
||||
bool compareOnFitness(const Individ* a, const Individ* b){
|
||||
return a->getFitness() < b->getFitness();
|
||||
}
|
||||
39
DEC_GUI/Kolch_Shind/Individ.h
Normal file
39
DEC_GUI/Kolch_Shind/Individ.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
class Individ {
|
||||
protected:
|
||||
float E;
|
||||
public:
|
||||
static std::vector<float> c;
|
||||
static float Xopt, sigmaX, sigmaE, sigmaC1, sigmaC2, sigmaC3, sigmaC4, sigmaC5;
|
||||
static void initConstants();
|
||||
static void initConstantsFromGUI(float c1, float c2, float c3, float c4, float c5, float Xoptim, float sigX, float sigE, float sigC1, float sigC2,
|
||||
float sigC3, float sigC4, float sigC5);
|
||||
|
||||
Individ(float _E);
|
||||
//virtual Individ~();
|
||||
float getE() const { return E;}
|
||||
virtual float getFitness() const;
|
||||
virtual bool hasFeedBack() const {return false;}
|
||||
virtual void mutate (float deltaE) { E += deltaE;}
|
||||
virtual void mutateC2(float deltaC2) {}
|
||||
virtual void setC2(float v){}
|
||||
virtual float getC2() const { return c[1];}
|
||||
static float getOptimalE() { return Xopt*c[2]/c[0] - c[3];}
|
||||
};
|
||||
|
||||
class IndividFeedBack : public Individ {
|
||||
float C2;
|
||||
public:
|
||||
IndividFeedBack(float _E);
|
||||
IndividFeedBack(const IndividFeedBack& parent);
|
||||
virtual float getFitness() const;
|
||||
virtual bool hasFeedBack() const {return true;}
|
||||
virtual void mutateC2(float deltaC2) { this->C2 += deltaC2;}
|
||||
static float getOptimalE();
|
||||
virtual void setC2(float v){ this->C2 = v;}
|
||||
virtual float getC2() const { return this->C2;}
|
||||
};
|
||||
|
||||
bool compareOnFitness(const Individ* a, const Individ* b);
|
||||
10
DEC_GUI/Kolch_Shind/constants.h
Normal file
10
DEC_GUI/Kolch_Shind/constants.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
|
||||
namespace
|
||||
{
|
||||
static const int WIDGET_XT = 1;
|
||||
static const int WIDGET_XY = 2;
|
||||
}
|
||||
|
||||
#endif // CONSTANTS_H
|
||||
44
DEC_GUI/Kolch_Shind/createrangedialog.cpp
Normal file
44
DEC_GUI/Kolch_Shind/createrangedialog.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "createrangedialog.h"
|
||||
#include "limits.h"
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
#include <QGridLayout>
|
||||
|
||||
CreateRangeDialog::CreateRangeDialog(QWidget *parent, int flag)
|
||||
: QDialog(parent)
|
||||
{
|
||||
|
||||
if (flag == 1) //iterate window
|
||||
{
|
||||
QGridLayout *layout = new QGridLayout(this);
|
||||
|
||||
layout->addWidget(new QLabel(tr("Add new iterations:")), 0, 0);
|
||||
iterations = new QLineEdit;
|
||||
layout->addWidget(iterations, 0, 1);
|
||||
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||
layout->addLayout(buttonLayout, 1, 0, 1, 0);
|
||||
buttonLayout->addStretch();
|
||||
|
||||
QPushButton *cancelButton = new QPushButton(tr("Cancel"));
|
||||
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
buttonLayout->addWidget(cancelButton);
|
||||
QPushButton *okButton = new QPushButton(tr("OK"));
|
||||
connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
|
||||
buttonLayout->addWidget(okButton);
|
||||
|
||||
okButton->setDefault(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QString CreateRangeDialog::iterField()
|
||||
{
|
||||
return iterations->text();
|
||||
}
|
||||
|
||||
|
||||
33
DEC_GUI/Kolch_Shind/createrangedialog.h
Normal file
33
DEC_GUI/Kolch_Shind/createrangedialog.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef CREATERANGEDIALOG_H
|
||||
#define CREATERANGEDIALOG_H
|
||||
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QComboBox>
|
||||
#include <QTextEdit>
|
||||
#include <QDialog>
|
||||
#include <QSpinBox>
|
||||
#include <QCheckBox>
|
||||
#include "constants.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CreateRangeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CreateRangeDialog(QWidget *parent, int flag);
|
||||
QString iterField();
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
private:
|
||||
QLineEdit *iterations;
|
||||
|
||||
};
|
||||
|
||||
#endif // CREATERANGEDIALOG_H
|
||||
16
DEC_GUI/Kolch_Shind/history.cpp
Normal file
16
DEC_GUI/Kolch_Shind/history.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "history.h"
|
||||
|
||||
History::History()
|
||||
{
|
||||
}
|
||||
|
||||
QVector <data> History::getAllHistory()
|
||||
{
|
||||
return singleModelHistory;
|
||||
}
|
||||
|
||||
data History::getSingleModelHistory(int i)
|
||||
{
|
||||
return singleModelHistory[i];
|
||||
}
|
||||
|
||||
33
DEC_GUI/Kolch_Shind/history.h
Normal file
33
DEC_GUI/Kolch_Shind/history.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef HISTORY_H
|
||||
#define HISTORY_H
|
||||
|
||||
#include <QVector>
|
||||
|
||||
struct data{
|
||||
|
||||
QVector<double> withFeedbackVect;
|
||||
QVector<double> withoutFeedbackVect;
|
||||
QVector<double> firstXVect;
|
||||
|
||||
QVector<double> meanE;
|
||||
QVector<double> meanF;
|
||||
QVector<double> meanC2;
|
||||
QVector<double> individ;
|
||||
QVector<double> individFeedback;
|
||||
};
|
||||
|
||||
class History
|
||||
{
|
||||
public:
|
||||
History();
|
||||
QVector <data> getAllHistory();
|
||||
data getSingleModelHistory(int i);
|
||||
|
||||
data vectors;
|
||||
QVector <data> singleModelHistory;
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // HISTORY_H
|
||||
119
DEC_GUI/Kolch_Shind/paintqwidget.cpp
Normal file
119
DEC_GUI/Kolch_Shind/paintqwidget.cpp
Normal file
@@ -0,0 +1,119 @@
|
||||
#include "paintqwidget.h"
|
||||
#include "constants.h"
|
||||
|
||||
static const int DEFAULT_IMAGE_HEIGHT = 550;
|
||||
static const int DEFAULT_IMAGE_WIDTH = 800;
|
||||
static const int AXIS_DASH_STEP = 50;
|
||||
static const int INDENT_STEP = 50;
|
||||
static const int TOP_OFFSET = 100;
|
||||
|
||||
PaintQWidget::PaintQWidget(QWidget *parent) :
|
||||
QWidget(parent), image(DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, QImage::Format_RGB888)
|
||||
{
|
||||
|
||||
connect(&solver, SIGNAL(sendHistory(QVector<dataSet>, int)), SLOT(setHistory(QVector<dataSet>, int)));
|
||||
connect(&solver, SIGNAL(sendItersForProgressBar(int)), SLOT(setItersForProgressBar(int)));
|
||||
image.fill(QColor(Qt::white).rgb());
|
||||
|
||||
}
|
||||
|
||||
void PaintQWidget::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.drawImage(0, 0, image);
|
||||
}
|
||||
|
||||
|
||||
void PaintQWidget::setHistory(QVector<dataSet> history, int iters)
|
||||
{
|
||||
hist = history;
|
||||
maxIters = iters;
|
||||
}
|
||||
|
||||
void PaintQWidget::setItersForProgressBar(int iters)
|
||||
{
|
||||
resentItersToProgressBar(iters); //cause I can't send it direct from the solver =(
|
||||
//std::cout << iters << std::endl;
|
||||
}
|
||||
|
||||
void PaintQWidget::drawSelectedModel(int wgt_type, QCustomPlot *pPlot, int model_num)
|
||||
{
|
||||
//std::cout << model_num << std::endl;
|
||||
if (model_num != -1)
|
||||
{
|
||||
draw(pPlot, wgt_type, model_num);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//draw graphics
|
||||
void PaintQWidget::draw(QCustomPlot *customPlot, int wgt_type, int model_num)
|
||||
{
|
||||
//std::cout << model_num << std::endl;
|
||||
if (wgt_type == WIDGET_XT)
|
||||
{
|
||||
customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
||||
customPlot->graph(0)->setData(hist[model_num].xRange, hist[model_num].withFeedbackVect);
|
||||
customPlot->graph(0)->setPen(QPen(Qt::blue));
|
||||
customPlot->graph(0)->setName("withFeedback");
|
||||
customPlot->graph(1)->setData(hist[model_num].xRange, hist[model_num].withoutFeedbackVect);
|
||||
customPlot->graph(1)->setPen(QPen(Qt::red));
|
||||
customPlot->graph(1)->setName("withoutFeedback");
|
||||
customPlot->xAxis->setRange(0, maxIters);
|
||||
//std::cout << maxIters << std::endl;
|
||||
customPlot->xAxis->setLabel("Iterations");
|
||||
customPlot->yAxis->setLabel("Feedbacks");
|
||||
customPlot->yAxis->setRange(0, qMax(hist[model_num].maxWithFeedVal, hist[model_num].maxWithoutFeedVal) + TOP_OFFSET);
|
||||
}
|
||||
else if (wgt_type == WIDGET_XY)
|
||||
{
|
||||
customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
||||
customPlot->graph(0)->setName("eMeans");
|
||||
customPlot->graph(0)->setData(hist[model_num].xRange, hist[model_num].meanE);
|
||||
customPlot->graph(0)->setPen(QPen(Qt::red));
|
||||
|
||||
customPlot->graph(1)->setName("fMeans");
|
||||
customPlot->graph(1)->setData(hist[model_num].xRange, hist[model_num].meanF);
|
||||
customPlot->graph(1)->setPen(QPen(Qt::blue));
|
||||
|
||||
customPlot->graph(2)->setName("c2Means");
|
||||
customPlot->graph(2)->setData(hist[model_num].xRange, hist[model_num].meanC2);
|
||||
customPlot->graph(2)->setPen(QPen(Qt::green));
|
||||
|
||||
customPlot->graph(3)->setName("individ");
|
||||
customPlot->graph(3)->setData(hist[model_num].xRange, hist[model_num].individ);
|
||||
customPlot->graph(3)->setPen(QPen(Qt::magenta));
|
||||
|
||||
customPlot->graph(4)->setName("individFeedback");
|
||||
customPlot->graph(4)->setData(hist[model_num].xRange, hist[model_num].individFeedback);
|
||||
customPlot->graph(4)->setPen(QPen(Qt::black));
|
||||
|
||||
customPlot->xAxis->setRange(0, maxIters);
|
||||
//std::cout << maxIters << std::endl;
|
||||
customPlot->xAxis->setLabel("Iterations");
|
||||
customPlot->yAxis->setLabel("Means");
|
||||
customPlot->yAxis->setRange(0, 300);
|
||||
}
|
||||
customPlot->replot();
|
||||
}
|
||||
|
||||
void PaintQWidget::setIters(int flag, int iter)
|
||||
{
|
||||
itersFlag = flag;
|
||||
newIters = iter;
|
||||
}
|
||||
|
||||
void PaintQWidget::drawAll(float c1, float c2, float c3, float c4, float c5, float sigC1, float sigC2, float sigC3, float sigC4, float sigC5,
|
||||
float e, float sigE, float sigX0, float delX0, float sigX, float Xopt, int popSize, int maxSteps, int N,
|
||||
int wgt_type, QCustomPlot* pPlot, int count, int modelCount, int model_num)
|
||||
{
|
||||
|
||||
if (count == 0) // cause solveModel launch two times other way
|
||||
{
|
||||
solver.solveModel(c1, c2, c3, c4, c5, sigC1, sigC2, sigC3, sigC4, sigC5, e, sigE, sigX0, delX0, sigX, Xopt, popSize, maxSteps, N, itersFlag, newIters, modelCount);
|
||||
}
|
||||
|
||||
draw(pPlot, wgt_type, model_num);
|
||||
}
|
||||
|
||||
|
||||
67
DEC_GUI/Kolch_Shind/paintqwidget.h
Normal file
67
DEC_GUI/Kolch_Shind/paintqwidget.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#ifndef PAINTQWIDGET_H
|
||||
#define PAINTQWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QImage>
|
||||
#include <QPainter>
|
||||
#include <qmath.h>
|
||||
#include <QMouseEvent>
|
||||
#include <QVector>
|
||||
#include <iostream>
|
||||
#include "solver.h"
|
||||
#include "qcustomplot.h"
|
||||
|
||||
class PaintQWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PaintQWidget(QWidget *parent = 0);
|
||||
QVector<dataSet> hist;
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
void drawAll(float c1, float c2, float c3, float c4, float c5, float sigC1, float sigC2, float sigC3, float sigC4, float sigC5,
|
||||
float e, float sigE, float sigX0, float delX0, float sigX, float Xopt, int popSize, int maxSteps, int N,
|
||||
int wgt_type, QCustomPlot* pPlot, int count, int modelCount, int model_num);
|
||||
void setIters(int flag, int iter);
|
||||
void setHistory(QVector<dataSet> history, int iters);
|
||||
void drawSelectedModel(int wgt_type, QCustomPlot* pPlot, int model_num);
|
||||
void setItersForProgressBar(int iters);
|
||||
|
||||
signals:
|
||||
void sendHistoryToPrint(QVector<dataSet> history);
|
||||
void resentItersToProgressBar(int iters);
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
void solveModel(int x0, int y0, double a, double b, double c, double d, double h, int t);
|
||||
void draw(QCustomPlot *customPlot, int wgt_type, int model_num);
|
||||
|
||||
QVector<double> withFeed;
|
||||
QVector<double> withoutFeed;
|
||||
|
||||
QVector<double> eMeans;
|
||||
QVector<double> fMeans;
|
||||
QVector<double> c2Means;
|
||||
QVector<double> individ;
|
||||
QVector<double> individFeed;
|
||||
|
||||
|
||||
int newIters;
|
||||
int itersFlag;
|
||||
|
||||
double maxWith;
|
||||
double maxWithout;
|
||||
QVector<double> xVals;
|
||||
QImage image;
|
||||
|
||||
int maxIters;
|
||||
int iters;
|
||||
Solver solver;
|
||||
int runCount;
|
||||
};
|
||||
|
||||
#endif // PAINTQWIDGET_H
|
||||
18671
DEC_GUI/Kolch_Shind/qcustomplot.cpp
Normal file
18671
DEC_GUI/Kolch_Shind/qcustomplot.cpp
Normal file
File diff suppressed because it is too large
Load Diff
3036
DEC_GUI/Kolch_Shind/qcustomplot.h
Normal file
3036
DEC_GUI/Kolch_Shind/qcustomplot.h
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user