Efficient way of picking a subset that fulfills criteria

AI Thread Summary
The discussion focuses on finding a subset P from a set S of n elements, represented as a sorted array of floating-point numbers, that meets specific conditions defined by functions f and g. The current method involves a brute force approach to test combinations of elements in P. However, it is noted that if f and g are monotonic functions, a more efficient strategy can be employed. This involves determining boundary values d1, d2, and d3 for the conditions f(P) and g(P) and rewriting the selection criteria based on these boundaries. By combining ranges where applicable and performing a binary search for the boundary values within S, the search for valid elements in P can be significantly optimized, reducing the computational complexity compared to exhaustive combination testing.
scienalc
Messages
16
Reaction score
0
Let's say there is a set of n elements, S. P is a subset of S, with m elements, and satisfies some conditions, i.e. c1 < f(P) < c2 and g(P) < c3, where f and g are some functions on the elements of P and c1, c2 and c3 are constants.

For practical purposes, S is represented as a sorted array of n floating point numbers.

The objective is to find which elements satisfy the above conditions.

My current approach is rather brute force, i.e. exhaustively trying out combinations. I'm wondering whether there is some more efficient way.
 
Technology news on Phys.org
In the general case of any f and g, no.

But, for example, if f and g are monotonic, then yes.
In that case:
-- find d1, d2, and d3 for f(d1)=c1; f(d2)=c2; and g(d3)=c3.
-- rewrite the selection criteria in terms of d1, d2, and d3: d1<P<d2 or d1>P>d2 and d3>P or d3<P.
-- if possible, combine those ranges. For example if d1<P<d2; P>d3; and d1<d3; then only d3<P<d2 is needed.
-- do a binary search in S for the d1, d2, and d3 values that remain boundary values.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
1
Views
1K
2
Replies
80
Views
9K
Replies
23
Views
2K
Replies
4
Views
2K
Replies
1
Views
2K
Back
Top