An example of divergent thinking of AI when using 1C request copilot

American psychologist Joy Paul Guilford, a famous researcher of intelligence problems, once proposed the concept of divergent thinking. Guilford himself defined it as a type of thinking going in different directions. We are looking for all possible ways to solve one problem. We go beyond stereotypes and, as a result, find unexpected and super-effective methods. Divergent thinking is associated with creativity. A striking example of this thinking can be seen in the well-known story of Niels Bohr and the barometer.

Before the advent of generative language models, it was widely believed that artificial intelligence, when and if created, would be inferior to humans in creativity. Will act scrupulously, consistently, without mistakes, but in a formulaic manner. It turned out to be the opposite. How it looks in reality, when solving “boring” accounting problems in 1C, see below

I present the problem as it was formulated.

In general, there is a task, its essence:
The client's arrival is recorded from the day the hotel starts operating (for example, arrival day 3 means that the client arrived on the third day of the hotel's operation and left on the 8th day of the hotel's operation, etc.).

You need to write a program that would determine this day itself (you cannot use third-party objects in the form of registers, directories, etc.). There is a document with a schedule of departures and departures, you only need to build on it.
If there are several such days, display the first one.

Well… that's pretty much what users say. And now we will not engage in criticism of this text, but will simply “feed” its copy as is, without even specifying the database schema.

image

Answer:

SELECT day
FROM (
    SELECT arrival_day AS day
    FROM bookings
    UNION ALL
    SELECT departure_day + 1
    FROM bookings
) AS days
GROUP BY day
ORDER BY COUNT(*) DESC, day
LIMIT 1

Let's put all the events together and count. No, this of course doesn't work. Let’s “comb” the text, remove unnecessary and confusing elements from it. And at the same time we’ll add a diagram.

Question text:
This is a hotel. Calculate the day when there were the most people living in the hotel

Scheme:
MySQL#
Accommodation(guest, arrival_day, departure_day) #

Answer:

SELECT DATE, COUNT(*) AS NumberOfGuests
FROM
(
    SELECT a.Date
    FROM
    (
        SELECT день_заезда AS Date
        FROM Размещение
        UNION ALL
        SELECT день_отъезда
        FROM Размещение
    ) a
    WHERE a.Date BETWEEN (SELECT MIN(день_заезда) FROM Размещение) AND (SELECT MAX(день_отъезда) FROM Размещение)
) b
LEFT JOIN Размещение c ON b.Date BETWEEN c.день_заезда AND c.день_отъезда
GROUP BY DATE
ORDER BY NumberOfGuests DESC
LIMIT 1

image

Did not help. It persistently tries to operate through UNION. It is clear that there is a search for a solution through complication, but… no. Well, one more try. Let's just make the question a little more specific.

Question text:
This is a hotel. A guest is considered to be living at the hotel on a certain day if this day is greater than or equal to the guest's day of arrival and less than or equal to the day of departure. You need to get the day when there were the most people living in the hotel

Answer:

SELECT MAX(day_count) AS max_guests, day
FROM (
  SELECT COUNT(*) AS day_count, day
  FROM (
    SELECT a.day
    FROM (
      SELECT ADDDATE('1970-01-01', t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) day
      FROM
        (SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t0,
        (SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t1,
        (SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t2,
        (SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t3,
        (SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t4
    ) a
    JOIN Размещение b
    ON a.day >= b.день_заезда AND a.day <= b.день_отъезда
  ) c
  GROUP BY day
) d
ORDER BY day_count DESC
LIMIT 1

image

And here it is! A working solution using a day generator.
Let me explain what I see in this that deserves your attention. I have taught programming to adults and children for many years. And I know that if a person gets on some “rails,” it is often very, very difficult to get him off them. And it (I mean the large language model), although dumb, is creative! Making him find another solution is not at all difficult. And this is a very important point.
By the way, in the same discussion where this task was posed, a person proposed the following solution:

We combine selections from tabular parts in a query.
1 Date (Arrival Date)
Merge
-1 Date(Departure Date)
Group by date.
We connect the resulting table to itself using the condition Date<=Date, and group it by date.

As you can see, a solution through UNION also exists. You just need to add up arrivals and subtract departures. But the method proposed by the big language model is better because it is universal. You can not only determine the day of maximum occupancy of the hotel, but also the period when this occupancy was maintained. It is possible to obtain all periods with maximum load. Calculate percentage

What follows from all this? In my opinion, very good news. Now there is a lot of talk about how artificial intelligence will put people out of work. Whether it will be deprived or not, we'll see. Personally, I think that the fears here are greatly exaggerated. Much less conversations with a plus sign. Talk about what artificial intelligence will give us. And what he will give us is that, as I see it, we will all become more creative. Divergent and convergent types of thinking are not antagonists. On the contrary, they naturally complement each other. Pay attention to my actions in the example I described. I act quite convergently. Just improving my question step by step. And my co-pilot completes me. Searches and finds all possible solutions. And this, I believe, is the most important property of generative artificial intelligence models.

Well, you can learn about the classic solution of 1C problems in the framework of practical online courses. More information about the courses at the link.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *