diff --git a/src/app/components/algorithms/algorithm.module.ts b/src/app/components/algorithms/algorithm.module.ts
index d6826c04..1a97b6fc 100644
--- a/src/app/components/algorithms/algorithm.module.ts
+++ b/src/app/components/algorithms/algorithm.module.ts
@@ -20,6 +20,9 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { BrowserModule } from '@angular/platform-browser';
import { MatSortModule } from '@angular/material/sort';
import { MatBadgeModule } from '@angular/material/badge';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatExpansionModule } from '@angular/material/expansion';
+import { MatSliderModule } from '@angular/material/slider';
import { NavigationBreadcrumbModule } from '../generics/navigation-breadcrumb/navigation-breadcrumb.module';
import { GenericsModule } from '../generics/generics.module';
import { ComputeResourcePropertyModule } from '../compute-resource-property/compute-resource-property.module';
@@ -89,6 +92,9 @@ import { CompareVersionDialogComponent } from './dialogs/compare-version-dialog.
MatSortModule,
QcAtlasUiFeatureToggleModule,
MatBadgeModule,
+ MatCheckboxModule,
+ MatExpansionModule,
+ MatSliderModule,
],
exports: [
AlgorithmListComponent,
diff --git a/src/app/components/algorithms/dialogs/add-new-analysis-dialog.component.html b/src/app/components/algorithms/dialogs/add-new-analysis-dialog.component.html
index 377fd06e..acfc6956 100644
--- a/src/app/components/algorithms/dialogs/add-new-analysis-dialog.component.html
+++ b/src/app/components/algorithms/dialogs/add-new-analysis-dialog.component.html
@@ -2,6 +2,7 @@
{{data.title}}
diff --git a/src/app/components/algorithms/dialogs/add-new-analysis-dialog.component.scss b/src/app/components/algorithms/dialogs/add-new-analysis-dialog.component.scss
index e69de29b..32f1ad90 100644
--- a/src/app/components/algorithms/dialogs/add-new-analysis-dialog.component.scss
+++ b/src/app/components/algorithms/dialogs/add-new-analysis-dialog.component.scss
@@ -0,0 +1,30 @@
+::ng-deep .mat-checkbox-label {
+ padding-right: 10px;
+}
+
+.aligned-with-slider{
+ position: relative;
+ margin-top: 5px;
+ margin-left: 5px; /* optional */
+}
+
+.center{
+ display: flex;
+ justify-content: center;
+}
+
+.lift-slider{
+ bottom: 7px;
+}
+
+::ng-deep .mat-slider-wrapper {
+
+ .mat-slider-thumb-container {
+ .mat-slider-thumb-label {
+ width: 40px;
+ height: 40px;
+ top: -55px;
+ right: -23px;
+ }
+ }
+}
diff --git a/src/app/components/algorithms/dialogs/add-new-analysis-dialog.component.ts b/src/app/components/algorithms/dialogs/add-new-analysis-dialog.component.ts
index aa55f833..60306d3a 100644
--- a/src/app/components/algorithms/dialogs/add-new-analysis-dialog.component.ts
+++ b/src/app/components/algorithms/dialogs/add-new-analysis-dialog.component.ts
@@ -6,6 +6,7 @@ import {
} from '@angular/material/dialog';
import {
AbstractControl,
+ FormArray,
FormBuilder,
FormControl,
FormGroup,
@@ -15,6 +16,7 @@ import { ParameterDto } from 'api-nisq/models/parameter-dto';
import { CloudServiceDto } from 'api-atlas/models/cloud-service-dto';
import { ExecutionEnvironmentsService } from 'api-atlas/services/execution-environments.service';
import { NisqAnalyzerService } from '../nisq-analyzer/nisq-analyzer.service';
+import { UtilService } from '../../../util/util.service';
@Component({
selector: 'app-add-new-analysis-dialog',
@@ -23,8 +25,22 @@ import { NisqAnalyzerService } from '../nisq-analyzer/nisq-analyzer.service';
})
export class AddNewAnalysisDialogComponent implements OnInit {
addNewAnalysisForm: FormGroup;
+ selectedVendors: string[] = [];
cloudServices: CloudServiceDto[];
parameters: ParameterDto[];
+ selectedCompilers: string[] = [];
+
+ ibmqEnabled = true;
+ ionqEnabled = false;
+ awsEnabled = false;
+ shortWaitingTimeEnabled = true;
+ stableExecutionResultsEnabled = true;
+ predictionAlgorithmInDialog = 'extra_trees_regressor';
+ metaOptimizerInDialog = 'none';
+ advancedSettingsOpen: boolean;
+ queueImportanceRatioDialog = 0;
+ maxNumberOfCompiledCircuitsDialog = 6;
+ disableDefiningMaximumNumberOfCircuits = false;
constructor(
public dialogRef: MatDialogRef,
@@ -32,19 +48,60 @@ export class AddNewAnalysisDialogComponent implements OnInit {
public dialog: MatDialog,
private formBuilder: FormBuilder,
private executionEnvironmentsService: ExecutionEnvironmentsService,
- private nisqAnalyzerService: NisqAnalyzerService
+ private nisqAnalyzerService: NisqAnalyzerService,
+ private utilService: UtilService
) {}
get params(): AbstractControl | null {
return this.addNewAnalysisForm.get('params');
}
- get cloudService(): AbstractControl | null {
- return this.addNewAnalysisForm.get('cloudService');
+ get vendors(): FormArray | null {
+ return this.addNewAnalysisForm.get('vendors') as FormArray;
+ }
+
+ get ibmqToken(): AbstractControl | null {
+ return this.addNewAnalysisForm.get('ibmqToken');
+ }
+
+ get ionqToken(): AbstractControl | null {
+ return this.addNewAnalysisForm.get('ionqToken');
+ }
+
+ get awsToken(): AbstractControl | null {
+ return this.addNewAnalysisForm.get('awsToken');
+ }
+
+ get awsSecretToken(): AbstractControl | null {
+ return this.addNewAnalysisForm.get('awsSecretToken');
+ }
+
+ get compilers(): FormArray {
+ return this.addNewAnalysisForm.get('compilers') as FormArray;
+ }
+
+ get shortWaitingTime(): AbstractControl | null {
+ return this.addNewAnalysisForm.get('shortWaitingTime');
+ }
+
+ get stableExecutionResults(): AbstractControl | null {
+ return this.addNewAnalysisForm.get('stableExecutionResults');
+ }
+
+ get predictionAlgorithm(): AbstractControl | null {
+ return this.addNewAnalysisForm.get('predictionAlgorithm');
+ }
+
+ get metaOptimizer(): AbstractControl | null {
+ return this.addNewAnalysisForm.get('metaOptimizer');
}
- get token(): AbstractControl | null {
- return this.addNewAnalysisForm.get('token');
+ get maxNumberOfCompiledCircuits(): AbstractControl | null {
+ return this.addNewAnalysisForm.get('maxNumberOfCompiledCircuits');
+ }
+
+ get queueImportanceRatio(): AbstractControl | null {
+ return this.addNewAnalysisForm.get('queueImportanceRatio');
}
ngOnInit(): void {
@@ -63,20 +120,69 @@ export class AddNewAnalysisDialogComponent implements OnInit {
})
)
),
- cloudService: new FormControl(this.data.cloudService, [
+ vendors: new FormArray([]),
+ ibmqToken: new FormControl(this.data.ibmqToken),
+ ionqToken: new FormControl(this.data.ionqToken),
+ awsToken: new FormControl(this.data.awsToken),
+ awsSecretToken: new FormControl(this.data.awsSecretToken),
+ compilers: new FormArray([]),
+ maxNumberOfCompiledCircuits: new FormControl(
+ this.data.maxNumberOfCompiledCircuits,
+ [
+ // eslint-disable-next-line @typescript-eslint/unbound-method
+ Validators.required,
+ ]
+ ),
+ predictionAlgorithm: new FormControl(this.data.predictionAlgorithm, [
+ // eslint-disable-next-line @typescript-eslint/unbound-method
+ Validators.required,
+ ]),
+ metaOptimizer: new FormControl(this.data.metaOptimizer, [
// eslint-disable-next-line @typescript-eslint/unbound-method
Validators.required,
]),
- // eslint-disable-next-line @typescript-eslint/unbound-method
- shotCount: [''],
- // eslint-disable-next-line @typescript-eslint/unbound-method
- token: new FormControl(this.data.token),
+ queueImportanceRatio: new FormControl(this.data.queueImportanceRatio, [
+ // eslint-disable-next-line @typescript-eslint/unbound-method
+ Validators.required,
+ ]),
+ shortWaitingTime: new FormControl(this.data.shortWaitingTime, [
+ // eslint-disable-next-line @typescript-eslint/unbound-method
+ Validators.required,
+ ]),
+ stableExecutionResults: new FormControl(
+ this.data.stableExecutionResults,
+ [
+ // eslint-disable-next-line @typescript-eslint/unbound-method
+ Validators.required,
+ ]
+ ),
});
+ this.selectedVendors = ['ibmq'];
+ for (const vendor of this.selectedVendors) {
+ this.vendors.push(new FormControl(vendor));
+ }
+ this.setCompilerOptions(this.selectedVendors);
+ this.predictionAlgorithm.setValue('extra_trees_regressor');
+ this.metaOptimizer.setValue('none');
+ this.maxNumberOfCompiledCircuits.setValue(6);
+ this.stableExecutionResults.setValue(true);
+ this.shortWaitingTime.setValue(true);
+
this.dialogRef.beforeClosed().subscribe(() => {
this.data.params = this.params.value;
- this.data.cloudService = this.cloudService.value;
- this.data.token = this.token.value;
+ this.data.vendors = this.selectedVendors;
+ this.data.selectedCompilers = this.selectedCompilers;
+ this.data.maxNumberOfCompiledCircuits = this.maxNumberOfCompiledCircuitsDialog;
+ this.data.metaOptimizer = this.metaOptimizerInDialog;
+ this.data.predictionAlgorithm = this.predictionAlgorithmInDialog;
+ this.data.queueImportanceRatio = this.queueImportanceRatioDialog;
+ this.data.shortWaitingTime = this.shortWaitingTimeEnabled;
+ this.data.stableExecutionResults = this.stableExecutionResultsEnabled;
+ this.data.ibmqToken = this.ibmqToken.value;
+ this.data.ionqToken = this.ionqToken.value;
+ this.data.awsToken = this.awsToken.value;
+ this.data.awsSecretToken = this.awsSecretToken.value;
});
});
}
@@ -96,12 +202,142 @@ export class AddNewAnalysisDialogComponent implements OnInit {
onNoClick(): void {
this.dialogRef.close();
}
+
+ updateCompilerSelection(compilerName: string, allowed: boolean): void {
+ if (allowed && !this.selectedCompilers.includes(compilerName)) {
+ this.selectedCompilers.push(compilerName);
+ } else {
+ this.selectedCompilers = this.selectedCompilers.filter(
+ (item) => item !== compilerName
+ );
+ }
+ if (this.selectedCompilers.length < 1) {
+ this.utilService.callSnackBar('Select at least one compiler');
+ }
+ }
+
+ checkIfCompilerSelected(compilerName: string): boolean {
+ return this.selectedCompilers.includes(compilerName);
+ }
+
+ checkIfCompilersAndProvidersPresent(): boolean {
+ if (this.selectedCompilers.length > 0 && this.selectedVendors.length > 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ setCompilerOptions(vendors: string[]): void {
+ const setOfAllAvailableCompilers = new Set();
+ for (const vendor of vendors) {
+ this.nisqAnalyzerService
+ .getCompilers(vendor)
+ .subscribe((availableCompilers) => {
+ for (const availableCompiler of availableCompilers) {
+ setOfAllAvailableCompilers.add(availableCompiler);
+ }
+ setOfAllAvailableCompilers.forEach((compiler) => {
+ if (!this.selectedCompilers.includes(compiler)) {
+ this.selectedCompilers.push(compiler);
+ }
+ });
+ this.compilers.clear();
+ for (const compiler of setOfAllAvailableCompilers) {
+ this.compilers.push(new FormControl(compiler));
+ }
+ });
+ }
+ }
+
+ setIbmqEnabled(enabled: boolean): void {
+ this.ibmqEnabled = enabled;
+ if (enabled) {
+ this.selectedVendors.push('ibmq');
+ } else {
+ this.selectedVendors = this.selectedVendors.filter(
+ (item) => item !== 'ibmq'
+ );
+ }
+ }
+
+ setIonqEnabled(enabled: boolean): void {
+ this.ionqEnabled = enabled;
+ if (enabled) {
+ this.selectedVendors.push('ionq');
+ } else {
+ this.selectedVendors = this.selectedVendors.filter(
+ (item) => item !== 'ionq'
+ );
+ }
+ }
+
+ setAwsEnabled(enabled: boolean): void {
+ this.awsEnabled = enabled;
+ if (enabled) {
+ this.selectedVendors.push('aws');
+ } else {
+ this.selectedVendors = this.selectedVendors.filter(
+ (item) => item !== 'aws'
+ );
+ }
+ }
+
+ setWaitingTimeEnabled(enabled: boolean): void {
+ this.shortWaitingTimeEnabled = enabled;
+ }
+
+ setStableExecutionResultsEnabled(enabled: boolean): void {
+ this.stableExecutionResultsEnabled = enabled;
+ }
+
+ setMaximumNumberofCompilationResultsSelected(enabled: boolean): void {
+ this.disableDefiningMaximumNumberOfCircuits = enabled;
+ if (enabled) {
+ this.maxNumberOfCompiledCircuitsDialog = 0;
+ } else {
+ this.maxNumberOfCompiledCircuitsDialog = 5;
+ }
+ }
+
+ setPredictionAlgorithm(predictionAlgorithm: string): void {
+ this.predictionAlgorithmInDialog = predictionAlgorithm;
+ }
+
+ setMetaOptimizer(metaOptimizer: string): void {
+ this.metaOptimizerInDialog = metaOptimizer;
+ }
+
+ setMaxNumberOfCompiledCircuits(event): void {
+ this.maxNumberOfCompiledCircuitsDialog = event;
+ }
+
+ setQueueImportanceRatio(event): void {
+ this.queueImportanceRatioDialog = event.value / 100;
+ }
+
+ formatLabel(value: number): number | string {
+ if (value >= 0) {
+ return Math.round(value) + ':' + Math.round(100 - value);
+ }
+ return value;
+ }
}
export interface DialogData {
title: string;
params: string;
- cloudService: string;
- token: string;
algo: string;
+ vendors: string[];
+ selectedCompilers: string[];
+ predictionAlgorithm: string;
+ metaOptimizer: string;
+ queueImportanceRatio: number;
+ maxNumberOfCompiledCircuits: number;
+ stableExecutionResults: boolean;
+ shortWaitingTime: boolean;
+ ibmqToken: string;
+ ionqToken: string;
+ awsToken: string;
+ awsSecretToken: string;
}