Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
FIC_DK_P GA Solving
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
M3TAL
FIC_DK_P GA Solving
Commits
d2ed4754
Commit
d2ed4754
authored
May 05, 2021
by
Alexis Lebis
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'data_export' into 'master'
Data export See merge request
!10
parents
5a789802
9c46eb8b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
158 additions
and
0 deletions
+158
-0
main.cpp
application/main.cpp
+2
-0
competency.cpp
src/model/competency.cpp
+7
-0
competency.h
src/model/competency.h
+2
-0
course.cpp
src/model/course.cpp
+29
-0
course.h
src/model/course.h
+3
-0
magnitude.cpp
src/model/magnitude.cpp
+8
-0
magnitude.h
src/model/magnitude.h
+5
-0
problem.cpp
src/model/problem.cpp
+48
-0
problem.h
src/model/problem.h
+3
-0
profession.cpp
src/model/profession.cpp
+28
-0
profession.h
src/model/profession.h
+2
-0
tools.h
src/model/tools.h
+21
-0
No files found.
application/main.cpp
View file @
d2ed4754
...
...
@@ -329,6 +329,8 @@ int main(int argc, char* argv[]){
if
(
localDisplay
)
{
std
::
cout
<<
exportProblem
(
pb
,
job
)
<<
std
::
endl
;
pb
.
displayDistribution
();
std
::
cout
<<
pb
<<
std
::
endl
;
std
::
cout
<<
job
<<
std
::
endl
;
...
...
src/model/competency.cpp
View file @
d2ed4754
...
...
@@ -153,4 +153,11 @@ std::ostream& operator<<(std::ostream& Stream, const Competency & c)
bool
Competency
::
operator
==
(
const
Competency
&
c
)
const
{
return
(
this
->
_id
==
c
.
id
()
||
(
this
->
_name
.
compare
(
c
.
c_name
())
==
0
)
);
}
std
::
string
Competency
::
exportMe
()
const
{
std
::
string
res
=
"
\"
competency
\"
:{
\"
name
\"
:
\"
"
+
this
->
_name
+
"
\"
,"
+
this
->
_m
.
exportMe
()
+
"}"
;
return
res
;
}
\ No newline at end of file
src/model/competency.h
View file @
d2ed4754
...
...
@@ -93,6 +93,8 @@ class Competency
/// A competency is equal to another iff their id are the same, or their name
bool
operator
==
(
const
Competency
&
c
)
const
;
// === EXPORT
std
::
string
exportMe
()
const
;
};
// === OPERATOR
std
::
ostream
&
operator
<<
(
std
::
ostream
&
Stream
,
const
Competency
&
c
);
...
...
src/model/course.cpp
View file @
d2ed4754
...
...
@@ -288,6 +288,35 @@ bool Course::operator==(const Course & c) const
}
// === END OPERATOR
// === EXPORT
std
::
string
Course
::
exportMe
()
const
{
std
::
string
res
=
"
\"
course
\"
:{
\"
name
\"
:
\"
"
+
this
->
_name
+
"
\"
,
\"
ects
\"
:"
+
std
::
to_string
(
this
->
_ects
);
std
::
string
tmp
=
""
;
res
+=
",
\"
prerequisites
\"
:["
;
for
(
unsigned
int
i
=
0
;
i
<
this
->
_prerequisites
.
size
();
i
++
)
{
tmp
=
this
->
_prerequisites
.
at
(
i
).
exportMe
();
res
+=
"{"
+
tmp
+
"}"
;
if
(
i
<
this
->
_prerequisites
.
size
()
-
1
)
res
+=
","
;
}
res
+=
"]"
;
res
+=
",
\"
competencies
\"
:["
;
for
(
unsigned
int
i
=
0
;
i
<
this
->
_weightedTeached
.
size
();
i
++
)
{
tmp
=
this
->
_weightedTeached
.
at
(
i
).
first
.
exportMe
();
res
+=
"{"
+
tmp
+
"}"
;
if
(
i
<
this
->
_weightedTeached
.
size
()
-
1
)
res
+=
","
;
}
res
+=
"]"
;
res
+=
"}"
;
return
res
;
}
// === STATIC
/// Course counter
...
...
src/model/course.h
View file @
d2ed4754
...
...
@@ -116,6 +116,9 @@ class Course
// === OPERATOR
/// A course is equal to another iff {(lazy_equality) || (full_equality)
bool
operator
==
(
const
Course
&
c
)
const
;
// === EXPORT
std
::
string
exportMe
()
const
;
};
// === OPERATOR
...
...
src/model/magnitude.cpp
View file @
d2ed4754
...
...
@@ -133,4 +133,12 @@ double Magnitude::rebase()
this
->
_value
=
1
;
}
return
this
->
_value
;
}
// EXPORT
std
::
string
Magnitude
::
exportMe
()
const
{
std
::
string
res
=
"
\"
magnitude
\"
:{
\"
value
\"
:"
+
std
::
to_string
(
this
->
_value
)
+
"}"
;
return
res
;
}
\ No newline at end of file
src/model/magnitude.h
View file @
d2ed4754
#ifndef SRC_MAGNITUDE_H_
#define SRC_MAGNITUDE_H_
#include <string>
/** Magnitude represents the mastery of a competency.
*
* It should be used in accordance with a scale
...
...
@@ -34,6 +36,9 @@ class Magnitude
//SETTER
bool
set
(
double
v
);
//EXPORT
std
::
string
exportMe
()
const
;
};
Magnitude
operator
+
(
const
Magnitude
&
m1
,
const
Magnitude
&
m2
);
...
...
src/model/problem.cpp
View file @
d2ed4754
...
...
@@ -595,3 +595,51 @@ std::tuple<int, int, double, double> CSDVP::distributionStats()
return
Stream
;
}
// === END OPERATOR
// === EXPORT
std
::
string
CSDVP
::
exportMe
()
const
{
std
::
string
res
=
"
\"
csdvp
\"
:{"
;
res
+=
"
\"
cfg_seed
\"
:"
+
std
::
to_string
(
this
->
_seed
)
+
","
;
res
+=
"
\"
cfg_nbCourses
\"
:"
+
std
::
to_string
(
this
->
_quantityAvailableCourses
)
+
","
;
res
+=
"
\"
cfg_nbCompetencies
\"
:"
+
std
::
to_string
(
this
->
_quantityAvailableCompetencies
)
+
","
;
res
+=
"
\"
cfg_minTimeFrame
\"
:"
+
std
::
to_string
(
this
->
_minimalTimeFrame
)
+
","
;
res
+=
"
\"
cfg_maxTimeFrame
\"
:"
+
std
::
to_string
(
this
->
_maximalTimeFrame
)
+
","
;
res
+=
"
\"
cfg_minECTS
\"
:"
+
std
::
to_string
(
this
->
_minimalECTSValue
)
+
","
;
res
+=
"
\"
cfg_maxECTS
\"
:"
+
std
::
to_string
(
this
->
_maximalECTSValue
)
+
","
;
res
+=
"
\"
cfg_minCoursesByTF
\"
:"
+
std
::
to_string
(
this
->
_minimalCoursesByTimeFrame
)
+
","
;
res
+=
"
\"
cfg_maxCoursesByTF
\"
:"
+
std
::
to_string
(
this
->
_maximalCoursesByTimeFrame
)
+
","
;
res
+=
"
\"
cfg_minCompByCourse
\"
:"
+
std
::
to_string
(
this
->
_minimalCompetencyByCourse
)
+
","
;
res
+=
"
\"
cfg_maxCompByCourse
\"
:"
+
std
::
to_string
(
this
->
_maximalCompetencyByCourse
)
+
","
;
res
+=
"
\"
cfg_minPrereqByCourse
\"
:"
+
std
::
to_string
(
this
->
_minimalPrerequisiteByCourse
)
+
","
;
res
+=
"
\"
cfg_maxPrereqByCourse
\"
:"
+
std
::
to_string
(
this
->
_maximalPrerequisiteByCourse
)
+
","
;
res
+=
"
\"
cfg_minMagnitude
\"
:"
+
std
::
to_string
(
this
->
_minimalMagnitude
.
value
())
+
","
;
res
+=
"
\"
cfg_maxMagnitude
\"
:"
+
std
::
to_string
(
this
->
_maximalMagnitude
.
value
())
+
","
;
res
+=
"
\"
cfg_pickedCourseByTF
\"
:"
+
std
::
to_string
(
this
->
_pickedCoursesByTimeFrame
)
+
","
;
// res+="\"seed\":"+std::to_string(this->_seed)+",";
std
::
string
tmp
=
""
;
res
+=
"
\"
coursesCatalogue
\"
:["
;
for
(
unsigned
int
i
=
0
;
i
<
this
->
_availableCourses
.
size
();
i
++
)
{
tmp
=
this
->
_availableCourses
.
at
(
i
).
exportMe
();
res
+=
"{"
+
tmp
+
"}"
;
if
(
i
<
this
->
_availableCourses
.
size
()
-
1
)
res
+=
","
;
}
res
+=
"],"
;
res
+=
"
\"
competenciesCatalogue
\"
:["
;
for
(
unsigned
int
i
=
0
;
i
<
this
->
_availableCompentecies
.
size
();
i
++
)
{
tmp
=
this
->
_availableCompentecies
.
at
(
i
).
exportMe
();
res
+=
"{"
+
tmp
+
"}"
;
if
(
i
<
this
->
_availableCompentecies
.
size
()
-
1
)
res
+=
","
;
}
res
+=
"]"
;
res
+=
"}"
;
return
res
;
}
\ No newline at end of file
src/model/problem.h
View file @
d2ed4754
...
...
@@ -203,6 +203,9 @@ class CSDVP
// === FUNC
/// Checks all configuration attributes. If they have been all set, then isConfig is set to true
bool
checkConfig
();
// === EXPORT
std
::
string
exportMe
()
const
;
};
std
::
ostream
&
operator
<<
(
std
::
ostream
&
Stream
,
const
CSDVP
&
c
);
...
...
src/model/profession.cpp
View file @
d2ed4754
...
...
@@ -286,6 +286,34 @@ void Profession::_pickWithHLWeighting(int nbToPick, Profession & job, CSDVP & pb
}
}
std
::
string
Profession
::
exportMe
()
const
{
std
::
string
res
=
"
\"
job
\"
:{"
;
res
+=
"
\"
cfg_seed
\"
:"
+
std
::
to_string
(
this
->
_seed
)
+
","
;
res
+=
"
\"
cfg_minimalPrereq
\"
:"
+
std
::
to_string
(
this
->
_minimalPrerequisites
)
+
","
;
res
+=
"
\"
cfg_maximalPrereq
\"
:"
+
std
::
to_string
(
this
->
_maximalPrerequisites
)
+
","
;
res
+=
"
\"
cfg_minimalMagnitude
\"
:"
+
std
::
to_string
(
this
->
_minimalMagnitude
.
value
())
+
","
;
res
+=
"
\"
cfg_maximalMagnitude
\"
:"
+
std
::
to_string
(
this
->
_maximalMagnitude
.
value
())
+
","
;
res
+=
"
\"
cfg_drawECTSRandomly
\"
:"
+
std
::
to_string
(
this
->
_isECTSRandom
)
+
","
;
res
+=
"
\"
name
\"
:
\"
"
+
this
->
_name
+
"
\"
,"
;
res
+=
"
\"
requiredECTS
\"
:"
+
std
::
to_string
(
this
->
_requiredECTS
)
+
","
;
std
::
string
tmp
=
""
;
res
+=
"
\"
prerequisites
\"
:["
;
for
(
unsigned
int
i
=
0
;
i
<
this
->
_prerequisites
.
size
();
i
++
)
{
tmp
=
this
->
_prerequisites
.
at
(
i
).
exportMe
();
res
+=
"{"
+
tmp
+
"}"
;
if
(
i
<
this
->
_prerequisites
.
size
()
-
1
)
res
+=
","
;
}
res
+=
"]"
;
res
+=
"}"
;
return
res
;
}
// === STATIC
int
Profession
::
assignID
(){
return
++
Profession
::
PROFESSION_COUNTER
;}
...
...
src/model/profession.h
View file @
d2ed4754
...
...
@@ -98,6 +98,8 @@ class Profession
void
set_cfg_minimalMagnitude
(
double
mag
);
void
set_cfg_maximalMagnitude
(
double
mag
);
// === EXPORT
std
::
string
exportMe
()
const
;
};
// === OPERATOR
...
...
src/model/tools.h
View file @
d2ed4754
...
...
@@ -7,6 +7,14 @@
#include <queue>
#include <random>
#include <limits>
#include <string>
#include "problem.h"
#include "profession.h"
static
std
::
string
APP_VERSION
=
"1.0.0"
;
static
std
::
string
MAIN_AUTHOR
=
"Alexis Lebis"
;
static
std
::
string
MAIN_AUTHOR_EMAIL
=
"ceao@alexis.lebis.org"
;
static
const
int
ID_RANGE_FOR_OBJECT
=
10000
;
static
const
int
ID_RANGE_FOR_TEMPORARY_OBJECT
=
std
::
numeric_limits
<
int
>::
max
();
...
...
@@ -56,6 +64,19 @@ static std::pair<bool,T> getElementById(const std::vector<T> & elem, int idToFin
return
std
::
pair
<
bool
,
T
>
(
false
,
T
());
}
static
std
::
string
exportProblem
(
const
CSDVP
&
csdvp
,
const
Profession
&
job
)
{
std
::
string
res
=
"{
\"
problem
\"
:{"
;
res
+=
"
\"
version
\"
:
\"
"
+
APP_VERSION
+
"
\"
,"
;
res
+=
"
\"
mainAuthor
\"
:
\"
"
+
MAIN_AUTHOR
+
"
\"
,"
;
res
+=
"
\"
mainAuthorEmail
\"
:
\"
"
+
MAIN_AUTHOR_EMAIL
+
"
\"
,"
;
res
+=
csdvp
.
exportMe
()
+
","
;
res
+=
job
.
exportMe
();
res
+=
"}"
;
res
+=
"}"
;
return
res
;
}
///Not working properly yet, just for debug
// static std::queue<int> RNG_QUEUE;
// /**Init a queue of size s from 0 to s, then shuffle it*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment