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

Reorg sciml calibrate #2942

Merged
merged 11 commits into from
Mar 7, 2024
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { WorkflowPort, Operation, WorkflowOperationTypes } from '@/types/workflow';
// import type { CalibrationRequest } from '@/types/Types';
// import { makeCalibrateJob } from '@/services/models/simulation-service';
import { getModel } from '@/services/model';
import { Operation, WorkflowOperationTypes } from '@/types/workflow';

export interface CalibrateMap {
modelVariable: string;
Expand All @@ -28,8 +25,9 @@ export interface CalibrationOperationStateJulia {

// state specific to individual calibrate runs
extra: CalibrateExtraJulia;
simulationsInProgress: string[];
intermediateLoss?: Record<string, number>[];

inProgressSimulationId: string;
}

export const CalibrationOperationJulia: Operation = {
Expand All @@ -44,40 +42,19 @@ export const CalibrationOperationJulia: Operation = {
outputs: [{ type: 'simulationId' }],
isRunnable: true,

// TODO: Figure out mapping
// Calls API, returns results.
action: async (v: WorkflowPort[]) => {
// TODO Add more safety checks.
if (v.length) {
// TODO: The mapping is not 0 -> modelId as i am assuming here for testing
const modelId = v[0].value?.[0];
// let datasetId = v[1].value;
// let configuration = v[2].value; //TODO Not sure if this is a required input

// Get the model:
const model = await getModel(modelId);
if (model) {
// Make calibration job.
// const calibrationParam: CalibrationRequest = calibrationParamExample;
// const result = makeCalibrateJob(calibrationParam);
// return [{ type: 'number', result }];
return [{ type: null, value: null }];
}
}
return [{ type: null, value: null }];
},
action: async () => null,

initState: () => {
const init: CalibrationOperationStateJulia = {
chartConfigs: [],
inProgressSimulationId: '',
mapping: [{ modelVariable: '', datasetVariable: '' }],
extra: {
numChains: 4,
numIterations: 50,
odeMethod: 'default',
calibrateMethod: CalibrateMethodOptions.GLOBAL
},
simulationsInProgress: []
}
};
return init;
}
Expand Down
Loading
Loading