YPEA Studio guide

Open the app Use YPEA in Python

How to describe an optimization problem in YPEA Studio, run it, and read, compare and share the result.

What YPEA Studio is

YPEA Studio, by Yarpiz, is a free app that runs in your browser. You describe an optimization problem in forms: the numbers it uses, what may change, what to make as small or as large as possible, and the limits a solution must keep. The app then searches for a good solution with a metaheuristic, which the app calls a solver, and shows the result in the terms of your problem.

You do not need to program, and you do not need to know the solvers to get a first answer. When you want more, you can compare solvers over repeated runs, share a project with a colleague, or continue in Python with the ypea package.

What stays on your computer

Everything. Your browser downloads the app from this site, and from then on all the work happens inside the browser. Nothing you type, import or compute is sent anywhere. There are no accounts and nothing to install.

A first project, from start to result

This walk uses the worked example "0/1 knapsack": 20 items, each with a weight and a value, and a bag that carries at most 50 kg. Which items give the largest total value? The data are synthetic.

Open the example

On the start page, under "Try an example", choose "0/1 knapsack". The example becomes a project of your own, so you can change anything in it. The project opens on its experiment, "Quick run". The sidebar lists the parts of the project. In a narrow window the sidebar is behind the menu button at the start of the header.

Look at the data

Choose "Data" in the sidebar. The project has one table, items, with two columns: weight in kg and value in $. The first 5 of its 20 rows are shown. Positions start at 0, so the first item is item 0 and the last is item 19.

Look at the variables

Choose "Variables". A variable is what the solver may change. This project has one, take. It holds "Yes or no values (0 or 1)" as a list of 20 values, one for each item: 1 means the item is taken and 0 means it is left.

Look at the objective

Choose "Objective". The goal is "Maximize", the unit is $, and the expression is:

sum(value * take)

Each value is multiplied by its 0 or 1 and the products are added up, which gives the total value of the items that are taken. Under the expression the app says "Checked: this gives one number." when the whole project has no problem.

Look at the constraints

Choose "Constraints". There is one, "Total weight". Its left side is sum(weight * take), its comparison is "at most (<=)", its right side is 50 and its unit is kg.

Test a candidate

Before any run, check that the problem says what you mean. Choose "Test a candidate", check the boxes of positions 0, 2 and 4, and press "Test this candidate". The app answers with an objective of 231 $ and a total weight of 18 kg, which is at most 50 kg, so the constraint holds and its breach is "None".

Now also check positions 1, 8, 11 and 17 and test again. The objective is 558 $, but the total weight is 72 kg. The constraint reads "No, broken", with the breach "Over by 22 kg (44% of the limit)". A wrong column or a wrong sign would show up here, in numbers you can check by hand.

Run

Press "Run", which is at the top of every part. Beside it the app says what will run: "Quick run: Genetic Algorithm, 20,000 evaluations, seed 1". An evaluation is one candidate that the solver tries. While the run goes on you see the best solution so far, and "Cancel" stops it. A cancelled run keeps nothing. This run is over in a moment.

Read the result

The result also says that it is one run of a randomized solver with a recorded seed. "Run again with a new seed" shows how much the answer moves from run to run. Under the result, "Download the report" and "Download the Python script" save the two files that are asked for most, and "All downloads" leads to the rest.

The workspace

The start page lists your projects, the worked examples, "New blank project" and "Open a project", which loads a project file from your computer. An open project is one screen:

A problem is shown next to the field that causes it, and the Overview part says what to fix first. A project that still has a problem does not run, and the app shows the part that holds the problem.

Data

Data are tables of numbers that you import from CSV files. There are two buttons, because a header row changes what a file means:

The values in a file may be separated by commas, semicolons or tabs. Every cell must be a number, and a message names the line and the column of a cell that is not. The table takes its name from the file, and names are tidied so that expressions can use them. You can change the names, give each column a unit, and remove a column you do not need. Units are labels only. Nothing is converted.

Variables

Variables are what the solver may change. "Add a variable" adds one, and "What it holds" sets its kind. The fields that follow depend on the kind: limits, a total, or the number of items.

Objective

The objective is one expression that gives one number, with the goal "Minimize" or "Maximize" and an optional unit. It can use the variables, the data and your functions by name, and sum, min, max, abs, len and ops. Arithmetic on a list works on every value of the list, so sum(value * take) needs no loop.

"Write the expression from a preset" writes the common ones for you: a weighted sum, the cost of a route, the total length of several routes, the total of selected items, the cost of an assignment, and the squared error of a straight line. What a preset writes is ordinary text that you can edit.

Constraints

A constraint is a limit that a solution must keep: a left side, a comparison ("at most", "at least" or "equal to") and a right side, with a name and an optional unit. "Add a constraint from a preset" writes a capacity limit or a limit on the largest load of a group. A project without constraints allows every candidate.

Functions

When one expression cannot hold the logic, write helper functions. They are written in a small part of Python: def, assignment, if, for and return. A function gets the variables it needs as arguments, and positions start at 0. There are no imports, classes, while loops or strings, and text that the app does not support is refused with a message and its line number.

The complete rules are in the language rules in the repository of the app on GitHub.

Drawing

A drawing shows a solution as a picture, while a run improves it and in its result. Under "What to draw" you choose "A route through points", "Several routes from one depot", "A fitted line over data points" or "Which items are chosen", and then name the variable and the columns it uses. With "No drawing" a solution is shown as a table. For routes, an optional table of distances lets the drawing give the length of each route.

Test a candidate

Here you try one solution by hand before any run. Type the values, or use "Fill from the baseline" or "Fill with a random candidate", then press "Test this candidate". The app shows the objective value, every constraint with both sides, and the drawing. Modeling mistakes show up here, where they are cheap.

The same part stores the two comparison values of a project. Every result is compared with them when they are given:

A result says "better" or "worse" only when both solutions keep every constraint.

Experiments and results

An experiment is one solver with a budget and a seed. A project can keep several, each with its own name, and each keeps the result of its last run. "New experiment" in the sidebar adds one: a copy of the experiment on screen, or, from any other part, one with the suggested solver. "Duplicate" also copies the one on screen.

In a blank project the first experiment starts with a suggested solver, with one sentence that says why, and a budget of 20,000 evaluations. The suggestion follows your variables: Covariance Matrix Adaptation Evolution Strategy for decimal numbers only, Simulated Annealing for orderings, selections and groups, and the Genetic Algorithm for yes or no values, for whole numbers, and for a mix of orderings with other kinds. The app only suggests. Once you change the solver, a setting or the budget, the experiment is yours and the app no longer touches it. When a solver was designed for other kinds of values than your project has, a note says so. It is a note and not an error, because such a solver may still work well.

A result states its status ("Best feasible solution found" or "No feasible solution found"), the objective, the differences from the baseline and the reference when they are given, every constraint, the solution, the evaluations used and the time. When no feasible solution was found, the candidate that breaks the constraints least is shown and marked as not feasible. If you change the project after a run, the result says that it belongs to the definition as it was then.

Compare experiments

One run of a randomized solver can be lucky or unlucky. This part runs each chosen experiment several times, every run with its own seed and all with the same budget, and describes the runs side by side. A first result does not need it.

The summary gives, for each experiment, the number of feasible runs, the evaluations used, and the median, the first to third quartile and the best value over the feasible runs only. A chart for each experiment shows the median and the middle half of the runs against the evaluations. The summary only describes the runs. It names no winner, ranks nothing and prints no significance test, so the conclusion is yours.

Share

This part holds every file you can take away. Each one is made in the browser and saved to your computer.

Undo, removing and renaming

Repeating a run

Every random choice of a run comes from its seed, so a run can be repeated exactly.

The exported Python script repeats the run outside the app, with the same solver, settings, budget and seed. It needs the ypea package (pip install ypea) and Python 3.12 or newer. This version of the app was tested with ypea 0.11.0, and the first lines of every script name that release and the command that installs exactly it. The Python run follows the app closely: number for number with most solvers, and within the last digits with Covariance Matrix Adaptation Evolution Strategy or with functions such as exp and log.

Limits

How to cite

Name the app, its maker, the version and the address, and add the day you used it. The version is printed under every result and in every report. This guide belongs to version 0.1.0.

Yarpiz. YPEA Studio, version 0.1.0. https://smkalami.github.io/ypea-studio/ (accessed on the day of use).

If your numbers come from the exported Python script, also name the release of the ypea package that ran it. For a result that others should be able to repeat, share the project file with results, which carries the seeds and the versions.

Roadmap

This is a list of directions, without dates and without promises.

In this version

Planned

Being considered

Not planned

Servers, accounts, live collaboration, and export to languages other than Python.