Aufgrund einer Wartung wird GitLab am 18.01. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 18.01. between 8:00 and 9:00 am.

Commit c5657cbd authored by Nicola Gatto's avatar Nicola Gatto
Browse files

Always add action range

parent 4266f83b
......@@ -193,30 +193,28 @@ public class ReinforcementConfigurationData extends ConfigurationData {
assert isReinforcementLearning(): "Strategy parameter only for reinforcement learning but called in a " +
" non reinforcement learning context";
Map<String, Object> strategyParams = getMultiParamEntry(AST_ENTRY_STRATEGY, "method");
if (strategyParams.get("method").equals(STRATEGY_ORNSTEIN_UHLENBECK)) {
assert getConfiguration().getTrainedArchitecture().isPresent(): "Architecture not present," +
" but reinforcement training";
TrainedArchitecture trainedArchitecture = getConfiguration().getTrainedArchitecture().get();
final String actionPortName = getOutputNameOfTrainedArchitecture();
Range actionRange = trainedArchitecture.getRanges().get(actionPortName);
if (actionRange.isLowerLimitInfinity() && actionRange.isUpperLimitInfinity()) {
strategyParams.put("action_low", null);
strategyParams.put("action_high", null);
} else if(!actionRange.isLowerLimitInfinity() && actionRange.isUpperLimitInfinity()) {
assert actionRange.getLowerLimit().isPresent();
strategyParams.put("action_low", actionRange.getLowerLimit().get());
strategyParams.put("action_high", null);
} else if (actionRange.isLowerLimitInfinity() && !actionRange.isUpperLimitInfinity()) {
assert actionRange.getUpperLimit().isPresent();
strategyParams.put("action_low", null);
strategyParams.put("action_high", actionRange.getUpperLimit().get());
} else {
assert actionRange.getLowerLimit().isPresent();
assert actionRange.getUpperLimit().isPresent();
strategyParams.put("action_low", actionRange.getLowerLimit().get());
strategyParams.put("action_high", actionRange.getUpperLimit().get());
}
assert getConfiguration().getTrainedArchitecture().isPresent(): "Architecture not present," +
" but reinforcement training";
TrainedArchitecture trainedArchitecture = getConfiguration().getTrainedArchitecture().get();
final String actionPortName = getOutputNameOfTrainedArchitecture();
Range actionRange = trainedArchitecture.getRanges().get(actionPortName);
if (actionRange.isLowerLimitInfinity() && actionRange.isUpperLimitInfinity()) {
strategyParams.put("action_low", null);
strategyParams.put("action_high", null);
} else if(!actionRange.isLowerLimitInfinity() && actionRange.isUpperLimitInfinity()) {
assert actionRange.getLowerLimit().isPresent();
strategyParams.put("action_low", actionRange.getLowerLimit().get());
strategyParams.put("action_high", null);
} else if (actionRange.isLowerLimitInfinity() && !actionRange.isUpperLimitInfinity()) {
assert actionRange.getUpperLimit().isPresent();
strategyParams.put("action_low", null);
strategyParams.put("action_high", actionRange.getUpperLimit().get());
} else {
assert actionRange.getLowerLimit().isPresent();
assert actionRange.getUpperLimit().isPresent();
strategyParams.put("action_low", actionRange.getLowerLimit().get());
strategyParams.put("action_high", actionRange.getUpperLimit().get());
}
return strategyParams;
}
......
......@@ -19,7 +19,7 @@
<#if (config.strategy.epsilon_decay_per_step)??>
'epsilon_decay_per_step': ${config.strategy.epsilon_decay_per_step?string('True', 'False')},
</#if>
<#if (config.strategy.method)?? && (config.strategy.method=="ornstein_uhlenbeck")>
<#if (config.strategy.method)?? && (config.strategy.method=="ornstein_uhlenbeck" || config.strategy.method=="gaussian")>
<#if (config.strategy.action_low)?? >
'action_low': ${config.strategy.action_low},
<#else>
......@@ -30,6 +30,8 @@
<#else>
'action_high' : np.infty,
</#if>
</#if>
<#if (config.strategy.method)?? && (config.strategy.method=="ornstein_uhlenbeck")>
<#if (config.strategy.mu)??>
'mu': [<#list config.strategy.mu as m>${m}<#if m?has_next>, </#if></#list>],
</#if>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment