Algorithms – Splitting unpleasant people into compatible groups

We have a number of people who need to be grouped, but there may be people who do not like other individuals. Divide the people into the minimum number of groups so that no one is grouped with a person they do not like. (If A does not like A, A can not be in a group with B. Each person must belong to exactly one group.)

Incompatibilities between individuals are explicitly specified as disorganized person pairs that can not belong to a group.

Imagine a possible 10-person scenario in which incompatibility pairs are specified as follows:

(1,2) (1,6) (1,7) (2,3) (2,6) (2,7) (2,8) (3,4) (3,7) (3,8) (3,9)
(4,5) (4,8) (4,9) (4,10) (5,9) (5,10) (6,7) (7,8) (8,9) (9,10)

In this scenario, it is unacceptable to form a group consisting of persons (1, 4, 5) because the incompatibility pair (4,5) exists. This means that people 4 and 5 are incompatible and can not belong to the same group.

For the above scenario, we can optimally divide people into groups that get along with each other and use no less than 4 groups. Here's one way to sort people into 4 groups.

GROUP #1 : ( 1, 3, 5 )
GROUP #2 : ( 2, 4 )
GROUP #3 : ( 6, 8, 10 )
GROUP #4 : ( 7, 9 )

Note that the groups do not need to have the same number of members and that it is acceptable if a group consists of only one individual, if necessary. But each person must be assigned to a group.

Describe an algorithm with an arbitrary incompatibility matrix among N individuals in the form of zero or more incompatibility pairs to determine a compatible grouping with as few groups as possible.

Homologous algebra – an obstacle to splitting an object in a derived category into a sum of two-term complexes

To let $ mathcal {A} $ be an abelian category and $ D $ his limited derived class. An object $ M in D $ can be described as a list of cohomology objects $ H ^ i = H ^ i (M) $ along with some complicated glued data.

I am only interested in the case when $ mathcal {A} $ has homological dimension two. For example, $ mathcal {A} $ can be a category of contiguous discs on a smooth surface. In this case, the glued data is a collection of classes $ xi_i in mathrm {Ext} ^ 2 (H ^ i, H ^ {i-1}) $ between each pair of adjacent cohomology objects, with no restriction on selection.

By definition, an object $ M in D $ is quasi-isomorphic to a direct sum of complexes concentrated in a single degree (i.e., shifts of objects of $ mathcal {A} $) if and only if everyone $ xi_i $ disappears.

Likewise some objects in $ D $ are quasi-isomorphic to direct sums of complexes concentrated in two neighboring degrees. Is it possible to characterize this property by the disappearance of some obstacles resulting from the presentation of an object as a collection? $ {(H_i, xi_i) } _ {i in mathbb {Z}} $ above?

Bioinformatics – Splitting the Python Split () function for no apparent reason

I have a problem with the split () function. For some reason, it is split in a place that is not the delimiter ",". I'm reading a comma-separated file filled with genes and some attributes. but if i read this line from the file

G234064, essential GTP / GDP exchange factors (GEFs), translation complexes, α, PS00824,1, CELLULAR ORGANIZATION (proteins are localized on the corresponding organelle), cytoplasm.

but instead of dividing into 9 different items in a list, it divides into these 10:

('G240504',
  'Non-Essential',
  '?',
  '?',
  'Sensitivity to aminoacid analogs and other drugs',
  'PS00868',
  '12',
  'CELLULAR ORGANIZATION (proteins are localized to the corresponding '
  'organelle)',
  'cytoplasm.')

I could not find anyone with similar problems, this is the code I used

def main():
    file = open("Genes_relation.data.txt")
    readfile = file.readlines()
    genlist = ()
    for list in readfile:
        genlist.append(list.rstrip("n").split(","))

I expect an issue

('G240504',
  'Non-Essential',
  '?',
  '?',
  'Sensitivity to aminoacid analogs and other drugs',
  'PS00868',
  '12',
  'CELLULAR ORGANIZATION (proteins are localized to the corresponding 
   organelle)',
  'cytoplasm.')

Does anyone understand what's going on?

To avoid splitting the output in sqlplus

I run the following query to get a list of all PDBs with SQLPLUS and call each PDB NAME with for loop in the shell script.
Unfortunately, only a few PDB NAMES are split / interrupted in the output (eg, P DB1P016, PD B1P032, etc.), so the variable does not assign a correct / correct value.
Any idea to fix this?

SQL> select LISTAGG(a.name, ' ') WITHIN GROUP (ORDER BY name) as pdbs from v$pdbs a;

PDBS
-------------------------------------------------------------------------------------------------------------------------------------------------
IOC1P002 PDB$SEED PDB1P001 PDB1P002 PDB1P003 PDB1P004 PDB1P005 PDB1P006 PDB1P007 PDB1P008 PDB1P009 PDB1P010 PDB1P012 PDB1P013 PDB1P014 PDB1P015 P
DB1P016 PDB1P017 PDB1P018 PDB1P019 PDB1P020 PDB1P021 PDB1P022 PDB1P023 PDB1P024 PDB1P025 PDB1P026 PDB1P027 PDB1P028 PDB1P029 PDB1P030 PDB1P031 PD
B1P032 PDB1P033 PDB1P034 PDB1P035 PDB1P036 PDB1P037 PDB1P038 PDB1P039 PDB1P040 PDB1P041 PDB1P042 PDB1P043 PDB1P044 PDB1P045 PDB1P046 PDB1P047 PDB
1P048 PDB1P049 PDB1P050 PDB1P051 PDB1P052 PDB1P053 PDB1P054 PDB1P055 PDB1P056 PDB1P057 PDB1P058 PDB1P059 PDB1P060 PDB1P061 PDB1P062 PDB1P063 PDB1
P064 PDB1P065 PDB1P066 PDB1P067 PDB1P068 PDB1P069 PDB1P070 PDB1P071 PDB1P072 PDB1P073 PDB1P074 PDB1P075 PDB1P076 PDB1P077 PDB1P078 PDB1P079 PDB1P
080 PDBCUS12

Forms – Splitting credit card number fields into four different inputs

In principle, I would always choose the simplest solution. In this case, A single field for the user to enter,

For split fields, such as the 4-field field you suggested, an additional cognitive load is added to the user.

  • "Do I have to jump to each field manually?"
  • "Will the system do that for me?"
  • "What if I meet? tab but I myself jumped the form automatically – will it have instead jumped into the 3rd field …? "

All these additional questions – perhaps unconsciously, perhaps more in the head – are not questions that would even be dealt with in a single field form.

Sure, 4-field options help with readability. If the user enters his number incorrectly, it will be easier for him to reread his input to determine the area in which he made mistakes. However, this can still be mitigated in a single area. As shown above, you can render the user input with spaces in each field.

Another aspect is mobile users, While it may be simple on a desktop, a mobile phone has a keyboard that must be opened and closed when entering the field. Different devices and operating systems behave differently, but it is very likely that the keyboard automatically closes and opens when it jumps from box 1 to box 2, resulting in a jerky flash on the screen, possibly causing the user to try to close the box To move the keyboard to the 5th digit Move the cursor to another area of ​​the screen, or just miss this number when typing.

This mobile issue is vividly featured on the Baymard blog, where they also point out that mobile users tend to push manually into any field – something that desktop users do not often do.

Your suggestion is a nice idea, but I think it falls into the overdevelopment category. I do not think you need to introduce an alternative unless you notice significant user input errors in a single field. You could run the risk of reducing usability rather than improving it.

Substrings – Is there an algorithm for splitting parts of strings?

Let's say we have the strings Hello, World. Hello and World, The algorithm I think of would produce a steady buffer containing Hello, World and the previous three would then become references or slices of that one buf[0,11], buf[0,4], buf[7,11],

One way to implement this algorithm is to compare all new strings with the existing buffer and reuse it if possible, or append the new string if it does not. This would be very slow, but it should work. However, a case is treated as not efficient Hey, Hello because it would either attach it to the buffer, add it Hello again, or add Hey, to the beginning and update all indices.

If space saving is the optimal solution, this is the final buffer Hey, Hello, World,

Is there an algorithm that does something similar?

I've read about ropes and read this article, but I do not see how these would help.

Simulation of particle splitting (MATLAB – Fortran)

I am trying to write a code in which a charged particle (charge = + 20, called dimer) splits after a certain time into a neutral particle and a smaller charged particle (charge = -10, called monomer). I divide position and velocity into x, y, and z component matrices along with charge and fragmentation time matrices for each species (monomers, dimers, and neutrals).

The way the code works is to inject 1 dimer per time step, but whenever the fragmentation time of this dimer is reached, it turns into a monomer and a neutral particle. I've gotten the parts for the Injection and Pos / Vel update running, but fragmentation is causing me a lot of problems. Each time a fragmentation time is reached, I shift the dimer data (pos, vel) to the end of the monomer and neutral matrices and shift the last dimer data to overwrite the destroyed dimer.

When I run the code, the simulation seems to work correctly, but after about 17 cycles, the monomers and neutrals jump back to the original point where they split and rewrite the correct position from before.

The mistake seems to be to pass information from the dimer to the neutrals and monomers, but I'm not sure why this happens.

The code is shown below, with the main While Loop stopping the simulation once a certain number of particles have been injected. In the while loop, there are three for loops injecting particles, updating vel / pos, and checking for fragmentation (this is the loop that causes problems).

f_ind = (0,0,0);
qms0 = (-10,20);  %peak position (q/m)

t=0;
np = 0;  %number of particles total

npnew = (1,1);       %!injected particles for each species

%_______________________Main loop__________________________________________   
while (np+sum(npnew) <= npmax)   %if particles injected is less than max particle limit

    %INJECT PARTICLES
    for k=1:npeaks           %cycle through monomers (1) and dimers (2)
        for i=1:npnew(k)
            posx(i+f_ind(k),k)=0.0;     %x-pos
            posy(i+f_ind(k),k)=i*3;     %y-pos
            posz(i+f_ind(k),k)=k;     %z-pos

            velx(i+f_ind(k),k) = 0.01;  
            vely(i+f_ind(k),k) = 0.0;  
            velz(i+f_ind(k),k) = 0.0; 

            q_m(i+f_ind(k),k)=qms0(k);   %assign charge

            if (k==2)   %for dimers
                tfrag(i+f_ind(k),k)=t + 0.05;  %only set a fragmentation time for dimers
            end
        end 
        f_ind(k) = f_ind(k) + npnew(k);    %add to index to keep species particle count
        np = np + npnew(k);      %add particle count of each injected species to total particle count    
    end



    %UPDATE VELOCITY AND POSITION
    for k=1:(npeaks+1)       %cycle through monomer, dimers, and neutrals         
        for i=1:f_ind(k)     %only cycle up to the last index of each species(saves time not cycling empty spaces)
            velx(i,k) = velx(i,k) + Epx*(q_m(i,k))*dt;
            vely(i,k) = vely(i,k) + Epy*(q_m(i,k))*dt;
            velz(i,k) = velz(i,k) + Epz*(q_m(i,k))*dt;

            posx(i,k) = posx(i,k) + velx(i,k)*dt;     %x-pos
            posy(i,k) = posy(i,k) + vely(i,k)*dt;     %y-pos
            posz(i,k) = posz(i,k) + velz(i,k)*dt;     %z-pos
        end
    end



    %Fragment dimer if it reaches fragmentation time (ERROR IN THIS PORTION)
    for i=1:f_ind(2)
        if((t >= tfrag(i,2))&&(tfrag(i,2)>0))   

            %pass dimer information to monomer 
            posx(f_ind(1)+1,1) = posx(i,2);
            posy(f_ind(1)+1,1) = posy(i,2);
            posz(f_ind(1)+1,1) = posz(i,2); 

            velx(f_ind(1)+1,1) = velx(i,2); 
            vely(f_ind(1)+1,1) = vely(i,2);
            velz(f_ind(1)+1,1) = velz(i,2); 

            %assign monomer charge and update counter
            q_m(f_ind(1)+1,1) = -10;
            f_ind(1) = f_ind(1) + 1;    %update monomer index


            %pass dimer information to neutral
            posx(f_ind(3)+1,3) = posx(i,2);
            posy(f_ind(3)+1,3) = posy(i,2);
            posz(f_ind(3)+1,3) = posz(i,2); 

            velx(f_ind(3)+1,3) = velx(i,2); 
            vely(f_ind(3)+1,3) = vely(i,2);
            velz(f_ind(3)+1,3) = velz(i,2);         

            %assign neutral charge and update counter
            q_m(f_ind(3)+1,3) = 0;
            f_ind(3) = f_ind(3) + 1;    %update neutral index

            %destroy dimer and replace with the last dimer
            posx(i,2) = posx(f_ind(2),2);
            posy(i,2) = posy(f_ind(2),2);
            posz(i,2) = posz(f_ind(2),2); 

            velx(i,2) = velx(f_ind(2),2); 
            vely(i,2) = vely(f_ind(2),2);
            velz(i,2) = velz(f_ind(2),2);

            q_m(i,2) = q_m(f_ind(2),2);
            tfrag(i,2) = tfrag(f_ind(2),2);
            f_ind(2) = f_ind(2) - 1;    %update dimer index

        end
    end


    t = t + dt;          %progress time for ALL species not EACH species

end 

The picture below shows the dimers that are injected and decay into neutrals and monomers when their time is up. The simulation works to a certain point, but then it seems to double and bring particles to the dimer fragmentation point.

Enter image description here

Vampire of the Dark Ages – Splitting Dice Pool between actions with and without dice roll

I'm a bit confused with the rules for splitting the cube pool in situations where you want to take multiple actions and do not roll any of the actions.

Suppose I am a Ravnos and want to use Ignis Fatuus to create an illusion AND simultaneously attack with a sword. The first action does not require a die roll. Only the output of 1 point willpower. The second action requires a die roll. But what would happen? Could I just assign 1 dice to "use" my discipline (not dice but use willpower instead) and then use the rest of my pool to attack?

For reference only, I play vampires: Dark Ages

Multi-join with self-join in MySQL and column splitting in rows

I like four tables "Commission", "Vendors", "Accounts" and "comsplitconfig"

and rent

commissionid    vendorid    accountid   sales   commission
1               V1          A2          2000    100
2               V1          A1          1000    100
3               V2          A4          3000    150
4               V2          A2          4000    200
5               V2          A2          4000    200
6               V2          A5          5000    500

Vendor Table
vendorid    vendorname
V1          VEN1
V2          VEN2
V3          VEN3

Account Table
accountid   accountname parentid
A1          ACC1        NULL
A2          ACC2        A1
A3          ACC3        A6
A4          ACC4        A5
A5          ACC5        NULL
A6          ACC6        NULL

comsplitconfig table

vendorid    account_commission  parent_commission
V1          75                  25
V2          50                  50

and I wish that the result is so

vendorid    accountid   
V1          A2  
V1          A1          
V1          A1          
V2          A4  
V2          A5  
V2          A2  
V2          A1  
V2          A2  
V2          A1  
V2          A5  

The following query gives me thousands of multiple records.

SELECT commission.vendorid , Account.accountid, Account.parentid FROM commission 
INNER JOIN comsplitconfig ON comsplitconfig.vendorid = commission.vendorid 
LEFT JOIN (SELECT accountaccountid.accountid as oid, accountparentaccountid.accountid as cid FROM Account accountaccountid, Account accountparentaccountid WHERE accountaccountid.accountid != vaccountparentaccountid.accountid ) as u1 ON u1.oid = commission.accountid OR commission.accountid = u1.cid 
inner join Account on u1.oid = Account.accountid or Account.accountid = u1.cid