use of org.vcell.util.IssueContext in project vcell by virtualcell.
the class ParameterEstimationRunTaskPanel method solve.
private void solve() throws NumberFormatException {
CopasiOptimizationMethod com = optimizationMethodParameterTableModel.copasiOptimizationMethod;
OptimizationSolverSpec optSolverSpec = new OptimizationSolverSpec(com);
// get num runs for stochstic opt mehtods before starting solving...
if (com.getType().isStochasticMethod()) {
int numRuns = Integer.parseInt(((String) numberOfRunComboBox.getSelectedItem()));
optSolverSpec.setNumOfRuns(numRuns);
}
parameterEstimationTask.setOptimizationSolverSpec(optSolverSpec);
parameterEstimationTask.getModelOptimizationSpec().setComputeProfileDistributions(computeProfileDistributionsCheckBox.isSelected());
optSolverCallbacks.reset();
Double endValue = com.getEndValue();
optSolverCallbacks.setEvaluation(0, Double.POSITIVE_INFINITY, 0, endValue, 0);
// (endValue != null);
getRunStatusDialog().showProgressBar(com);
Collection<AsynchClientTask> taskList = ClientRequestManager.updateMath(this, parameterEstimationTask.getSimulationContext(), false, NetworkGenerationRequirements.ComputeFullStandardTimeout);
AsynchClientTask task1 = new AsynchClientTask("checking issues", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
StringBuffer issueText = new StringBuffer();
java.util.Vector<Issue> issueList = new java.util.Vector<Issue>();
IssueContext issueContext = new IssueContext();
parameterEstimationTask.gatherIssues(issueContext, issueList);
boolean bFailed = false;
for (int i = 0; i < issueList.size(); i++) {
Issue issue = (Issue) issueList.elementAt(i);
issueText.append(issue.getMessage() + "\n");
if (issue.getSeverity() == Issue.SEVERITY_ERROR) {
bFailed = true;
break;
}
}
if (bFailed) {
throw new OptimizationException(issueText.toString());
}
parameterEstimationTask.refreshMappings();
}
};
taskList.add(task1);
AsynchClientTask task2 = new AsynchClientTask("solving", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
MathMappingCallback mathMappingCallback = new MathMappingCallbackTaskAdapter(getClientTaskStatusSupport());
// OptimizationResultSet optResultSet = CopasiOptimizationSolver.solveLocalPython(new ParameterEstimationTaskSimulatorIDA(),parameterEstimationTask,optSolverCallbacks,mathMappingCallback);
OptimizationResultSet optResultSet = CopasiOptimizationSolver.solveRemoteApi(new ParameterEstimationTaskSimulatorIDA(), parameterEstimationTask, optSolverCallbacks, mathMappingCallback);
hashTable.put(ORS_KEY, optResultSet);
}
};
taskList.add(task2);
AsynchClientTask setResultTask = new AsynchClientTask("set results", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
OptimizationResultSet optResultSet = (OptimizationResultSet) hashTable.get(ORS_KEY);
parameterEstimationTask.setOptimizationResultSet(optResultSet);
}
};
taskList.add(setResultTask);
ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), taskList.toArray(new AsynchClientTask[taskList.size()]), getRunStatusDialog(), true, true, true, null, false);
}
use of org.vcell.util.IssueContext in project vcell by virtualcell.
the class DocumentValidUtil method checkIssuesForErrors.
public static void checkIssuesForErrors(BioModel bioModel) {
Vector<Issue> issueList = new Vector<Issue>();
IssueContext issueContext = new IssueContext();
bioModel.gatherIssues(issueContext, issueList);
checkIssuesForErrors(issueList);
}
use of org.vcell.util.IssueContext in project vcell by virtualcell.
the class MathDescription method isValid.
public boolean isValid() {
IssueContext issueContext = new IssueContext(ContextType.MathDescription, this, null);
ArrayList<Issue> issueList = new ArrayList<Issue>();
gatherIssues(issueContext, issueList);
if (issueList.size() > 0) {
setWarning(issueList.get(0).getMessage());
}
return issueList.size() == 0;
}
use of org.vcell.util.IssueContext in project vcell by virtualcell.
the class IssueManager method updateIssues0.
/**
* @param immediate update now, skip check of {@link #LAST_DIRTY_MILLISECONDS}
*/
private void updateIssues0(boolean immediate) {
if (vcDocument == null) {
return;
}
if (!immediate) {
if (dirtyTimestamp == 0) {
return;
}
long elapsedTime = System.currentTimeMillis() - dirtyTimestamp;
if (elapsedTime < LAST_DIRTY_MILLISECONDS) {
return;
}
}
try {
VCDocumentDecorator decorator = VCDocumentDecorator.getDecorator(vcDocument);
numErrors = 0;
numWarnings = 0;
ArrayList<Issue> oldIssueList = new ArrayList<Issue>(issueList);
ArrayList<Issue> tempIssueList = new ArrayList<Issue>();
IssueContext issueContext = new ManagerContext();
decorator.gatherIssues(issueContext, tempIssueList);
// vcDocument.gatherIssues(issueContext,tempIssueList);
issueList = new ArrayList<Issue>();
for (Issue issue : tempIssueList) {
if (issue instanceof SimpleBoundsIssue) {
continue;
}
issueList.add(issue);
Severity severity = issue.getSeverity();
if (severity == Issue.Severity.ERROR) {
numErrors++;
} else if (severity == Issue.Severity.WARNING) {
numWarnings++;
}
}
fireIssueEventListener(new IssueEvent(vcDocument, oldIssueList, issueList));
// System.out.println("\n................... update performed .................." + System.currentTimeMillis());
} finally {
dirtyTimestamp = 0;
if (bMoreTime) {
setDirty();
bMoreTime = false;
}
}
}
use of org.vcell.util.IssueContext in project vcell by virtualcell.
the class MathOverrides method hasUnusedOverrides.
public boolean hasUnusedOverrides() {
ArrayList<Issue> issueList = new ArrayList<Issue>();
IssueContext issueContext = new IssueContext(ContextType.Simulation, getSimulation(), null);
gatherIssues(issueContext, issueList);
for (Issue issue : issueList) {
if (issue.getSeverity() == Issue.SEVERITY_ERROR && (issue.getCategory().equals(IssueCategory.Simulation_Override_NotFound) || issue.getCategory().equals(IssueCategory.Simulation_Override_NotSupported))) {
return true;
}
}
return false;
}
Aggregations