Sequential prize searching

There are $ N$ rooms. In each room $ i$ , with probability $ p_i$ one can find a prize. The cost of searching room $ i$ for the prize is $ c_i$ . A user can search at most $ n$ out of $ N$ rooms. If a prize is found, he gets a unit reward and stops searching. The problem is to find the sequence of rooms to be searched so as to maximize his expected utility defined as the reward minus the cost.

Mathematically, suppose the user searches rooms $ 1$ to $ n$ sequentially, his overall utility can be written as: $ $ U=1-(1-p_1)(1-p_2)\cdots(1-p_n)-[p_1c_1+(1-p_1)p_2(c_1+c_2)+\cdots+(1-p_1)\cdots(1-p_{n-2})p_{n-1}(c_1+\cdots+c_{n-1})+(1-p_1)\cdots(1-p_{n-2})(1-p_{n-1})(c_1+\cdots+c_n)].$ $

With some algebraic operations and by defining $ q_i=1-p_i$ , the problem of maximizing $ U$ can be mapped to the problem of minimizing the following function $ V$ : $ $ V=q_1\cdots q_n+(c_1+q_1c_2+q_1q_2c_3+\cdots+q_1\cdots q_{n-1}c_n).$ $

My question is how to solve the combinatorial optimization problem of minimizing $ V$ ? Is there any known problem that can help?

Is it possible to filter search results when searching in a modern document library?

I noticed that when I search for something in a document library and click “See All” for all the search results, the filter icon in the top right corner disappears and I am unable to use any of the columns to filter the results. Is this the intended behavior, and is there no way to enable filtering of search results? Or are users only going to be able to filter before searching?

enter image description here

Searching multiple substrings with OR in a DF column

I have a list of substrings( = variable ‘searchfor’ ) which I wish to use for searching and replacement in a DF column, cell value.

I want to search and replace for all occurrences of it.

example: let’s say my cell value of DF is like : ‘ Great touchscreen and nice to hold’

and my ‘searchfor’ list is = [‘ Battery life is great ‘ ,’ nice to hold ‘ ]

so I want output like: where ever any one of these strings are present in a row, ( The OR logic ) those DF rows should come up.

I could do it in python through single row iterator like itertuples, then inside each row instance, get the respective cell values, and using if else and regex expressions.

But can we do this without using row iterator? ( like directly by using a list comprehensions with regex expressions? )

I converted the ‘searchfor’ list to lower for correct matching

searchfor=[x.lower() for x in searchfor] 

I have found this ‘|’.join (searchfor) from below link : Python match the string of one column to the substring of another column And I think this gets me closer to do the job ( hence would be nice if we could retain this !)

      #The DF which I am using for this is as below DF= pd.DataFrame(     {'ID':[0,1,2],      'ReviewText':          [ '  Battery life is great and '           ,' works well for the need i have for it! '           ,' Great touchscreen and  nice to hold']      },     index=[0,1,2]) #   ID                                ReviewText #0   0                Battery life is great and  #1   1   works well for the need i have for it!  #2   2       Great touchscreen and  nice to hold  # Notice the ending spaces in reviewtext column elements.  # the searchfor list is as below searchfor = [' Battery life is great ' ,' nice to hold ' ]  #finally I tried something like this :  DF.loc[DF.ReviewText.str.lower().str.contains('|'.join(searchfor)), :] 

The expected answer is: 1st and 3rd should match and should come up in the result.

Attempt 1: when ‘hold’ word has ending space, then, output is empty DF ( it doesn’t match anything)

searchfor = ['Battery life is great ' ,' nice to hold ' ] DF.loc[DF.ReviewText.str.lower().str.contains('|'.join(searchfor)), :] #Empty DataFrame #Columns: [ID, ReviewText] #Index: [] 

Attempt 2 : when ‘hold’ word hos NO ending space, output is : that rows comes up, but ‘battery life ..’ row still doesnt match.

I think, Somehow there should be a regular expression added inside it, which takes care of these ending/starting and in between spaces.

Kindly help!

Searching New Reseller

I’m looking to change Reseller, I’m currently with Eleven2, their support is excellent BUT since a few months ago I suffer with their IP blo… | Read the rest of

Searching a Treasure

I was selected for a UG interview for computational natural science program and the following was one of the questions asked:

“Suppose we have an $ 8 \times 8$ grid. Under one of the blocks, I (the interviewer) have hidden a treasure which you have to find by asking questions to me. The questions are to be of the form – “Is it under this $ n \times n$ square (where $ n \le 8$ )?” For each question, I charge you some money and you have a finite amount with you. What is the least number of questions that you can ask to find where the treasure is?

I don’t have any background in high school computer science and while discussing this problem with a senior that the problem relates to “complexity” in computer science. Can somebody help me with this as a beginner?

How You Can Make Some Extra Money By Searching The Web

Did you ever realize you could be getting paid for searching the web? Yes, you could get paid for what you've already been doing all these years. Better late than never, right?

Qmee. com allows you to install a plugin in your Internet browser and whenever you make a search on Google or Yahoo, it'll show some sponsored ads along with your normal search results. Each result of Qmee will have cash attached to it. All you have to do is, click on it and get the cash for that result. Simple as it…

How You Can Make Some Extra Money By Searching The Web

Problem with searching String name in RecyclerView that contains String name and String subtext [on hold]

Well, I have a RecyclerView, whose Items contains name and subtext. I created a class MyObject in order to fill them. With my Adapter, I am filling the RecyclerView. I want to search for a String name in my RecyclerView and that the application showed all the Items whose names matching the search (including name and subtext). But I don’t know how I can do this. It is really hard to explain for me, so you will probably understand more from my code. I can provide more information or code if you need. (Sorry for some Russian text, but it doesn’t really matter anyway).

You can find my code here

When I am searching for Item’s name in Search, I want to see that application shows me Items with names that are matching the search and their subtext.

Searching for strings in live packet capture text file using python

I am performing live packet capture through Tcpdump and saving the result into a simple text file. What I am trying to achieve is to search for two or more strings in packet capture text file. Because packet capture output would never end (until we stop), I am not able to think about control flow of the program that I want to be written using python. One solution for this problem can be apending certain unique keyword after searching upto specific number of lines and then continuing from that keyword next time following same to next set of lines again. This will continue untill we stop packet capture data in flat file.

What I want –

If string1 found : Print “string1 found” If string2 found : Print ” string2 found” : : :

Android SPI driver, searching where to start

I want to write a SPI driver to connect a SPI IC and then an Android application to send data. From there, I don’t really know where to create the driver (and what it should contain) and how to link an application in top of that. I have a customisable Android kernel (9.0 Pie) with all its .dts, .dtsi, .c, and so on. Can someone point me in the right direction to link all that? I’ve been googling for a week and I don’t find the glue to all this.