

![0_image_0.png](0_image_0.png)

## 3.1.1 Class Artifacts

Class artifacts have by default three compartments, the upper compartment for the class name, the middle compartment for attributes and the bottom one for constraint zones. By clicking on the class artifact its specification can be opened to define its class name, their attributes and constraint zones. Relationships can be used to define inheritance (a subclass inherits all attributes and constraint zones of its superclass) or composition between classes.

## 3.1.2 Data Artifacts

Data artifacts have two compartments, one for the file name and another for both the constants and variable-assignments. Constants, also called data variables can be defined with a real, integer or enumeration type. Arrays of one dimension and arrays of two dimensions of constants are allowed. Variable-assignment corresponds to the assignment of a value to a variable of an object. Variableassignments can also be performed if objects are inside an array
(see an example in Section 3.2).

![0_image_2.png](0_image_2.png)

1 Artifacts used on the **s-COMMA GUI** have been adapted from the class artifact provided by the UML Infrastructure Library Basic Package. This adaptation is completely allowed by the UML Infrastructure Specification [23].

## 3.1.3 Attributes

Attributes may represent decision variables, sets, objects or arrays.

Decision variables can be defined by an integer, real or boolean type. Sets can be composed of integers or enumeration values.

Objects are instances of classes which must be typed with their class name. Arrays of one and two dimensions are allowed, they can contain decision variables, sets or objects. Decision variables, sets and arrays can be constrained to a determined domain.

## 3.1.4 Constraint Zones

Constraint zones are used to group constraints encapsulating them inside a class. A constraint zone is stated with a name and it can contain the following elements:
- *Constraints:* Typical operations and relations are provided to post constraints. For example, comparison relations (**<,>,**
<=,>=,=,<>), arithmetic operations (**+,*, -,/**), logical relations (**and,or,xor, ->,<-,<->**), and set operations (in, subset, superset, union, diff, symdiff, intersection, cardinality).

- *Statements:* Forall and conditional statements are supported.

The forall (e.g. **forall(i in 1..5)**) is stated by declaring a loop-variable (i) and the set of values to be traversed (**1..5**).

A loop-variable is a local variable and it is valid just inside the loop where it was declared. Conditionals are stated by means of if-else expressions. For instance, **if(a) b else c;** where a is the condition, which can includes decision variables; and b and c are the alternatives, which may be statements or constraints.

- *Objective:* objective functions are allowed and they can be stated by tagging the expression involved with the selected option (e.g. **[minimize] x+y+z;**).

- *Global Constraints*: a basic set of global constraints (e.g. alldifferent, cumulatives) is supported. Additional constraints can be integrated to this basic set by means of extension mechanisms
(for details refer to [29]).

## 3.2 The Stable Marriage Problem

Let us now illustrate some of these concepts in the **s-COMMA GUI**
by means of the stable marriage problem.

![0_image_1.png](0_image_1.png)

Consider a group of n women and a group of n men who must marry. Each women has a preference ranking for her possible husband, and each men has a preference ranking for his possible wife.

and the data concept is represented by the data artifact1(see Figure 4).