summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 53915d5ae84b71e002fbaec326b301ba20802b14 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Setup

## Install required software

Install Docker:

* (Mac, Linux) Follow the [installation instructions](https://docs.docker.com/get-docker/)
* (Windows): Follow the manual installation steps for Windows Subsystem for Linux [here](https://docs.microsoft.com/en-us/windows/wsl/install). On step 1, follow the recommendation of updating to WSL 2. You do not necessarily need to install Windows Terminal. Now go [here](https://docs.docker.com/desktop/windows/install/) and follow the "Install Docker Desktop on Windows" instructions. You can then start Docker Desktop and follow the quick start quide.

Install VS Code [using the instructions online](https://code.visualstudio.com/download).

## Open the folder in VS Code using "Dev Container"

Select File -> Open and select *the entire folder*.

VS Code will propose to install "Dev Container". Click "install".

VS Code will give you a message similar to:

> Folder contains a Dev Container configuration file. Reopen folder to develop in a container.

Select "Reopen in container".

Now you should have the folder open while VS Code is in "container development mode".

You can create a new terminal using Terminal -> New Terminal.

## Install dependencies

Install this package and dependencies using:

    pip install -e .

The main dependency installed is `ACT4E-mcdp` which is available [on this repo](https://github.com/ACT4E/ACT4E-mcdp).
That library takes care of parsing the models and queries.
Please refer to the [online documentation](https://act4e-mcdp.readthedocs.io/en/latest/) for more information.

If we tell you to update the library, use this:

    pip install -U ACT4E-mcdp

## Running the tests

Use this command to download the test cases:

    act4e-mcdp-download-tests --out downloaded

Then you have available a few test cases in the directory `downloaded/`.

This is the command you use to run the solver:

    act4e-mcdp-solve \
        --solver act4e_mcdp_solution.MySolution \
        --query FixFunMinRes \
        --model downloaded/lib1-parts.e03_splitter1.models.mcdpr1.yaml \
        --data '{f: 10}'

In turn:

* `--solver act4e_mcdp_solution.MySolution`: this selects your solver;
* `--query FixFunMinRes`: this selects `FixFunMinRes` (other choice: `FixResMaxFun`);
* `--model downloaded/lib1-parts.e03_splitter1.models.mcdpr1.yaml`: this selects the model to use for optimization;
* `--data '{f: 10}'`: this selects the query to give. It is a YAML dictionary with a key for each functionality name.

You will see the result in the logs:

```
INFO query: {'f': Decimal('10')}
INFO solution: UpperSet(minima=[])
```

The template `act4e_mcdp_solution.MySolution` always returns an empty `UpperSet` (= infeasible).
At this point, you can start implementing your solver.

For testing, run `act4e-mcdp-solve` on different files.


TODO: provide a exhaustive test case.