Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
Model_ROUGHAGENU
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
VIPS
Models
Java
Model_ROUGHAGENU
Commits
e73e8dba
Commit
e73e8dba
authored
8 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Optimization: Check that we have MSC observations before attempting to optimize MSC
parent
dd850cdb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pom.xml
+2
-2
2 additions, 2 deletions
pom.xml
src/main/java/no/bioforsk/vips/model/roughagenutritionmodel/RoughageNutritionModelImpl.java
+30
-16
30 additions, 16 deletions
...el/roughagenutritionmodel/RoughageNutritionModelImpl.java
with
32 additions
and
18 deletions
pom.xml
+
2
−
2
View file @
e73e8dba
...
...
@@ -27,7 +27,7 @@
</dependencies>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.
7
</maven.compiler.source>
<maven.compiler.target>
1.
7
</maven.compiler.target>
<maven.compiler.source>
1.
8
</maven.compiler.source>
<maven.compiler.target>
1.
8
</maven.compiler.target>
</properties>
</project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/no/bioforsk/vips/model/roughagenutritionmodel/RoughageNutritionModelImpl.java
+
30
−
16
View file @
e73e8dba
...
...
@@ -260,7 +260,9 @@ public class RoughageNutritionModelImpl implements CostFunction {
boolean
first
=
true
;
Date
forrigeDato
=
null
;
for
(
Iterator
<
WeatherObservation
>
tempI
=
this
.
luftTemperaturVerdier
.
iterator
();
tempI
.
hasNext
();)
{
// Avoiding concurrentmodificationexception
List
<
WeatherObservation
>
tempCopy
=
new
ArrayList
<>(
this
.
luftTemperaturVerdier
);
for
(
Iterator
<
WeatherObservation
>
tempI
=
tempCopy
.
iterator
();
tempI
.
hasNext
();)
{
temperatur
=
tempI
.
next
();
// Beregner TS1
...
...
@@ -1612,9 +1614,7 @@ public class RoughageNutritionModelImpl implements CostFunction {
NelderMead
nelderMead
=
new
NelderMead
();
Collections
.
sort
(
this
.
observasjoner
);
// For å sikre oss mhp. en del datoavhengige rutiner
// Rekkefølge:
// 1. Optimerer parametre for utvikling
this
.
optimeringsMaal
=
RoughageNutritionModelImpl
.
OPTIMERING_UTVIKLING
;
/**
* Denne metoden forteller NelderMead-klassen om vi er "nær nok" til at
...
...
@@ -1645,22 +1645,35 @@ public class RoughageNutritionModelImpl implements CostFunction {
}
};
// Optimize only if we've got optimization observations
boolean
foundMSC
=
this
.
observasjoner
.
stream
().
filter
(
(
obs
)
->
obs
.
getMSC
()
!=
null
).
count
()
>
0
;
// Rekkefølge:
// 1. Optimerer parametre for utvikling
if
(
this
.
observasjoner
.
stream
().
filter
(
(
obs
)
->
obs
.
getMSC
()
!=
null
).
count
()
>
0
)
{
this
.
optimeringsMaal
=
RoughageNutritionModelImpl
.
OPTIMERING_UTVIKLING
;
// Rekkefølge for elementene: {alfa}
// Max og min-verdier for de ulike elementene:
// alfa {0.002-0.004}
double
[][]
verticesUtvikling
=
{{
0.0025
},
{
0.0035
}};
// Rekkefølge for elementene: {alfa}
// Max og min-verdier for de ulike elementene:
// alfa {0.002-0.004}
double
[][]
verticesUtvikling
=
{{
0.0025
},
{
0.0035
}};
PointCostPair
optimumUtvikling
=
nelderMead
.
minimize
(
this
,
1000
,
cChecker
,
verticesUtvikling
);
if
(
DEBUG
)
{
System
.
out
.
println
(
"[GrovforModell/optimerParametre] DEBUG: alfa="
+
optimumUtvikling
.
getPoint
()[
0
]);
}
this
.
alfa
=
((
Double
)
optimumUtvikling
.
getPoint
()[
0
]
);
//this.AIbeta = ((Double) optimumUtvikling.getPoint()[1]).doubleValue();
// Nullstiller AI-matrisen, slik at øvrige beregninger går som planlagt
this
.
AIBakgrunnsdataMatrise
=
null
;
PointCostPair
optimumUtvikling
=
nelderMead
.
minimize
(
this
,
1000
,
cChecker
,
verticesUtvikling
);
if
(
DEBUG
)
{
System
.
out
.
println
(
"[GrovforModell/optimerParametre] DEBUG: alfa="
+
optimumUtvikling
.
getPoint
()[
0
]);
}
this
.
alfa
=
((
Double
)
optimumUtvikling
.
getPoint
()[
0
]);
//this.AIbeta = ((Double) optimumUtvikling.getPoint()[1]).doubleValue();
// Nullstiller AI-matrisen, slik at øvrige beregninger går som planlagt
this
.
AIBakgrunnsdataMatrise
=
null
;
}
// 2. Optimering av parametre for avling
// Sjekker først om vi har observasjoner av avling i peroden før førsteslått og mellom førsteslått og andreslått.
boolean
avlingMaaltFoerFoersteslaatt
=
false
;
...
...
@@ -1938,6 +1951,7 @@ public class RoughageNutritionModelImpl implements CostFunction {
}
differanse
+=
Math
.
pow
(
maaltUtviklingstrinn
-
beregnetUtviklingstrinn
,
2
);
}
System
.
out
.
println
(
"Differanse="
+
differanse
);
return
differanse
;
}
...
...
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