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
9c46eb8b
Commit
9c46eb8b
authored
May 05, 2021
by
Alexis Lebis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ok export in JSON
parent
3fa7e1b8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
1 deletion
+53
-1
main.cpp
application/main.cpp
+2
-1
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 @
9c46eb8b
...
...
@@ -125,7 +125,6 @@ int main(int argc, char* argv[]){
CSDVP
::
generateProblem
(
pb
,
CSDVP
::
GenerationType
::
RANDOM
,
SEED
);
assert
(
pb
.
checkConfig
());
std
::
cout
<<
pb
.
exportMe
()
<<
std
::
endl
;
// std::cout << "CSDVP IS : \n" << pb << std::endl;
// for(int i = 0; i < pb.coursesCatalogue().size(); i++)
// std::cout << pb.coursesCatalogue().at(i) << std::endl;
...
...
@@ -330,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/profession.cpp
View file @
9c46eb8b
...
...
@@ -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 @
9c46eb8b
...
...
@@ -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 @
9c46eb8b
...
...
@@ -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