Skip to content

Commit

Permalink
completed OptimizableProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
rsfzi committed Jan 10, 2025
1 parent df0ddc7 commit a68221d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Require-Bundle: org.apache.log4j;bundle-version="1.2.19",
org.palladiosimulator.simexp.pcm.modelled;bundle-version="1.0.0",
org.palladiosimulator.simexp.dsl.ea.api;bundle-version="0.1.0",
org.palladiosimulator.simexp.dsl.ea.optimizer;bundle-version="0.1.0",
org.palladiosimulator.simexp.dsl.smodel.api;bundle-version="0.1.0"
org.palladiosimulator.simexp.dsl.smodel.api;bundle-version="0.1.0",
org.palladiosimulator.simexp.dsl.smodel.interpreter;bundle-version="0.1.0"
Bundle-SymbolicName: org.palladiosimulator.simexp.dsl.ea.launch;singleton:=true
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@

import org.palladiosimulator.simexp.dsl.ea.api.IOptimizableProvider;
import org.palladiosimulator.simexp.dsl.smodel.api.IExpressionCalculator;
import org.palladiosimulator.simexp.dsl.smodel.interpreter.DefaultSmodelConfig;
import org.palladiosimulator.simexp.dsl.smodel.interpreter.value.ConstantValueProvider;
import org.palladiosimulator.simexp.dsl.smodel.smodel.Optimizable;
import org.palladiosimulator.simexp.dsl.smodel.smodel.Smodel;

public class OptimizableProvider implements IOptimizableProvider {
private final Smodel smodel;
private final IExpressionCalculator expressionCalculator;

public OptimizableProvider(Smodel smodel) {
this.smodel = smodel;
ConstantValueProvider constantValueProvider = new ConstantValueProvider(new DefaultSmodelConfig());
this.expressionCalculator = constantValueProvider.getConstantExpressionCalculator();
}

@Override
Expand All @@ -22,8 +27,6 @@ public Collection<Optimizable> getOptimizables() {

@Override
public IExpressionCalculator getExpressionCalculator() {
// TODO Auto-generated method stub
return null;
return expressionCalculator;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.palladiosimulator.simexp.dsl.smodel.interpreter;

public class DefaultSmodelConfig implements ISmodelConfig {
@Override
public double getEpsilon() {
return 0.0001;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ public class SmodelInterpreter implements Analyzer, Planner, IResettable {
public SmodelInterpreter(Smodel model, IFieldValueProvider probeValueProvider,
IFieldValueProvider envVariableValueProvider) {
IFieldValueProvider optimizableValueProvider = new OptimizableValueProvider();
ISmodelConfig smodelConfig = new ISmodelConfig() {

@Override
public double getEpsilon() {
return 0.0001;
}
};
ISmodelConfig smodelConfig = new DefaultSmodelConfig();
IFieldValueProvider constantValueProvider = new ConstantValueProvider(smodelConfig);
variableValueProvider = new VariableValueProvider(smodelConfig, constantValueProvider, probeValueProvider,
optimizableValueProvider, envVariableValueProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public ConstantValueProvider(ISmodelConfig smodelConfig) {
this.expressionCalculator = new ExpressionCalculator(smodelConfig, this);
}

public IExpressionCalculator getConstantExpressionCalculator() {
return expressionCalculator;
}

@Override
public Boolean getBoolValue(Field field) {
Constant constant = (Constant) field;
Expand Down

0 comments on commit a68221d

Please sign in to comment.