Changes from cc8c34d6bb0d7a658ba9f88f197af07974033916 to d8347c1c8cf619d3afb8c7cdea5cd685a5ceb833---
title: Abstract State of ClaferMoo Visualizer
title: Abstract State of ClaferMooVisualizer
toc: false
categories: dogfooding
...
> Back to [Clafer Tools](/ClaferTools/Overview)
[ClaferMoo Visualizer](https://github.com/gsdlab/claferMooVisualizer) is a graphical user interface (GUI) for multi-objective optimization space visualization and exploration for product lines. It is an interactive tool with complex state and many constraints among the GUI elements. In this page, we attempt to model the variability of the abstract state of the visualizer.
[ClaferMooVisualizer](https://github.com/gsdlab/ClaferMooVisualizer) is a web tool for visualizing and exploring the optimal variants of a multi-objective optimization problem, for example, a product line with quality attributes and optimization objectives.
It is an interactive tool with complex state and many constraints among the GUI elements.
On this page, we model the variability of the abstract state of the visualizer.
# The tool `ClaferMooVisualizer`
The visualizer can be in one of four states:
* `init`, when empty GUI is loaded and it is ready to open a file,
* `init`, when the empty GUI is loaded and it is ready to open a file,
* `loadingAndProcessing`, when a file is being loaded, compiled, and optimized,
* `error`, when the processing resulted in an error, and
* `ready`, when the GUI has been populated with optimization results and the users perform their tasks.
* `ready`, when the GUI has been populated with the optimization results and the users perform their tasks.
The visualizer also provides three main views: `graph`, `table`, and `analysis`, which are always opened in any state.
The visualizer also provides five views, which are always open in any state:
* `graph`, the *Bubble Front Graph*,
* `matrix`, the *Feature and Quality Matrix*,
* `spiderChart`, the *Spider Chart*,
* `parallelCoordinates`, the *Parallel Coordinates Chart*, and
* `comparer`, the *Variant Comparer*.
```clafer
abstract ClaferMooVisualizer
deployedAtURL -> string
xor state
`init
`loadingAndProcessing
`error
`ready
views
`graph
`table
`analysis
`matrix
`spiderChart
`parallelCoordinates
`comparer
```
For example, our [public instance of the visualizer](https://wiselab.uwaterloo.ca:8092) could be described as follows after it's loaded:
The names with a backtick, such as `` `init``, are clafers whose super is the abstract clafer of the same name, which is defined below.
For example, our [public instance of the visualizer](https://wiselab.uwaterloo.ca/clafervisualizer/) could be described as follows after it is loaded:
```clafer
viz1 : ClaferMooVisualizer
[ deployedAtURL = "wiselab.uwaterloo.ca:8092" ]
[ deployedAtURL = "wiselab.uwaterloo.ca/clafervisualizer/" ]
[ init ]
```
We model each abstract state individually.
## The state `init`
In this state, the visualizer is ready to either open a file from a provided `claferFileURL` or upload from the provided upload dialog.
In this state, the visualizer is ready to either open a file from a provided `claferFileURL` or upload a file selected in the upload dialog.
```clafer
abstract mux init
claferFileURL -> string ?
claferFileUpload -> string ?
claferFileURL -> string
claferFileUpload -> string
```
There are three possibilities here:
The children of a group, here `mux`, are optional, so `init` has at most one of them.
There are three possibilities:
1) the empty visualizer is opened
1) the empty visualizer is opened:
```clafer
viz2 : ClaferMooVisualizer
[ deployedAtURL = "wiselab.uwaterloo.ca:8092" ]
[ deployedAtURL = "wiselab.uwaterloo.ca/clafervisualizer/" ]
[ init ]
[ no claferFileURL ]
[ no claferFileUpload ]
```
2) the visualizer is opened with a `claferFileURL`, e.g., entering this URL `https://wiselab.uwaterloo.ca:8092/?claferFileURL=server/model.cfr` will first load the visualizer in this state:
2) the visualizer is opened with a `claferFileURL`.
For example, the button *Analyze with ClaferMooVisualizer* on the page [Android4](/MOO/Android4) opens the URL `https://wiselab.uwaterloo.ca/clafervisualizer/?claferFileURL=https://wiselab.uwaterloo.ca/modelwiki/clafer/MOO/Android4.cfr`, which first loads the visualizer in this state:
```clafer
viz3 : ClaferMooVisualizer
[ deployedAtURL = "wiselab.uwaterloo.ca:8092" ]
[ claferFileURL = "server/model.cfr" ]
[ deployedAtURL = "wiselab.uwaterloo.ca/clafervisualizer/" ]
[ claferFileURL = "https://wiselab.uwaterloo.ca/modelwiki/clafer/MOO/Android4.cfr" ]
```
3) after 1), the file is selected and the `Upload` button is pressed:
The visualizer only loads models from the URLs it is configured to allow, such as the model wikis.
3) after 1), a file is selected and the `Upload` button is pressed:
```clafer
viz4 : ClaferMooVisualizer
[ deployedAtURL = "wiselab.uwaterloo.ca:8092" ]
[ deployedAtURL = "wiselab.uwaterloo.ca/clafervisualizer/" ]
[ claferFileUpload = "model.cfr" ]
```
It is not possible to provide both the `claferFileURL` and `claferFileUpload` since the file from URL is processed immediately not giving the user to select the file and press the `Upload` button.
It is not possible to provide both the `claferFileURL` and `claferFileUpload`, since the file from the URL is processed immediately, without giving the user a chance to select a file and press the `Upload` button.
## The state `loadingAndProcessing`
In this state, the GUI is displaying the `Loading and Processing ...` message and then immediately transitions to either the state `error` or `ready`.
In this state, the GUI displays the message `Loading and processing...` and then transitions to either the state `error` or `ready`.
```clafer
abstract loadingAndProcessing
```
## The state `error`
There are a few possible errors that can occur during loading and processing.
A few errors can occur during loading and processing.
```clafer
abstract xor error
xor loading
invalidClaferFileURL -> string
parseError -> string
compileError -> string
missingGoals
temporalModel
xor processing
optimizationError -> string
timeout
outOfMemory
```
Only static models can be optimized: a temporal (behavioural) model is reported as not supported.
## The state `ready`
This is the main state in which the views are populated with data and the users can perform the optimization space exploration.
This is the main state, in which the views are populated with data and the users can explore the optimization space.
The optimization problem contains a number of quality `Dimension`s and optimization `Goal`s.
```clafer
abstract Dimension
abstract Goal
dimension -> Dimension
xor kind
minimizee
maximizee
```
For example, the [Android4](https://wiselab.uwaterloo.ca/modelwiki/MOO/Android4) optimization problem has four quality dimensions:
The names `minimize` and `maximize` are reserved words in Clafer, hence `minimizee` and `maximizee`.
For example, the [Android4](/MOO/Android4) optimization problem has four quality dimensions:
```clafer
performance : Dimension
energy : Dimension
security : Dimension
mass : Dimension
```
and four optimization goals:
```clafer
maxPerformance : Goal
[ dimension = performance ]
[ maximizee ]
minEnergy : Goal
[ dimension = energy ]
[ minimizee ]
maxSecurity : Goal
[ dimension = security ]
[ maximizee ]
minMass : Goal
[ dimension = mass ]
[ minimizee ]
```
there maybe more than four dimensions and goals.
Other problems may have more or fewer dimensions and goals.
in the state `ready`, the visualizer maintains and displays the list of the goals:
In the state `ready`, the visualizer maintains and displays the list of the goals in the window *Objectives and Quality Ranges*:
```clafer
abstract ready
goals -> Goal +
```
For example, the visualizer's state `ready` would look as follows:
```clafer
r1 : ready
[ goals = maxPerformance, minEnergy, maxSecurity, minMass ]
```
## The view `graph`
This view, displays bubbles in an up to four dimensional space at the same time. Each bubble represents an optimal product.
This view displays bubbles in an up to four-dimensional space. Each bubble represents an optimal product.
```clafer
abstract Product
abstract Bubble
x -> integer
y -> integer
opacity -> integer
size -> integer
product -> Product
prod -> Product
[ all disj b1; b2 : Bubble | b1.product != b2.product ] // disjoint
[ # Bubble = # Product ] // cover
[ all disj b1; b2 : Bubble | b1.prod != b2.prod ] // disjoint
[ # Bubble = # Product ] // cover
```
In our example problem, there will be 28 bubbles representing 28 optimal products:
In our example problem, there are 28 bubbles representing the 28 optimal products:
```clafer
products : Product 28
prods : Product 28
bubbles : Bubble 28
```
Different dimensions are visualized using four means: `xAxis`, `yAxis`, `opacity`, and `size`.
Different dimensions can be visualized by the above means as follows but no two means can display the same dimension.
The dimensions are visualized using four means: `xAxis`, `yAxis`, `opacity`, and `size`.
Each means displays one dimension and no two means can display the same dimension.
```clafer
abstract graph
xAxis -> Dimension
yAxis -> Dimension
opacity -> Dimension
size -> Dimension
[ xAxis != yAxis && xAxis != opacity && xAxis != size ]
[ yAxis != opacity && yAxis != size ]
[ opacity != size ]
bubble -> Bubble *
bubble -> Bubble 0..28
```
For example, the graph view will be loaded by default with the following assignment of dimensions:
For example, the graph view is loaded by default with the following assignment of dimensions:
```clafer
g1 : graph
[ xAxis = performance ]
[ yAxis = energy ]
[ opacity = security ]
[ size = mass ]
[ bubble = bubbles ]
```
the users can change which dimension will be displayed by which means.
This is particularly important in case there are more than four dimensions - the users can pick the four dimensions they want to visualize.
The users can change which dimension is displayed by which means.
This is particularly important when there are more than four dimensions: the users can pick the four dimensions they want to visualize.
TODO: assignment of `x`, `y`, `opacity`, and `size` values to bubbles from products.
TODO: assignment of the `x`, `y`, `opacity`, and `size` values of the bubbles from the products.
## The view `table`
## The other views
The *Feature and Quality Matrix* shows the features and the quality attributes of the products, the *Spider Chart* and the *Parallel Coordinates Chart* show their quality attributes, and the *Variant Comparer* shows the commonalities and differences of the selected products.
```clafer
abstract table
```
abstract matrix
## The view `analysis`
abstract spiderChart
```clafer
abstract analysis
abstract parallelCoordinates
abstract comparer
```
```{.clafer .summary}
```
End