E
E
Evgeny Ivanovich2015-11-18 19:06:26
Algorithms
Evgeny Ivanovich, 2015-11-18 19:06:26

How to solve such problems (search for maximum profit)?

It is required to draw up an optimal plan and calculate the maximum profit.
Given T units of time and n tasks,
the next n lines contain two natural numbers (xi, yi) - the time required to complete the task and the profit that can be obtained by completing it.
An optimal plan has two properties:

  • The total time spent on the tasks included in the plan does not exceed T.
  • The total profit from the implementation of these tasks was maximum.

For example, with input data:
10 3
8 100
3 10
3 10
Maximum profit:
100 (problem 1)
Example 2:
10 4
5 10
5 20
2 5
2 6
Maximum profit:
31 (problems 2,3,4)
Push to solve, advise what to read (but not the whole book, but a separate topic, Shen and Wirth, I'm already digging in search of similar problems). I just have not yet encountered similar problems and I want to solve it, just for myself.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
SeptiM, 2015-11-19
@makrushin-evgenii

https://ru.wikipedia.org/wiki/%D0%97%D0%B0%D0%B4%D...

V
Vitaly Vitrenko, 2015-11-18
@Vestail

The most common task of integer programming (not related to conventional programming at all).
Any such task is reduced to an objective function that needs to be maximized or minimized and constraints that must be met.
In your case (example 1), the objective function is:
100x 1 + 10x 2 + 10x 3 -> max (i.e. you need to maximize the sum, x i in this case - how many races the task is performed).
A limitation:
8x 1 + 3x 2 + 3x 3 <= 10;
x i - whole;
//if one task can be executed only by one race, then additional restriction: xi = {1, 0}.
To find a solution manually, there are several methods, the most universal is the simplex method.
You can calculate in excel with the help of "search for solutions". For serious problems with a large number of variables, there are special solvers, such as Gurobi.

K
kazmiruk, 2015-11-18
@kazmiruk

I remember at the university we were driven by similar tasks. Predmer game theory, the topic of maximum and minimum strategies

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question