Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
StudyFramework Plugin
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LuFG VR VIS
VR-Group
Unreal-Development
Plugins
StudyFramework Plugin
Commits
67fb1150
Commit
67fb1150
authored
1 year ago
by
ITC22366\local-study-admin
Browse files
Options
Downloads
Patches
Plain Diff
improe randomization to not get confused by non-combined factors
parent
e7d1fc17
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Source/StudyFrameworkPlugin/Private/SFStudyPhase.cpp
+35
-19
35 additions, 19 deletions
Source/StudyFrameworkPlugin/Private/SFStudyPhase.cpp
with
35 additions
and
19 deletions
Source/StudyFrameworkPlugin/Private/SFStudyPhase.cpp
+
35
−
19
View file @
67fb1150
...
...
@@ -116,6 +116,9 @@ TArray<USFCondition*> USFStudyPhase::GenerateConditions(int ParticipantSequenceN
// first restructure factors, such that:
// - a potential enBlock factor is the first one
// - then follow InOrder factors
// - then Random factors
// - and in the end non-combined factors
TArray
<
USFStudyFactor
*>
SortedFactors
=
SortFactors
();
const
bool
bHasEnBlock
=
SortedFactors
[
0
]
->
MixingOrder
==
EFactorMixingOrder
::
EnBlock
;
...
...
@@ -139,7 +142,7 @@ TArray<USFCondition*> USFStudyPhase::GenerateConditions(int ParticipantSequenceN
// Generate Condition Indices
// ****************************
//create an array holding for each condition an array of each factors' level index
//create an array holding for each condition an array of each factors' level index
(leaving -1 for nonCombined factors, they will be considered later)
TArray
<
TArray
<
int
>>
ConditionsIndices
;
ConditionsIndices
.
Reserve
(
NumberOfConditions
);
CreateAllConditionsRecursively
(
0
,
{},
SortedFactors
,
ParticipantSequenceNr
,
ConditionsIndices
);
...
...
@@ -153,18 +156,24 @@ TArray<USFCondition*> USFStudyPhase::GenerateConditions(int ParticipantSequenceN
ConditionsIndices
.
Empty
();
//compute what factors we have to consider:
int
FullyRandomFactorsStartIndex
=
0
;
int
NumFullyRandomConditions
=
ConditionsIndicesCopy
.
Num
();
int
NumEnBlockLevels
=
bHasEnBlock
?
SortedFactors
[
0
]
->
Levels
.
Num
()
:
1
;
int
NumRandomConditions
=
1
;
int
NumEnBlockLevels
=
1
;
int
NumInOrderLevels
=
1
;
while
(
FullyRandomFactorsStartIndex
<
SortedFactors
.
Num
()
&&
SortedFactors
[
FullyRandomFactorsStartIndex
]
->
MixingOrder
!=
EFactorMixingOrder
::
RandomOrder
)
{
//so we jump over all inOrder factors and the enBlock factor (if it exists)
NumFullyRandomConditions
/=
SortedFactors
[
FullyRandomFactorsStartIndex
]
->
Levels
.
Num
();
if
(
SortedFactors
[
FullyRandomFactorsStartIndex
]
->
MixingOrder
==
EFactorMixingOrder
::
InOrder
)
{
NumInOrderLevels
*=
SortedFactors
[
FullyRandomFactorsStartIndex
]
->
Levels
.
Num
();
#
for
(
USFStudyFactor
*
Factor
:
SortedFactors
)
{
if
(
Factor
->
bNonCombined
)
{
continue
;
}
else
if
(
Factor
->
MixingOrder
==
EFactorMixingOrder
::
EnBlock
)
{
NumEnBlockLevels
*=
Factor
->
Levels
.
Num
();
}
else
if
(
Factor
->
MixingOrder
==
EFactorMixingOrder
::
InOrder
)
{
NumInOrderLevels
*=
Factor
->
Levels
.
Num
();
}
else
if
(
Factor
->
MixingOrder
==
EFactorMixingOrder
::
RandomOrder
)
{
NumRandomConditions
*=
Factor
->
Levels
.
Num
();
}
FullyRandomFactorsStartIndex
++
;
}
...
...
@@ -176,15 +185,15 @@ TArray<USFCondition*> USFStudyPhase::GenerateConditions(int ParticipantSequenceN
{
for
(
int
InOrderLevel
=
0
;
InOrderLevel
<
NumInOrderLevels
;
InOrderLevel
++
)
{
const
TArray
<
int
>
FullyRandom
LatinSquare
=
USFStudyFactor
::
GenerateLatinSquareOrder
(
ParticipantSequenceNr
+
PhaseIndex
+
EnBlockLevel
+
InOrderLevel
,
Num
Fully
RandomConditions
);
const
TArray
<
int
>
LatinSquare
=
USFStudyFactor
::
GenerateLatinSquareOrder
(
ParticipantSequenceNr
+
PhaseIndex
+
EnBlockLevel
+
InOrderLevel
,
NumRandomConditions
);
//we use all EnBlockLevel + InOrderLevel also for "seeding" so it is not repetitive
for
(
int
Fully
Random
Condition
=
0
;
Fully
Random
Condition
<
FullyRandom
LatinSquare
.
Num
();
Fully
Random
Condition
++
)
for
(
int
Random
Level
=
0
;
Random
Level
<
LatinSquare
.
Num
();
Random
Level
++
)
{
ConditionsIndices
.
Add
(
ConditionsIndicesCopy
[
NumInOrderLevels
*
Num
Fully
RandomConditions
*
EnBlockLatinSquare
[
EnBlockLevel
]
+
Num
Fully
RandomConditions
*
InOrderLevel
+
FullyRandom
LatinSquare
[
Fully
Random
Condition
]
NumInOrderLevels
*
NumRandomConditions
*
EnBlockLatinSquare
[
EnBlockLevel
]
+
NumRandomConditions
*
InOrderLevel
+
LatinSquare
[
Random
Level
]
]);
}
}
...
...
@@ -376,16 +385,22 @@ int USFStudyPhase::GetMapFactorIndex() const
TArray
<
USFStudyFactor
*>
USFStudyPhase
::
SortFactors
()
const
{
//puts the enBlock factor first! (in PhaseValid() it is checked that max one exists!)
//then it puts th inOrder factors and then the rest
//then it puts th inOrder factors, then random factors and in the end nonCombined factors
TArray
<
USFStudyFactor
*>
EnBlockFactor
;
TArray
<
USFStudyFactor
*>
InOrderFactors
;
TArray
<
USFStudyFactor
*>
RandomFactors
;
TArray
<
USFStudyFactor
*>
NonCombinedFactors
;
for
(
USFStudyFactor
*
Factor
:
Factors
)
{
if
(
Factor
->
MixingOrder
==
EFactorMixingOrder
::
RandomOrder
)
if
(
Factor
->
bNonCombined
)
{
NonCombinedFactors
.
Add
(
Factor
);
}
else
if
(
Factor
->
MixingOrder
==
EFactorMixingOrder
::
RandomOrder
)
{
RandomFactors
.
Add
(
Factor
);
}
...
...
@@ -409,6 +424,7 @@ TArray<USFStudyFactor*> USFStudyPhase::SortFactors() const
TArray
<
USFStudyFactor
*>
SortedFactors
=
EnBlockFactor
;
SortedFactors
.
Append
(
InOrderFactors
);
SortedFactors
.
Append
(
RandomFactors
);
SortedFactors
.
Append
(
NonCombinedFactors
);
return
SortedFactors
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment