How to solve the given problem?

Dennis Lee Bieber wlfraed at ix.netcom.com
Fri Mar 4 16:44:57 EST 2022


On Fri, 4 Mar 2022 10:02:30 -0800 (PST), NArshad <narshad.380 at gmail.com>
declaimed the following:

>You have made everything too complicated. Just adjust the units left in the second feed into the third and fourth feed because the fish is special and that's it.  The next day the second feed will be 100 units the way it used to be.
>
	My solution is generalized for 1) any number of periods in the day, 2)
mis-feed discovered at any point during the day, 3) works with any shape of
feeding schedule.

>What's wrong with the solution which I have written?

	Nothing IF you can justify that it meets the documented requirements.
>From your original post:

"""
Implement some methods to distribute the remaining 40 unit in the rest of
the day and propose the new patterns. Try to keep the distribution similar
to the current feeding pattern. 
"""

	Rephrased some, with emphasis, into what I see as the two major
requirements to be met:

*	distribute the remaining 40 unit IN THE REST OF THE DAY
*	TRY TO KEEP THE DISTRIBUTION SIMILAR TO THE CURRENT FEEDING PATTERN

	"Remaining 40 unit" is really a noise clause resulting only from the
/example/ input schedule and feedings. Any programmatic solution should not
know, ahead of time, what the schedule was, nor what the feedings actually
were. There is no sense to writing a program in which all the input data is
hard-coded -- you might as well hard-code the output too, while you are at
it. I consider "..some methods" to also be noise clause -- the alternative
interpretation is that you are supposed to create multiple programs doing
different types of solutions to the one problem.

	Assume, for example, that a fish#2 has a feeding schedule that looks
like:
		150	 100  20  20  20  20  20  20  100  150
(A big feed at start of day, an almost as large in second hour, six hours
at a constant 20, and then a large feed near the end, followed by a really
big feed to keep it happy overnight -- it seems to make more sense than
slowly starving the fish during the afternoon <G>).

	That planned distribution could be called a bathtub curve -- high start
and ends with a flat middle. (as a sideways histogram)

***************
**********
**
**
**
**
**
**
**********
***************

	Again, assume error in first two feeds as:

		150  60

	HOW DOES DUMPING THE 40 UNITS INTO HOUR 3 AND 4 SATISFY EITHER OF THE
REQUIREMENTS? (... rest of day, and similar distribution).

-=-=-=-
C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>rexx feedme.rex

Enter planned feeding schedule (feed units for each time period, space
separated)
150 100 20 20 20 20 20 20 100 150

Enter actual feeding schedule up to current feed period
150 60

PLAN    :   10 time periods   620 total feed units
ACTUAL  :    2 time periods   210 total feed units dispensed
MIS-FEED:                      40 underfed

SCHEDULE:     150     60  |>       23     22     22     22     22     22
111    166

C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>
-=-=-=-
	(I modified the script to put |> at the point where the modified
feedings begin)

	The result, as a histogram

***************
**********
**-
**.
**.
**.
**.
**.
***********.
****************+
(Not very visible as each * is 10 units, and using . for 2.5, - for 5, +
for 7.5)


-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	wlfraed at ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/


More information about the Python-list mailing list