Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix simulate preset selection not triggering update #4921

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ const codeText = ref('');
const policyInterventionId = computed(() => props.node.inputs[1].value?.[0]);
const interventionPolicy = ref<InterventionPolicy | null>(null);
const timespan = ref<TimeSpan>(props.node.state.currentTimespan);
const llmThoughts = ref<any[]>([]);
const llmQuery = ref('');
// extras
// input params
const timespan = ref<TimeSpan>(props.node.state.currentTimespan);
const numSamples = ref<number>(props.node.state.numSamples);
const method = ref(props.node.state.method);
Expand All @@ -268,12 +268,12 @@ enum OutputView {
Data = 'Data'
}
const speedValues = Object.freeze({
const speedPreset = Object.freeze({
numSamples: 10,
method: CiemssMethodOptions.euler
});
const qualityValues = Object.freeze({
const qualityPreset = Object.freeze({
numSamples: 100,
method: CiemssMethodOptions.dopri5
});
Expand Down Expand Up @@ -315,10 +315,10 @@ const outputs = computed(() => {
});
const presetType = computed(() => {
if (numSamples.value === speedValues.numSamples && method.value === speedValues.method) {
if (numSamples.value === speedPreset.numSamples && method.value === speedPreset.method) {
return CiemssPresetTypes.Fast;
}
if (numSamples.value === qualityValues.numSamples && method.value === qualityValues.method) {
if (numSamples.value === qualityPreset.numSamples && method.value === qualityPreset.method) {
return CiemssPresetTypes.Normal;
}
Expand All @@ -338,13 +338,14 @@ const chartProxy = chartActionsProxy(props.node, (state: SimulateCiemssOperation
const setPresetValues = (data: CiemssPresetTypes) => {
if (data === CiemssPresetTypes.Normal) {
numSamples.value = qualityValues.numSamples;
method.value = qualityValues.method;
numSamples.value = qualityPreset.numSamples;
method.value = qualityPreset.method;
}
if (data === CiemssPresetTypes.Fast) {
numSamples.value = speedValues.numSamples;
method.value = speedValues.method;
numSamples.value = speedPreset.numSamples;
method.value = speedPreset.method;
}
updateState();
};
const groupedInterventionOutputs = computed(() => _.groupBy(interventionPolicy.value?.interventions, 'appliedTo'));
Expand Down Expand Up @@ -413,18 +414,16 @@ const run = async () => {
const makeForecastRequest = async () => {
const modelConfigId = props.node.inputs[0].value?.[0];
const state = props.node.state;
const payload: SimulationRequest = {
modelConfigId,
timespan: {
start: state.currentTimespan.start,
end: state.currentTimespan.end
start: timespan.value.start,
end: timespan.value.end
},
extra: {
solver_method: state.method,
solver_method: method.value,
solver_step_size: 1,
num_samples: state.numSamples
num_samples: numSamples.value
},
engine: 'ciemss'
};
Expand Down