Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
genetic-algorithms
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lennart Eichhorn
genetic-algorithms
Commits
e4731af4
Commit
e4731af4
authored
5 years ago
by
Lennart Eichhorn
Browse files
Options
Downloads
Patches
Plain Diff
Removed bonds and overlaps from Candidate.
parent
72b456a5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/Evaluators/EvaluatorNESW.java
+20
-28
20 additions, 28 deletions
src/main/java/Evaluators/EvaluatorNESW.java
src/main/java/MainClasses/Candidate.java
+0
-4
0 additions, 4 deletions
src/main/java/MainClasses/Candidate.java
with
20 additions
and
32 deletions
src/main/java/Evaluators/EvaluatorNESW.java
+
20
−
28
View file @
e4731af4
...
@@ -30,48 +30,40 @@ public class EvaluatorNESW implements Evaluator {
...
@@ -30,48 +30,40 @@ public class EvaluatorNESW implements Evaluator {
}
}
public
int
evaluateBonds
(
Candidate
candidate
)
{
public
int
evaluateBonds
(
Candidate
candidate
)
{
if
(
candidate
.
bonds
<=
-
1
)
{
// Not calculated before
int
bonds
=
0
;
int
bonds
=
0
;
for
(
int
i
=
0
;
i
<
candidate
.
vertexList
.
size
()
-
2
;
i
++)
{
for
(
int
i
=
0
;
i
<
candidate
.
vertexList
.
size
()
-
2
;
i
++)
{
Vertex
toCompare
=
candidate
.
vertexList
.
get
(
i
);
Vertex
toCompare
=
candidate
.
vertexList
.
get
(
i
);
if
(
toCompare
.
isHydrophobic
)
{
if
(
toCompare
.
isHydrophobic
)
{
for
(
int
j
=
i
+
2
;
j
<
candidate
.
vertexList
.
size
();
j
++)
{
for
(
int
j
=
i
+
2
;
j
<
candidate
.
vertexList
.
size
();
j
++)
{
Vertex
vertex
=
candidate
.
vertexList
.
get
(
j
);
Vertex
vertex
=
candidate
.
vertexList
.
get
(
j
);
if
(
vertex
.
isHydrophobic
)
{
if
(
vertex
.
isHydrophobic
)
{
if
(
toCompare
.
neighbouringPosition
(
vertex
))
{
if
(
toCompare
.
neighbouringPosition
(
vertex
))
{
bonds
++;
bonds
++;
}
}
}
}
}
}
}
}
}
candidate
.
bonds
=
bonds
;
}
}
// Return cached value if this is not the first time the value is needed
return
bonds
;
return
candidate
.
bonds
;
}
}
public
int
evaluateOverlaps
(
Candidate
candidate
)
{
public
int
evaluateOverlaps
(
Candidate
candidate
)
{
if
(
candidate
.
overlaps
<=
-
1
)
{
// Not calculated before
int
overlaps
=
0
;
for
(
int
i
=
0
;
i
<
candidate
.
vertexList
.
size
();
i
++)
{
int
overlaps
=
0
;
Vertex
toCompare
=
candidate
.
vertexList
.
get
(
i
);
for
(
int
i
=
0
;
i
<
candidate
.
vertexList
.
size
();
i
++)
{
for
(
Vertex
vertex
:
candidate
.
vertexList
)
{
Vertex
toCompare
=
candidate
.
vertexList
.
get
(
i
);
if
(
toCompare
.
equalsPosition
(
vertex
)
&&
toCompare
!=
vertex
)
{
for
(
Vertex
vertex
:
candidate
.
vertex
List
)
{
overlaps
++;
if
(
toCompare
.
equalsPosition
(
vertex
)
&&
toCompare
!=
vertex
)
{
}
overlaps
++;
}
}
}
}
overlaps
/=
2
;
candidate
.
overlaps
=
overlaps
;
}
}
// Return cached value if this is not the first time the value is needed
overlaps
/=
2
;
return
candidate
.
overlaps
;
overlaps
=
overlaps
;
return
overlaps
;
}
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/MainClasses/Candidate.java
+
0
−
4
View file @
e4731af4
...
@@ -9,8 +9,6 @@ public class Candidate {
...
@@ -9,8 +9,6 @@ public class Candidate {
int
[]
outgoingDirection
;
// 0 = North | 1 = East | 2 = South | 3 = West
int
[]
outgoingDirection
;
// 0 = North | 1 = East | 2 = South | 3 = West
public
ArrayList
<
Vertex
>
vertexList
;
public
ArrayList
<
Vertex
>
vertexList
;
public
double
fitness
;
public
double
fitness
;
public
int
bonds
;
public
int
overlaps
;
public
Candidate
(
int
[]
isH
,
int
[]
oD
)
{
public
Candidate
(
int
[]
isH
,
int
[]
oD
)
{
this
.
isHydrophobic
=
isH
;
this
.
isHydrophobic
=
isH
;
...
@@ -18,8 +16,6 @@ public class Candidate {
...
@@ -18,8 +16,6 @@ public class Candidate {
this
.
vertexList
=
constructVertexes
();
this
.
vertexList
=
constructVertexes
();
this
.
fitness
=
-
1
d
;
// Not calculated yet
this
.
fitness
=
-
1
d
;
// Not calculated yet
this
.
bonds
=
-
1
;
this
.
overlaps
=
-
1
;
}
}
private
ArrayList
<
Vertex
>
constructVertexes
()
{
private
ArrayList
<
Vertex
>
constructVertexes
()
{
...
...
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