summaryrefslogtreecommitdiff
path: root/tests/examplefiles/mosel/test.mos
blob: ccf17f687c86bd0a8a014a9636a9a1a3b9e3db27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(!*******************************************************
    Multiline comment
*******************************************************!)
model 'pygments test'
    uses "mmxprs"

    forward public procedure main    ! Test forward declaration

    public procedure main
        declarations
            MySet = {1, 2}
            I: range
            Coefficients: array(I) of real
            Vars: array(I) of mpvar
        end-declarations

        Coefficients :: [2.2, -3.3, 4.4, 5.5, 1.1, -3.3, 7.7]

        ! Single line comment
        forall (i in I) Vars(i) is_binary

        ! Constraint
        sum (i in I) Vars(i) <= 3

        maximize(sum(i in I) Coefficients(i) * Vars(i))

        forall (i in I| Vars(i).sol <> 0) do
            writeln("Vars(", i,") = ", Vars(i).sol)
        end-do
    end-procedure

    main
end-model