Finding $l$ subsets such that their intersection has less or equal than $k$ elements NP-complete or in P?


I have a set $ M$ , subsets $ L_1,…,L_m$ and natural numbers $ k,l\leq m$ .

The problem is:

Are there l unique indices $ 1\leq i_1,…,i_l\leq m$ , such that

$ \hspace{5cm}\left|\bigcap_{j=1}^{l} L_{i_{j}}\right| \leq k$

Now my question is whether this problem is $ NP$ -complete or not. What irritates me is the two constraints $ l $ and $ k$ because the NP-complete problems that were conceptually close to it that I took a look on (set cover, vertex cover) only have one constraint respectively that also appears in this problem.

I then tried to write a polynomial time algorithm that looks at which of the sets $ L_1,…,L_m$ share more than $ k$ elements with other sets but even if all sets would share more than $ k$ elements with other this wouldn’t mean that their intersection has more than $ k$ elements…

This question kind of comes close but in it there is no restriction on the amount of subsets to use and the size of the intersection should be exactly $ k$ , but maybe this could be useful anyways.

Can somebody further enlighten me ?

Fastest land speed creature with HD of 8 or less?

In the interest of haunt shifting an undead creature into a carriage and getting the carriage to go fast, I am looking for what the haunting’s base creature should be. With templates, most creatures could be made undead, so we’re looking for:

  1. A creature that is, or can be made, undead
  2. Without getting above 8HD
  3. Featuring the highest available base walking speed
  4. Being controllable in a permanent manner by its method of creation or otherwise
  5. With as little ‘exotic material’ as possible – keep is as simple as we can.

Is it less secure to force periodic user logouts vs keep them logged in?

I’ve been unable to find any research or information on this.

Google periodically signs me out and forces me to sign back in. I have multiple devices and multiple google accounts so it’s a bit frustrating but that’s just how it is. However I was thinking about whether this practice is actually secure.

  1. It seems to encourage easy-to-remember / easy-to-type passwords over longer stronger passwords
  2. There’s more chance for a keylogger to intercept a password
  3. There’s more chance for a physical observer to watch you enter a password
  4. It may desensitise users and lead to them automatically entering their password without checking a url

How does this balance this against the inherent insecurity of indefinitely extending a login’s lifetime?

It’s worth noting that Google doesn’t ever log me out of my mobile device – I wonder why it treats this environment differently? Security vs UX concerns?

[ Politics ] Open Question : Why would anyone vote to give Trump another term when things have gotten so much worse under him already in less than four years?

Just look at the state of the country today: Massive protests in the streets. 40 million+ people out of work. 100,000+ people dead from coronavirus. Racial relations badly strained.

Can Homotopy Type Theory be used to derive more efficient algorithms on more efficient data representations from less efficient ones?

I’ve read here that in HoTT, compilers could swap out less efficient representations of data for more efficient ones and I’m wondering whether my interpretation of this statement is correct.

Say we have two different ways of representing the natural numbers, unary (zero and successor) and binary. Here is a function that checks evenness on the former representation:

even : UnaryNat -> Bool even zero = true even (succ zero) = false even (succ (succ n)) = even n 

If we then have an isomorphism between the unary and binary representations, we trivially get an evenness function for the binary representation “for free”, simply by converting a given binary natural number to a unary one, applying the even function, and converting the result back to the binary representation. Obviously, this is not very efficient, and we also don’t need HoTT for this.

A better way to check whether a binary natural number is even would be to check if its least significant digit is a zero. My question is: Could we derive this more efficient algorithm for binary natural numbers from our definition of evenness for unary natural numbers using HoTT? If so, would this also be possible for other data types? I haven’t studied any HoTT yet and since its appears to be a pretty complex subject I would like to find out whether it’s as exciting as I think it is. Thanks!

Predicted trajectory is less accurate at greater angles

I’m currently making a 2D Billiards game where the cue follows the players mouse around the ball, and when the user clicks the mouse it shoots the ball. I have a linerenderer running from the ball and it stops on whatever object it collides with. That works well, but I’m struggling with the predicted trajectory line. I have one working and it roughly shows where the ball will go, but the steeper the angle (the more side-on the shot is), the less accurate it becomes! Can anyone help me with this? Thanks.

     RaycastHit2D hit = Physics2D.Raycast(transform.position, transform.up);       hitPoint.position = hit.point;       Debug.DrawLine(transform.position, hitPoint.position);       float drawnLength = 2.0f;       var endpoint = (hit.point) - drawnLength * hit.normal;       ballAimer.SetPosition(0, transform.position);      ballAimer.SetPosition(1, hitPoint.position);      ballAimer.SetPosition(2, endpoint); 

EDIT:

It seems like a Circlecast might be my best solution so could someone help me adjust my raycast to a circlecast? I tried but just couldn’t get it working correctly… I added all the parameters I believe I need and changed the Physics2D.Raycast like so:

        RaycastHit2D hit = Physics2D.CircleCast(lineSpawn.transform.position, 1f, transform.up); 

lineSpawn is a variable I created to have as the origin of the line that sits right infront of the ball. The problem is that the straight line changes angle towards the ball now (presumably because it’s creating a circle collider and somehow that isn’t working correctly?) In the photo below the line renderer should be in line with the white rectangle.

Ball Curve

I know the main ball is slightly bigger as I was trying things out, but it happens no matter what. What can I do to fix this? I tried changing the radius in the circlecast but that just results in my original problem…

How can i make GURPS less intimidating for my friends?

I am a huge fan of GURPS due to the customization options as it has a lot of customization options but the mechanics boil down to ‘Roll 3d6. If it is below your modifier then you pass. 17 and 18 are critical failures. ‘ but whenever I bring it up my friends say it is way too complicated. So my question is how can i make GURPS appear less intimidating to players who have never tried it?

So far my friends have tried and liked

  • World Of Darkness
  • Burning Wheel

They tried but did not like these:

  • D&D 5e
  • Pathfinder

Is there some mechanisms in PHP to assign “less trust” to scripts in a given dir? (not a duplicate) [closed]

Kindly stop redirecting my questions to that unrelated one which doesn’t answer my question whatsoever. I’ve already read every answer there and it doesn’t help at all. If it did, why would I ask this much more specific question?

This has been a continuous worry and problem for me for ages:

For practical and logical reasons, I am forced to trust some third-party PHP libraries. These are installed, updated and managed with Composer, and live in C:\PHP-untrusted-external, entirely separated from my own PHP scripts, which live in C:\PHP-my-own.

The scripts in C:\PHP-my-own include and make use of the libraries in C:\PHP-untrusted-external.

Since there is no way that anyone, especially not I, could ever vet all the third-party code, and all updates, I’m looking for some way to “secure” or “sandbox” these in some way, even if it’s just partial.

Basically, I’m worried that one day, an update will make an edit such as:

unlink('C:\'); 

Or:

phone_home_to_hacker_server($  contents_of_my_harddrive); 

If that happened, the scripts would happily run and do those actions. Nothing prevents them from doing so.

Is there really no way to specify in the php.ini configuration file, something like:

security.sandbox_dir = "C:\PHP-untrusted-external" 

Or:

security.refuse_network_connections_for_dir = "C:\PHP-untrusted-external" security.refuse_disk_io_for_dir = "C:\PHP-untrusted-external" 

… or something like that?

I don’t understand Docker. I have tried it countless times, and it makes no sense whatsoever to me. I don’t want Docker. I don’t want to deal with containers. Correction: I can’t deal with it. I’ve tried to, but didn’t understand it. Several times.

I just want PHP to support this in itself, and it seems more than reasonable to me. Doesn’t it seem reasonable to you?

The saying that “at some point, you have to trust other people” is way too generic/vague to apply here. It’s bypassing the problem. I don’t trust people at all, and for good reason. It seems idiotic that we are (apparently) just supposed to sit around and wait for the disaster to happen. At least if I could prevent the third-party scripts form doing anything with the file system and network, that would go some way toward mitigating this issue. It still won’t make the scripts unable to lie about the numbers/data they return to me, but at least they can’t directly “phone home” or delete random files.

Can silk stop the raging Orc? or rather do fragile structures provide less cover?

The Player’s Handbook (pg. 196) reads

Walls, trees, creatures, and other obstacles can provide cover during combat, making a target more difficult to harm.

However it only defines degrees of cover (1/2, 3/4, Full) in terms of area covered. RAW it then seems that a curtain of silk provides as much cover cover against the attacks of a battle axe wielding Orc as a stone wall. Reasonably, however, it would make more sense just to confer the benefits of Unseen rather than the benefits of cover.

Rules as Written is there something I am overlooking and if not what is there a more reasonable system of adjudicating cover?