Skip to content

AMPL File Generation with Performance Indicator Topological Sorting #86

@martaroz

Description

@martaroz

Currently, performance indicators in the generated AMPL file are defined separately from their formulas. This results in a multi-step definition process, as seen below:

# Performance indicators = composite metrics that have at least one variable in their formula
var mean_cpu_consumption_all;
var mean_requests_per_second;

# Performance indicator formulas
subject to define_mean_cpu_consumption_all : mean_cpu_consumption_all = sum_cpu_consumption_all/spec_components_1_traits_0_properties_replicas;
subject to define_mean_requests_per_second : mean_requests_per_second = sum_requests_per_second/spec_components_0_traits_0_properties_replicas;

This formulation is inefficient from the solver perspective, because solver will treat the performance indicators as variables. Therefore, performance indicators should be defined directly within the formula:

var mean_cpu_consumption_all = sum_cpu_consumption_all/spec_components_1_traits_0_properties_replicas;
var mean_requests_per_second = sum_requests_per_second/spec_components_0_traits_0_properties_replicas;

It is important to note that AMPL loads the file line by line. If a performance indicator is used in a formula, it must be defined before its usage to avoid reference errors. This necessitates an approach to ensure the correct order of variable declarations through topological sorting of dependencies.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions