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
4dbb9a69
Commit
4dbb9a69
authored
May 07, 2020
by
Alexis Lebis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
starting random gen pb
parent
d9aac66f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
204 additions
and
31 deletions
+204
-31
ceao_csdvp.cpp
application/ceao_csdvp.cpp
+57
-7
magnitude.cpp
src/model/magnitude.cpp
+5
-0
magnitude.h
src/model/magnitude.h
+1
-0
problem.cpp
src/model/problem.cpp
+91
-12
problem.h
src/model/problem.h
+50
-12
No files found.
application/ceao_csdvp.cpp
View file @
4dbb9a69
...
@@ -23,11 +23,11 @@ int main(int argc, char* argv[])
...
@@ -23,11 +23,11 @@ int main(int argc, char* argv[])
assert
(
pb
.
checkConfig
()
==
false
);
assert
(
pb
.
checkConfig
()
==
false
);
std
::
cout
<<
"OK! CSDVP shoukd not be config yet here"
<<
std
::
endl
;
std
::
cout
<<
"OK! CSDVP shoukd not be config yet here"
<<
std
::
endl
;
CSDVP
::
generateProblem
(
pb
,
7777
);
CSDVP
::
generateProblem
(
pb
,
CSDVP
::
GenerationType
::
RANDOM
,
7777
);
assert
(
pb
.
seed
()
==
7777
);
assert
(
pb
.
seed
()
==
7777
);
assert
(
pb
.
checkConfig
()
==
false
);
assert
(
pb
.
checkConfig
()
==
false
);
CSDVP
::
generateProblem
(
pb
,
-
1
);
CSDVP
::
generateProblem
(
pb
,
CSDVP
::
GenerationType
::
RANDOM
,
-
1
);
assert
(
pb
.
seed
()
==
-
1
);
assert
(
pb
.
seed
()
==
-
1
);
assert
(
pb
.
checkConfig
()
==
false
);
assert
(
pb
.
checkConfig
()
==
false
);
std
::
cout
<<
"generateProblem does not trigger generation if pb is not config"
<<
std
::
endl
;
std
::
cout
<<
"generateProblem does not trigger generation if pb is not config"
<<
std
::
endl
;
...
@@ -40,8 +40,12 @@ int main(int argc, char* argv[])
...
@@ -40,8 +40,12 @@ int main(int argc, char* argv[])
assert
(
pb
.
cfg_quantityCourses
()
==
25
);
assert
(
pb
.
cfg_quantityCourses
()
==
25
);
assert
(
pb
.
checkConfig
()
==
false
);
assert
(
pb
.
checkConfig
()
==
false
);
pb
.
set_cfg_quantityTimeFrames
(
10
);
pb
.
set_cfg_minimalTimeFrames
(
5
);
assert
(
pb
.
cfg_quantityTimeFrames
()
==
10
);
assert
(
pb
.
cfg_minimalTimeFrame
()
==
5
);
assert
(
pb
.
checkConfig
()
==
false
);
pb
.
set_cfg_maximalTimeFrames
(
10
);
assert
(
pb
.
cfg_maximalTimeFrame
()
==
10
);
assert
(
pb
.
checkConfig
()
==
false
);
assert
(
pb
.
checkConfig
()
==
false
);
pb
.
set_cfg_ectsMin
(
3
);
pb
.
set_cfg_ectsMin
(
3
);
...
@@ -59,13 +63,19 @@ int main(int argc, char* argv[])
...
@@ -59,13 +63,19 @@ int main(int argc, char* argv[])
pb
.
set_cfg_courseByTFMax
(
8
);
pb
.
set_cfg_courseByTFMax
(
8
);
assert
(
pb
.
cfg_courseByTFMax
()
==
8
);
assert
(
pb
.
cfg_courseByTFMax
()
==
8
);
assert
(
pb
.
checkConfig
()
==
false
);
assert
(
pb
.
checkConfig
()
==
false
);
pb
.
set_cfg_minimalMagnitude
(
0.2
);
pb
.
set_cfg_maximalMagnitude
(
0.5
);
assert
(
pb
.
cfg_magnitudeMin
().
value
()
==
0.2
);
assert
(
pb
.
cfg_magnitudeMax
().
value
()
==
0.5
);
assert
(
pb
.
checkConfig
()
==
false
);
std
::
cout
<<
"Config ok -- excepting seed"
<<
std
::
endl
;
std
::
cout
<<
"Config ok -- excepting seed"
<<
std
::
endl
;
pb
.
set_cfg_courseByTFMin
(
9
);
pb
.
set_cfg_courseByTFMin
(
9
);
try
try
{
{
CSDVP
::
generateProblem
(
pb
,
7777
);
CSDVP
::
generateProblem
(
pb
,
CSDVP
::
GenerationType
::
RANDOM
,
7777
);
}
}
catch
(
CSDVPOverlapingBoundariesException
&
e
)
catch
(
CSDVPOverlapingBoundariesException
&
e
)
{
{
...
@@ -77,7 +87,7 @@ int main(int argc, char* argv[])
...
@@ -77,7 +87,7 @@ int main(int argc, char* argv[])
try
try
{
{
CSDVP
::
generateProblem
(
pb
,
7777
);
CSDVP
::
generateProblem
(
pb
,
CSDVP
::
GenerationType
::
RANDOM
,
7777
);
}
}
catch
(
CSDVPOverlapingBoundariesException
&
e
)
catch
(
CSDVPOverlapingBoundariesException
&
e
)
{
{
...
@@ -86,9 +96,49 @@ int main(int argc, char* argv[])
...
@@ -86,9 +96,49 @@ int main(int argc, char* argv[])
pb
.
set_cfg_ectsMax
(
5
);
pb
.
set_cfg_ectsMax
(
5
);
CSDVP
::
generateProblem
(
pb
,
7777
);
pb
.
addTimeFrame
(
2
);
pb
.
addTimeFrame
(
5
);
assert
(
pb
.
timeFrames
().
size
()
==
2
);
pb
.
addTimeFrame
(
5
);
assert
(
pb
.
timeFrames
().
size
()
==
2
);
std
::
cout
<<
"duplicata protection TF ok"
<<
std
::
endl
;
Course
c
=
Course
::
build
();
Course
c2
=
Course
::
build
();
assert
(
!
(
c
==
c2
)
);
pb
.
addCourseToCatalogue
(
c
);
pb
.
addCourseToCatalogue
(
c2
);
assert
(
pb
.
coursesCatalogue
().
size
()
==
2
);
pb
.
addCourseToCatalogue
(
c
);
assert
(
pb
.
coursesCatalogue
().
size
()
==
2
);
std
::
cout
<<
"duplicata protection for course ok"
<<
std
::
endl
;
Competency
comp1
=
Competency
::
build
(
0.5
);
Competency
comp2
=
Competency
::
build
(
0.7
);
assert
(
!
(
comp1
==
comp2
));
pb
.
addCompetencyToCatalogue
(
comp1
);
pb
.
addCompetencyToCatalogue
(
comp2
);
assert
(
pb
.
competencyCatalogue
().
size
()
==
2
);
pb
.
addCompetencyToCatalogue
(
comp1
);
assert
(
pb
.
competencyCatalogue
().
size
()
==
2
);
std
::
cout
<<
"duplicata protection for competency ok"
<<
std
::
endl
;
std
::
cout
<<
pb
<<
std
::
endl
;
CSDVP
::
generateProblem
(
pb
,
CSDVP
::
GenerationType
::
RANDOM
,
7777
);
assert
(
pb
.
checkConfig
());
assert
(
pb
.
checkConfig
());
std
::
cout
<<
"CSDVP has been correctly configurated"
<<
std
::
endl
;
std
::
cout
<<
"CSDVP has been correctly configurated"
<<
std
::
endl
;
assert
(
pb
.
timeFrames
().
at
(
0
)
==
pb
.
cfg_minimalTimeFrame
());
assert
(
pb
.
timeFrames
().
at
(
1
)
==
pb
.
cfg_minimalTimeFrame
()
+
1
);
assert
(
pb
.
timeFrames
().
at
(
pb
.
timeFrames
().
size
()
-
1
)
==
pb
.
cfg_maximalTimeFrame
());
std
::
cout
<<
"TimeFrames vector correctly init"
<<
std
::
endl
;
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
\ No newline at end of file
src/model/magnitude.cpp
View file @
4dbb9a69
...
@@ -83,6 +83,11 @@ Magnitude operator+(const Magnitude & m, const double d)
...
@@ -83,6 +83,11 @@ Magnitude operator+(const Magnitude & m, const double d)
return
mag
;
return
mag
;
}
}
bool
Magnitude
::
operator
>
(
const
Magnitude
&
m
)
const
{
return
this
->
_value
>
m
.
value
();
}
// === FUNCTION
// === FUNCTION
/** Checks if the value v is in [0;1]. If yes, return 0. Else, if v < 0 return -1, 1 otherwise
/** Checks if the value v is in [0;1]. If yes, return 0. Else, if v < 0 return -1, 1 otherwise
*/
*/
...
...
src/model/magnitude.h
View file @
4dbb9a69
...
@@ -27,6 +27,7 @@ class Magnitude
...
@@ -27,6 +27,7 @@ class Magnitude
// Operator
// Operator
Magnitude
&
operator
+=
(
const
Magnitude
&
m
);
Magnitude
&
operator
+=
(
const
Magnitude
&
m
);
Magnitude
&
operator
+=
(
double
const
d
);
Magnitude
&
operator
+=
(
double
const
d
);
bool
operator
>
(
const
Magnitude
&
m
)
const
;
//GETTER
//GETTER
double
value
()
const
;
double
value
()
const
;
...
...
src/model/problem.cpp
View file @
4dbb9a69
...
@@ -2,11 +2,13 @@
...
@@ -2,11 +2,13 @@
#include <utility>
#include <utility>
#include <vector>
#include <vector>
#include <algorithm>
#include <algorithm>
#include <cstdlib>
#include "problem.h"
#include "problem.h"
#include "tools.h"
#include "tools.h"
#include "exception/csdvpOverlapingBoundaryException.h"
#include "exception/csdvpOverlapingBoundaryException.h"
#include "exception/notImplementedException.h"
int
CSDVP
::
CSDVP_COUNTER
=
0
;
int
CSDVP
::
CSDVP_COUNTER
=
0
;
...
@@ -24,7 +26,8 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -24,7 +26,8 @@ int CSDVP::CSDVP_COUNTER = 0;
this
->
_quantityAvailableCompetencies
=
-
1
;
this
->
_quantityAvailableCompetencies
=
-
1
;
this
->
_quantityAvailableCourses
=
-
1
;
this
->
_quantityAvailableCourses
=
-
1
;
this
->
_quantityOfTimeFrame
=
-
1
;
this
->
_minimalTimeFrame
=
-
1
;
this
->
_maximalTimeFrame
=
-
1
;
this
->
_minimalECTSValue
=
-
1
;
this
->
_minimalECTSValue
=
-
1
;
this
->
_maximalECTSValue
=
-
1
;
this
->
_maximalECTSValue
=
-
1
;
this
->
_minimalCoursesByTimeFrame
=
-
1
;
this
->
_minimalCoursesByTimeFrame
=
-
1
;
...
@@ -38,17 +41,26 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -38,17 +41,26 @@ int CSDVP::CSDVP_COUNTER = 0;
{
this
->
_quantityAvailableCompetencies
=
nb
;}
{
this
->
_quantityAvailableCompetencies
=
nb
;}
void
CSDVP
::
set_cfg_quantityCourses
(
int
nb
)
void
CSDVP
::
set_cfg_quantityCourses
(
int
nb
)
{
this
->
_quantityAvailableCourses
=
nb
;}
{
this
->
_quantityAvailableCourses
=
nb
;}
void
CSDVP
::
set_cfg_quantityTimeFrames
(
int
nb
)
void
CSDVP
::
set_cfg_minimalTimeFrames
(
int
nb
)
{
this
->
_quantityOfTimeFrame
=
nb
;}
{
this
->
_minimalTimeFrame
=
nb
;}
void
CSDVP
::
set_cfg_maximalTimeFrames
(
int
nb
)
{
this
->
_maximalTimeFrame
=
nb
;}
void
CSDVP
::
set_cfg_ectsMin
(
int
nb
)
void
CSDVP
::
set_cfg_ectsMin
(
int
nb
)
{
{
this
->
_minimalECTSValue
=
nb
;}
this
->
_minimalECTSValue
=
nb
;}
void
CSDVP
::
set_cfg_ectsMax
(
int
nb
)
void
CSDVP
::
set_cfg_ectsMax
(
int
nb
)
{
this
->
_maximalECTSValue
=
nb
;}
{
this
->
_maximalECTSValue
=
nb
;}
void
CSDVP
::
set_cfg_courseByTFMin
(
int
nb
)
void
CSDVP
::
set_cfg_courseByTFMin
(
int
nb
)
{
this
->
_minimalCoursesByTimeFrame
=
nb
;}
{
this
->
_minimalCoursesByTimeFrame
=
nb
;}
void
CSDVP
::
set_cfg_courseByTFMax
(
int
nb
)
void
CSDVP
::
set_cfg_courseByTFMax
(
int
nb
)
{
this
->
_maximalCoursesByTimeFrame
=
nb
;}
{
this
->
_maximalCoursesByTimeFrame
=
nb
;}
void
CSDVP
::
set_cfg_minimalMagnitude
(
double
m
)
{
this
->
_minimalMagnitude
=
Magnitude
::
build
(
m
);
}
void
CSDVP
::
set_cfg_maximalMagnitude
(
double
m
)
{
this
->
_maximalMagnitude
=
Magnitude
::
build
(
m
);
}
void
CSDVP
::
setTimeFrames
(
std
::
vector
<
int
>
&
v
)
void
CSDVP
::
setTimeFrames
(
std
::
vector
<
int
>
&
v
)
{
this
->
_timeFrames
=
v
;}
{
this
->
_timeFrames
=
v
;}
...
@@ -89,19 +101,24 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -89,19 +101,24 @@ int CSDVP::CSDVP_COUNTER = 0;
if
(
this
->
_seed
<
0
||
if
(
this
->
_seed
<
0
||
this
->
_quantityAvailableCompetencies
<
0
||
this
->
_quantityAvailableCompetencies
<
0
||
this
->
_quantityAvailableCourses
<
0
||
this
->
_quantityAvailableCourses
<
0
||
this
->
_quantityOfTimeFrame
<
0
||
this
->
_minimalTimeFrame
<
0
||
this
->
_maximalTimeFrame
<
0
||
this
->
_minimalECTSValue
<
0
||
this
->
_minimalECTSValue
<
0
||
this
->
_maximalECTSValue
<
0
||
this
->
_maximalECTSValue
<
0
||
this
->
_minimalCoursesByTimeFrame
<
0
||
this
->
_minimalCoursesByTimeFrame
<
0
||
this
->
_maximalCoursesByTimeFrame
<
0
)
this
->
_maximalCoursesByTimeFrame
<
0
||
this
->
_minimalMagnitude
.
value
()
<
0
||
this
->
_maximalMagnitude
.
value
()
<
0
)
{
{
this
->
_isConfig
=
false
;
this
->
_isConfig
=
false
;
return
this
->
_isConfig
;
return
this
->
_isConfig
;
}
}
// verify overlaping range
// verify overlaping range
if
(
this
->
_minimalECTSValue
>
this
->
_maximalECTSValue
||
if
(
this
->
_minimalTimeFrame
>
this
->
_maximalTimeFrame
||
this
->
_minimalCoursesByTimeFrame
>
this
->
_maximalCoursesByTimeFrame
)
this
->
_minimalECTSValue
>
this
->
_maximalECTSValue
||
this
->
_minimalCoursesByTimeFrame
>
this
->
_maximalCoursesByTimeFrame
||
this
->
_minimalMagnitude
>
this
->
_maximalMagnitude
)
{
{
throw
CSDVPOverlapingBoundariesException
(
this
);
throw
CSDVPOverlapingBoundariesException
(
this
);
}
}
...
@@ -112,7 +129,11 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -112,7 +129,11 @@ int CSDVP::CSDVP_COUNTER = 0;
// === END FUNC
// === END FUNC
// === STATIC
// === STATIC
void
CSDVP
::
generateProblem
(
CSDVP
&
csdvp
,
int
seed
)
int
CSDVP
::
assignID
()
{
return
++
CSDVP
::
CSDVP_COUNTER
;}
// ---------- GENERATION RELATED FUNCTIONS ----------
void
CSDVP
::
generateProblem
(
CSDVP
&
csdvp
,
CSDVP
::
GenerationType
type
,
int
seed
)
{
{
csdvp
.
_seed
=
seed
;
csdvp
.
_seed
=
seed
;
...
@@ -120,7 +141,65 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -120,7 +141,65 @@ int CSDVP::CSDVP_COUNTER = 0;
return
;
//aborting pb generation
return
;
//aborting pb generation
std
::
cout
<<
"generateProblem TODO"
<<
std
::
endl
;
std
::
cout
<<
"generateProblem TODO"
<<
std
::
endl
;
switch
(
type
)
{
case
CSDVP
:
:
GenerationType
::
RANDOM
:
_randomlyGenerated
(
csdvp
);
break
;
default
:
break
;
}
}
}
int
CSDVP
::
assignID
()
int
CSDVP
::
_randomizeIn
(
const
int
min
,
const
int
max
)
{
return
++
CSDVP
::
CSDVP_COUNTER
;}
{
\ No newline at end of file
return
min
+
(
rand
()
%
(
max
-
min
+
1
)
);
}
double
CSDVP
::
_randomizeIn
(
const
double
min
,
const
double
max
)
{
throw
NotImplementedException
(
"CSDVP::_randomizeIn"
);
}
void
CSDVP
::
randomizeProblem
(
CSDVP
&
pb
,
int
seed
)
{
pb
.
_seed
=
seed
;
srand
(
pb
.
seed
());
pb
.
set_cfg_ectsMin
(
_randomizeIn
(
1
,
CSDVP
::
RANDOM_MAX_ECTS_VALUE
));
pb
.
set_cfg_ectsMax
(
_randomizeIn
(
pb
.
cfg_ectsMin
(),
CSDVP
::
RANDOM_MAX_ECTS_VALUE
));
throw
NotImplementedException
(
"_randomizeProblem"
);
//SKILL_MAX_VALUE
}
void
CSDVP
::
_randomlyGenerated
(
CSDVP
&
pb
)
{
srand
(
pb
.
seed
());
pb
.
unlocked_timeFrames
().
clear
();
pb
.
unlocked_competenciesCatalogue
().
clear
();
pb
.
unlocked_coursesCatalogue
().
clear
();
for
(
int
i
=
0
;
i
<
(
pb
.
cfg_maximalTimeFrame
()
-
pb
.
cfg_minimalTimeFrame
())
+
1
;
i
++
)
{
pb
.
addTimeFrame
(
pb
.
cfg_minimalTimeFrame
()
+
i
);
}
}
// --------- END GENERATION RELATED FUNCTIONS ---------
// === END STATIC
// === OPERATOR
std
::
ostream
&
operator
<<
(
std
::
ostream
&
Stream
,
const
CSDVP
&
c
)
{
std
::
string
s
=
"--------------
\n
| Problem n°"
+
std
::
to_string
(
c
.
id
())
+
"|
\n
---------------
\n
| Configuration:"
;
s
+=
"
\n\t
seed: "
+
std
::
to_string
(
c
.
seed
())
+
"
\n\t
Nb comp: "
+
std
::
to_string
(
c
.
cfg_quantityCompetencies
())
+
"
\n\t
Nb courses: "
+
std
::
to_string
(
c
.
cfg_quantityCourses
())
+
"
\n\t
Min TimeF: "
+
std
::
to_string
(
c
.
cfg_minimalTimeFrame
())
+
"
\n\t
Max TimeF: "
+
std
::
to_string
(
c
.
cfg_maximalTimeFrame
());
s
+=
"
\n\t
ECTS Min: "
+
std
::
to_string
(
c
.
cfg_ectsMin
())
+
"
\n\t
ECTS Max: "
+
std
::
to_string
(
c
.
cfg_ectsMax
())
+
"
\n\t
Course by TF min: "
+
std
::
to_string
(
c
.
cfg_courseByTFMin
())
+
"
\n\t
Course by TF max: "
+
std
::
to_string
(
c
.
cfg_courseByTFMax
());
s
+=
"
\n\t
Magnitude min: "
+
std
::
to_string
(
c
.
cfg_magnitudeMax
().
value
())
+
"
\n\t
Magnitude max: "
+
std
::
to_string
(
c
.
cfg_magnitudeMax
().
value
());
Stream
<<
s
;
return
Stream
;
}
// === END OPERATOR
\ No newline at end of file
src/model/problem.h
View file @
4dbb9a69
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include "course.h"
#include "course.h"
#include "competency.h"
#include "competency.h"
#include "magnitude.h"
/**
/**
* Model of the CSDVP (Constraint Satisfaction Decaying Variables Problem).
* Model of the CSDVP (Constraint Satisfaction Decaying Variables Problem).
...
@@ -28,13 +29,17 @@ class CSDVP
...
@@ -28,13 +29,17 @@ class CSDVP
int
_quantityAvailableCompetencies
;
int
_quantityAvailableCompetencies
;
int
_quantityAvailableCourses
;
int
_quantityAvailableCourses
;
int
_quantityOfTimeFrame
;
int
_minimalTimeFrame
;
int
_maximalTimeFrame
;
/// ECTS values, defining the intervale [_minimal,_maximal] for random
/// ECTS values, defining the intervale [_minimal,_maximal] for random
int
_minimalECTSValue
;
int
_minimalECTSValue
;
int
_maximalECTSValue
;
int
_maximalECTSValue
;
int
_minimalCoursesByTimeFrame
;
int
_minimalCoursesByTimeFrame
;
int
_maximalCoursesByTimeFrame
;
int
_maximalCoursesByTimeFrame
;
Magnitude
_minimalMagnitude
;
Magnitude
_maximalMagnitude
;
// ---------- END CONFIGURATION ATTRIBUTES ----------
// ---------- END CONFIGURATION ATTRIBUTES ----------
// ---------- PROBLEM SPECIFIC ATTRIBUTES ----------
// ---------- PROBLEM SPECIFIC ATTRIBUTES ----------
...
@@ -47,33 +52,61 @@ class CSDVP
...
@@ -47,33 +52,61 @@ class CSDVP
//DecayPolitics
//DecayPolitics
// --------- END PROBLEM SPECIFIC ATTRIBUTES ---------
// --------- END PROBLEM SPECIFIC ATTRIBUTES ---------
//
Static
//
=== STATIC
static
int
CSDVP_COUNTER
;
static
int
CSDVP_COUNTER
;
static
int
assignID
();
static
int
assignID
();
static
const
int
RANDOM_MAX_ECTS_VALUE
=
10
;
static
const
int
RANDOM_MAX_QTE_COMPETENCIES
=
50
;
static
const
int
RANDOM_MAX_QTE_COURSES
=
50
;
static
const
int
RANDOM_MAX_TIME_FRAMES
=
15
;
static
const
int
RANDOM_MAX_COURSE_TIME_FRAMES
=
10
;
// --------- GENERATION RELATED FUNCTION ---------
static
void
_randomlyGenerated
(
CSDVP
&
pb
);
static
int
_randomizeIn
(
const
int
min
,
const
int
max
);
static
double
_randomizeIn
(
const
double
min
,
const
double
max
);
// --------- END GENERATION RELATED FUNCTION ---------
public
:
public
:
// --------- GENERATION RELATED FUNCTION ---------
/// allows a random attribution of pb's attributes
static
void
randomizeProblem
(
CSDVP
&
pb
,
int
seed
);
// --------- END GENERATION RELATED FUNCTION ---------
// === ENUM
enum
GenerationType
{
RANDOM
//PRESET
};
// === CONSTRUCTOR
// === CONSTRUCTOR
CSDVP
();
CSDVP
();
/// Generate an instance of the CSDVP iff isConfig is true. Thus, seed != -1;
/// Generate an instance of the CSDVP iff isConfig is true. Thus, seed != -1;
void
static
generateProblem
(
CSDVP
&
csdvp
,
int
seed
=
-
1
);
static
void
generateProblem
(
CSDVP
&
csdvp
,
CSDVP
::
GenerationType
type
,
int
seed
=
-
1
);
// === GETTER
// === GETTER
const
int
id
()
const
{
return
this
->
_id
;}
const
int
id
()
const
{
return
this
->
_id
;}
const
int
seed
()
const
{
return
this
->
_seed
;}
const
int
seed
()
const
{
return
this
->
_seed
;}
const
int
cfg_quantityCompetencies
()
const
{
return
this
->
_quantityAvailableCompetencies
;}
const
int
cfg_quantityCompetencies
()
const
{
return
this
->
_quantityAvailableCompetencies
;}
const
int
cfg_quantityCourses
()
const
{
return
this
->
_quantityAvailableCourses
;}
const
int
cfg_quantityCourses
()
const
{
return
this
->
_quantityAvailableCourses
;}
const
int
cfg_quantityTimeFrames
()
const
{
return
this
->
_quantityOfTimeFrame
;}
const
int
cfg_minimalTimeFrame
()
const
{
return
this
->
_minimalTimeFrame
;}
const
int
cfg_maximalTimeFrame
()
const
{
return
this
->
_maximalTimeFrame
;}
const
int
cfg_ectsMax
()
const
{
return
this
->
_maximalECTSValue
;}
const
int
cfg_ectsMax
()
const
{
return
this
->
_maximalECTSValue
;}
const
int
cfg_ectsMin
()
const
{
return
this
->
_minimalECTSValue
;}
const
int
cfg_ectsMin
()
const
{
return
this
->
_minimalECTSValue
;}
const
int
cfg_courseByTFMax
()
const
{
return
this
->
_maximalCoursesByTimeFrame
;}
const
int
cfg_courseByTFMax
()
const
{
return
this
->
_maximalCoursesByTimeFrame
;}
const
int
cfg_courseByTFMin
()
const
{
return
this
->
_minimalCoursesByTimeFrame
;}
const
int
cfg_courseByTFMin
()
const
{
return
this
->
_minimalCoursesByTimeFrame
;}
const
Magnitude
&
cfg_magnitudeMin
()
const
{
return
this
->
_minimalMagnitude
;}
const
std
::
vector
<
int
>
timeFrames
()
const
{
return
this
->
_timeFrames
;}
const
Magnitude
&
cfg_magnitudeMax
()
const
{
return
this
->
_maximalMagnitude
;}
const
std
::
vector
<
Course
>
coursesCatalogue
()
const
{
return
this
->
_availableCourses
;}
const
std
::
vector
<
Competency
>
competencyCatalogue
()
const
{
return
this
->
_availableCompentecies
;}
const
std
::
vector
<
int
>
&
timeFrames
()
const
{
return
this
->
_timeFrames
;}
std
::
vector
<
int
>
unlocked_timeFrames
(){
return
this
->
_timeFrames
;}
const
std
::
vector
<
Course
>
&
coursesCatalogue
()
const
{
return
this
->
_availableCourses
;}
std
::
vector
<
Course
>
unlocked_coursesCatalogue
(){
return
this
->
_availableCourses
;}
const
std
::
vector
<
Competency
>
&
competencyCatalogue
()
const
{
return
this
->
_availableCompentecies
;}
std
::
vector
<
Competency
>
unlocked_competenciesCatalogue
(){
return
this
->
_availableCompentecies
;}
std
::
vector
<
int
>
&
unlocked_timeFrames
(){
return
this
->
_timeFrames
;}
std
::
vector
<
Course
>
&
unlocked_coursesCatalogue
(){
return
this
->
_availableCourses
;}
std
::
vector
<
Competency
>
&
unlocked_competenciesCatalogue
(){
return
this
->
_availableCompentecies
;}
///@todo getDecayPolitic
///@todo getDecayPolitic
// === MUTATOR
// === MUTATOR
...
@@ -82,11 +115,14 @@ class CSDVP
...
@@ -82,11 +115,14 @@ class CSDVP
//void setSeed(int s);
//void setSeed(int s);
void
set_cfg_quantityCompetencies
(
int
nb
);
void
set_cfg_quantityCompetencies
(
int
nb
);
void
set_cfg_quantityCourses
(
int
nb
);
void
set_cfg_quantityCourses
(
int
nb
);
void
set_cfg_quantityTimeFrames
(
int
nb
);
void
set_cfg_minimalTimeFrames
(
int
nb
);
void
set_cfg_maximalTimeFrames
(
int
nb
);
void
set_cfg_ectsMin
(
int
nb
);
void
set_cfg_ectsMin
(
int
nb
);
void
set_cfg_ectsMax
(
int
nb
);
void
set_cfg_ectsMax
(
int
nb
);
void
set_cfg_courseByTFMax
(
int
nb
);
void
set_cfg_courseByTFMax
(
int
nb
);
void
set_cfg_courseByTFMin
(
int
nb
);
void
set_cfg_courseByTFMin
(
int
nb
);
void
set_cfg_minimalMagnitude
(
double
mag
);
void
set_cfg_maximalMagnitude
(
double
mag
);
void
setTimeFrames
(
std
::
vector
<
int
>
&
v
);
void
setTimeFrames
(
std
::
vector
<
int
>
&
v
);
void
setCoursesCatalogue
(
std
::
vector
<
Course
>
&
);
void
setCoursesCatalogue
(
std
::
vector
<
Course
>
&
);
...
@@ -101,6 +137,8 @@ class CSDVP
...
@@ -101,6 +137,8 @@ class CSDVP
/// Checks all configuration attributes. If they have been all set, then isConfig is set to true
/// Checks all configuration attributes. If they have been all set, then isConfig is set to true
bool
checkConfig
();
bool
checkConfig
();
};
};
std
::
ostream
&
operator
<<
(
std
::
ostream
&
Stream
,
const
CSDVP
&
c
);
#endif // SRC_PROBLEM_H_
#endif // SRC_PROBLEM_H_
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment