Generate all combinations of values that are less than array’s elements and have a sum = target

I want to find a way to generate sets that contain elements that sum to a certain target. Initially, I have an array that contains elements representing the maximum value that can be stored in that index.

For example, the input is [8,6,1] and the target is 10. The algorithm should produce all sets that have elements [ (<=8), (<=6), (<=1) ] such that their sum is equal to 10. Examples include: [8,1,1], [8,2,0], [7,3,0], …

A major consideration for this algorithm is that it should work on any input length (the above example has a length of 3).

I think the solution is close to the subset sum problem, but I wasn’t able to figure it out. Any help is appreciated.

Side note: python code is preferred, but Pseudo-code should be fine.

Thanks

Not getting Choice, as check-box, values from SharePoint list

I created a flow to convert SharePoint list items to a Word Document – everything works fine expect for the choice fields.

Choice fields data types are set to Check-box format is not returning values.

Followed this approch to create the flow

http://www.sharepointcorridor.com/2018/05/generate-word-document-from-sharepoint.html

Step 12 – First Method (Update file properties)

Any suggestions on how to get the choice fields (check-box) to show the value

Thanks for your time.

Bash script to take CPU temperature and CPU usage and save this values every second to file

I need to write script or command line code in Ubuntu which take CPU temperature and % of CPU usage from lm_sensors or something similar. This information I would like to save to .txt file with date and time of each measurement. I tried to write .sh file which is below. But it doesn’t work as I would like to. Can somebody help me?

while true; do echo $  ( date '+%H:%M:%S' ): $  ( sensors | grep 'CPU Temperature' | sed -r 's/^.*:        +(.*)  +[(].*$  //' ) >> temperature.txt; echo $  ( date '+%H:%M:%S' ): $  ( top -b -n 1 | grep 'CPU:') >> cpu.txt; sleep 1;  done 

How do I restrict an interpolated function to only take values > 0?

I have a list of points which looks like this when plotted with Joined -> True:

enter image description here

I’m interested in the area under the curve with x-axis > 0 as a ratio to the area under the curve as a whole. The obvious way to do this is to define function = Interpolation[list], then use Integrate[function[x],{x,0,Infinity}/Integrate[function[x]],{x,-Infinity,Infinity}].

However, for some of the parameters used to generate this plot, this ratio goes above one. My reading is that the interpolated function goes negative at some point. I know for physical reasons that the function is strictly positive (it is an unnormalized probability). Is there a way to feed this restriction to Interpolation, or perhaps to simply zero out the interpolated function past a certain point?

Edit: some explicit code that shows the problem I’m facing. For this list:

{{-2.,-1.5,-1.,-0.5,0.,0.5,1.,1.5,2.,2.5,3.,3.5,4.,4.5,5.},{2.447482917*10^-26,7.166525422*10^-23,6.828228711*10^-20,2.221078019*10^-17,2.603521623*10^-15,1.167198034*10^-13,2.134212354*10^-12,1.702246816*10^-11,6.341646627*10^-11,1.183984093*10^-10,1.195443416*10^-10,7.082172125*10^-11,2.655421922*10^-11,6.681130557*10^-12,1.175390799*10^-12}}

(first list is x-axis values, second list is y-axis values). Define interpolating function:

Testfunc = Interpolation[{2.447482916954607`*^-26, 7.166525421661271`*^-23, 6.82822871054717`*^-20, 2.2210780189277698`*^-17, 2.6035216228330743`*^-15, 1.1671980340015243`*^-13, 2.134212354193162`*^-12, 1.7022468159138925`*^-11, 6.341646627292107`*^-11, 1.1839840933620157`*^-10, 1.195443415545412`*^-10, 7.082172125430078`*^-11, 2.655421922388246`*^-11, 6.681130557379854`*^-12, 1.1753907990705456`*^-12}]

Take the numerical integral: NIntegrate[Testfunc[x], {x, 5, 15}]/NIntegrate[Testfunc[x], {x, 1, 15}]

Result is: 1.000008312

How to deal with unknown values when filtering items

Let’s say I have a hotel booking website. Once the user chooses a date and a location the website will list all available hotel rooms in a given area. Each hotel room comes with many attributes, for instance, whether has a pool, offers free wifi, includes a breakfast, whether it requires a deposit and is refundable, etc.

enter image description here

The problem in the real world is that the information about all those different hotels comes from multiple aggregators and “distribution systems” and these often do not provide the same attributes. So it can happen that a hotel has a beautiful pool but it is “distributed” through a system that does not even have a data field for pools. This poses a great problem to the ability to filter results. Of course, the easiest thing to do is to filter only by the information that is available: if we don’t know whether a hotel has a pool, don’t show it when filtering by pools. But this only works when unknown attributes are rather rare, not when a substantial part of the attributes can be unknow.

Is there a way to show the “unknown/maybe” result? Or is the filtering parading not suitable at all when the uncertainty of available attributes is too high?

Search refinement “No values found” Sharepoint Online

I have multiple custom fields that I have mapped to the RefineableString fields. All of them are set to a “Multi-value Refinement Item”. In the Sample Values I get “No values found”.

Refinement is working for OOTB items like Author and Created. enter image description here

This image is how the document one of the values is defined: enter image description here

Any help would be greatly appreciated!

What’s a good way to find a near optimal or optimal state in a graph without heuristics or values?

What’s a good way to find the optimal solution in a graph with no heuristics or knowledge of the value of that state until we are there? Is there a good way to perhaps create an estimate? I’ve looked into things like value iteration and policy iteration as well as Q-learning, but what if another issue is evaluating the true reward of a state is very costly?

Are type abstraction values and universal types not for non functions, but only for functions?

In Types and Programming Languages by Pierce, Chapter 23 Universal Types has a summary of System F in the following figure, in particular, “type abstraction values” and their types “universal types”.

In all the examples I have seen so far in the chapter, in particular Section 23.4 Examples, (not sure if I miss any example):

  • all the type abstraction values are parametrically polymorphic functions, by allowing the types of their arguments to have any type, and
  • all the universal types, i.e. the types of type abstraction values, are types of parametrically polymorphic functions.

Are type abstraction values and their universal types not for non functions, but only for functions?

More specifically, in any type abstraction value, say $ \lambda X.t$ , must $ t$ have a function type, not a non-function type?

In Section 23.4 Examples, values of base types and of recursive types are type abstraction values, because their definitions in the section are functions by Church encodings.

Thanks.

enter image description here

Extract different text values from the title using calculated column

I am looking to find a way to extract text from the TITLE of an item when that text value could be different.

Example:
TITLE = N10 2019-2020 Kilo Project R Sec All Data
Calculated column called Section to pull out the section information (R Sec) is:

=TRIM(MID(Title,SEARCH("sec",Title)-2,5)) 

This results in "Kilo Project; however the title of the section can be different in 4 ways
1. sec
2. national
3. set’s
4. SHQ

They all have to be entered into the same calculated column Section so I thought about making a nested IF and haven’t been successful in find a solution as everytime I try to I will get an error with the value (testing in excel).

Thanks in advance.

What values does “ows_q_USER_Author” collect?

Dears,

From which SharePoint columns/fields does ows_q_USER_Author collect values?

It seems to be a USER (People & Group?) type of column.

Do you have any idea where the ows_q_USER_Author property is “located”?

I found MicroSoft description related to managed property AuthorOWSUSER: The name of the user who created the page, but I’m not really sure it works only for pages.

Regards,

Aga