Answer the question
In order to leave comments, you need to log in
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:
Answer the question
In order to leave comments, you need to log in
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question