Logic to generate a pattern

Hi All,
The requirement is as follows...
Example:
Sum = 7
Availability Matrix = [5, 4, 6, 1]
Required: I need all set of possible unique combinations that sums to 7 out of the availability.
Few example combinations: [5, 2, 0, 0], [4, 3, 0, 0], [3, 4, 0, 0]
I also have a few questions...
+? Can we tell the number of unique number of solutions that can be formed well in advance.+
+? There are many solutions to this problem which one would be the good in terms of performance imagine when the availabilty matrix is huge+
Early help would be appreciated.
Thanks,
V

j_vijay_kumar wrote:
Sum = 7
Availability Matrix = [5, 4, 6, 1]
Required: I need all set of possible unique combinations that sums to 7 out of the availability.
Few example combinations: [5, 2, 0, 0], [4, 3, 0, 0], [3, 4, 0, 0]
What have those combinations got to do with the "availability matrix"?
It may be the same problem as [this one|http://www.codeguru.com/forum/showthread.php?t=463618] , but (maybe) a restricted set of values.
Can we tell the number of unique number of solutions that can be formed well in advance.Possibly. Do the math - you can make 7 one way with 1s, 3 ways with 2s and 1, 3 ways with 3s,2s,1s, 3 ways with 4,3s,2s,1s, 2ways with 5s..., 1ways with 6s... . You should be able to create a recurrence based on removing a value from N then the number of ways of calculating the result; then analyse that formula to see if it yields a direct one.

Similar Messages

  • Logic to generate some pattern

    Hi All,
    The requirement is something like this.......
    Example:
    Sum = 7
    Availability Matrix = [5, 4, 6, 1]
    Required: I need all set of possible unique combinations that sums to 7.
    Few example combinations: [5, 2, 0, 0], [4, 3, 0, 0], [3, 4, 0, 0]
    I also have a few questions...
    ? Can we tell the number of unique number of solutions that can be formed well in advance.
    ? There are many solutions to this problem which one would be the good in terms of performance imagine when the availabilty matrix is huge
    Early help would be appreciated.
    Thanks,
    V

    Please don't create more than one thread with the same question.
    Continues here: [http://forums.sun.com/thread.jspa?threadID=5345838]

  • Business logic services generate documentation

    Hi,
    RE: Business logic services > generate documentation
    xMII generates transaction documentation for small transactions but fails to do so with large transactions....nothing is returned.  I am currently using V 11.5.1 b63. Has anyone experienced this problem?
    Tom

    Hi,
    I am trying to find the note mentioned in the thread:
    "See note 960362, this outlines the steps necessary to increase the memory size the logic editor will allocate".
    I tried the search feature. As well as some hunting around on the SAP site but no luck. Can someone post the URL.   
    Thanks
    Tom

  • Creating logical locks generates two fm

    Hi Expert!,
      AS far I know, When we create logical locks in se11 transaction, two Function modules get generated by the the system.
    My Question is , is there any other Function module which gets generated by system?
    3rd FM?

    Hii  Mithilesh,
    When u create  a lock object In SE11 only 2 FMs  are generated by the system  that is "ENQUE" and "DEQUE" .as par  i know no third FM is generated automatically.
    regards,
    Archana

  • _dynSessConf - How to tweak logic to generate the random number.

    Hi,
    Can someone please let me know how we can tweak the logic when the random session confirmation number is generated and added as _dynSessConf.
    We have a requirement where this random number needs to be a bit longer than the currently generated default value.
    Regards,
    Saurav

    The session confirmation number used for _dynSessConf is already a randomly generated cryptographic number of long type which is hard to guess. Anyways, if you want to further modify it here is one of the approach that I can suggest.
    You can probably start with the component /atg/dynamo/servlet/sessiontracking/SessionIdGenerator in the component browser. In its details you will find it has a uniqueIdGenerator property which points to /atg/dynamo/servlet/sessiontracking/UniqueIdGenerator. Following on further it would eventually lead you to the components /atg/dynamo/service/random/SecureRandom and /atg/dynamo/service/random/SecureRandomConfiguration. Look at the service configurations of these components and see if you can get something which you can change or customize to meet your requirements.

  • How i need to write a logic to generate idoc for some of infotypes, when i change the single infotype

    Hi experts,
         I have an requirement , when I change any infotype record from pa30 or pa40, i.e
    suppose I am changing the infotype 0002  in pa30 , the idoc only generated for that changed infotype only,
    but I need it to generate the idoc for  some other infotypes also I.e(0000,0002,t528t, 0016).
    So please give me some help to generate idoc when I run a rbdmidoc(bd21).
    Thanks in advance.
    Venkat 

    yes, visible bounds is reading the non-visible masked objects too.
    you're going to have to do it the hard way, loop through all your objects to get your bounds manually, and while you're at it, test for clipping masks and use the masking path instead.

  • Logic has 400 Ultrabeat patterns....where?

    Apple says they have 400 new patterns for ultrabeat...where are they?
    I've found maybe 100 (max) attached to the various drum kits, but no pattern bank as such...
    Has anyone figured out this mystery?
    Many thanks for your help...
    John

    If each drum kit has 10 patterns, and there are 40 drum kits, the maths would add up.. no?
    And no, I haven't counted...
    Edit: I just had a brief survey - I counted about 60 odd kits just in the drum kits folders, and I loaded up a few of them - they each had at least ten patterns in...

  • Generate a pattern using the Pattern Maker

    This question was posted in response to the following article: http://help.adobe.com/en_US/photoshop/cs/using/WS2C24E0E4-712C-47ed-8BE3-6F2FF2CF6EF5.html

    What plug-in?
    Were there no instructions?
    Are you sure the plug-in is compatible with your Photoshop version?
    http://forums.adobe.com/message/4221311

  • Trying to generate pattern

    Hi All,
    I am trying to generate a pattern whose partial sample output is shown below.
    i=1 j=1 k=1
    i=1 j=1 k=2
    i=1 j=1 k=3
    i=1 j=1 k=4
    i=1 j=1 k=5
    i=1 j=1 k=6
    i=1 j=1 k=7
    i=1 j=1 k=8
    i=1 j=1 k=9
    i=1 j=1 k=10
    i=1 j=2 k=1
    i=1 j=2 k=3
    i=1 j=2 k=5
    i=1 j=2 k=7
    i=1 j=2 k=9
    i=1 j=2 k=2
    i=1 j=2 k=4
    i=1 j=2 k=6
    i=1 j=2 k=8
    i=1 j=2 k=10
    i=1 j=3 k=1
    i=1 j=3 k=4
    i=1 j=3 k=7
    i=1 j=3 k=10
    i=1 j=3 k=2
    i=1 j=3 k=5
    i=1 j=3 k=8
    i=1 j=3 k=3
    i=1 j=3 k=6
    i=1 j=3 k=9
    i=1 j=4 k=1
    i=1 j=4 k=5
    i=1 j=4 k=9
    i=1 j=4 k=2
    i=1 j=4 k=6
    i=1 j=4 k=10
    i=1 j=4 k=3
    i=1 j=4 k=7
    i=1 j=4 k=4
    i=1 j=4 k=8
    The value of k is incremented by the value of j at that particular time. Your help is appreciated. This is just the pattern I am trying to generate.
    My attempt to generate the output is:
    public class One {
         public static void main(String args[])
              Calculate();
         static void Calculate()
              for(int i=1;i<=10;i++)
                   for(int j=i;j<=10;j=j+i)
                        for(int k = 1;k<=10;k=k+j)
                             System.out.println("i="+i+" j="+j+" k="+k);
    }Thanks

    You can't use k to do the counting for the most inner loop. The most inner loop needs to run 10 times and ALSO needs to calculate a value to display as 'k'. This value starts at 1 and then increases 'j' with each iteration, never going over 10.
    You're almost there, now think about it a little more and finish this sucker yourself. Don't rob yourself of the eureka moment where you figure it out all on your own - that feeling (plus the satisfaction of actually finishing something) is what makes programming fun.

  • DG text pattern from delivery used in Sales Order or Purchase Order

    Has anyone tried to copy the logic for printing EHS DG text pattern from delivery for use when generating bill of lading from a Sales Order or Purchase Order?
    SAP logic is using delivery only - we have not found how to copy SAP code to generate text patterns without delivery.
    Wondering if anyone has had similar issue and what approach or solution was found.

    hello, friend.
    you do not have to change the requested delivery date.  the purpose of this date is to indicate a preliminary customer requirement date.  this date is relevant for MRP.
    but the system looks at this requested date and calculates if your system can fulfill the requirement on this date; in the process, the system considers all lead times such as production (if internally procured), purchasing (if trading goods/externally procured) and others (delivery, picking, packing, etc.).  if yes, this requested date is adopted as the schedule line (and earliest delivery creation) date.  if no, then the system will propose a later date (also becoming the proposed confirmed schedule line date).
    hope this helped you.
    regards.

  • Logical System is not appearing in Informer tab to check SOD's

    Hi GRC Experts,
    I have an issue with logical system to run risk analysis.
    I created logical system by following the Config guide, added physical system and generated rules (RAR Configuration>>Logical Systems>>Generate Rule) for that logical system.
    I haven't generated rules for the physical system (RAR Config>>Rule Upload>>Generate Rules) since I dont want more rules to be displayed in the reports.
    However I do not see logical system as an option in Risk Analysis (informer Tab) and Config>>Schedule background job for BAtch Risk Analysis>> under system as well.
    It would be great if any one advice me on this.
    Regards,

    Thanks Chinmaya,
    Yes you are right, I confirmed with a friend (my ex-GRC colleague) of mine as well.
    can't execute sod checks on a logical system - logical systems are only intended to eliminate the need to add the same rule set over and over for the same types of systems
    Regards,
    Ramesh K

  • How to ignore special characters in Logical SQL.

    Hi Experts,
    I am using Logical SQL generated from BI Answers in dataset of BIP Data model.
    The column name or presentation table name contains special character as “&, %’
    So when I try to create dataset using suppose following Logical SQL, I am getting prompt/error as
    “Please enter values for lexical references in SQL
    *~ description"."security name" s_9, ”
    Could you please suggest what should I do to ignore these special characters?
    SELECT
    0 s_0,
    "TEST_RPD"."Account"."As Of Date" s_1,
    "TEST_RPD"."Security Identifier & Description"."Security Name" s_9,
    "TEST_RPD"."Statistics"."Quality - S&P Rating" s_26,
    "TEST_RPD"."Statistics"."Yield To Maturity" s_27
    FROM "TEST_RPD"
    WHERE
    (("Account"."As Of Date" = date '2011-01-31') AND ("Account"."Report Account ID" = '1733'))

    Thanks..That is what we did in RPD.
    I was looking for any other approach as our RPD is shared between OBIEE and BIP.

  • Logical Standby working issues Oracle 9i, Windows

    Hi,
    Set up Oracle 9i Logical Standby on Windows. (instructions as per Oracle Documentation)
    Did not have any issues setting up.
    While setting up the Logical Standby, Recovered the Primary Database until Oct 10/09 8:16 pm
    Registered the archive log in the logical standby generated hence and the FAL took care of copying/registering the rest of the archivelogs.
    Created and inserted some records in Primary database and could see them in Standby.
    So far so good.
    On Oct11 data was entered into Primary database. Archivelogs were shipped to Standby, I could see them registered in DBA_LOGSTDBY_LOG.
    The APPLIED_SCN,NEWEST_SCN were in sync as per DBA_LOGSTDBY_PROGRESS.
    Today, we had some issues with data and when we queried the user tables: (no skip settings)
    Couldn't see any data in standby past the recovery...
    No errors reported in DBA_LOGSTDBY_EVENTS. No errors in Alert log also.
    What could be happening?
    Thanks,
    Madhuri

    I figured it out...
    Today, we had some issues with data and when we queried the user tables: (no skip settings)
    Couldn't see any data in standby past the recovery...I was using two tables as random spot check and both did not get updated. So, I was under the impression SQL APPLY did not do anything.
    But, it did apply the redo on the rest of the tables.
    These 2 tables in question were skipped because both of them had Function Based indexes.
    They are very huge individual tables .
    So, exporting them from Primary database and Importing them into Standby Database. Skipping DML in DataGuard.
    That solved the problem.
    --Madhuri                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Planned order and Purchase requistion both is generating in MRP

    Dear All,
    At the time of MRP explosion for Finished material, system is generating Planned order and purchase requistion, both,  for detailed material, (e.g. the BOM is a single level BOM). Whereas, I want to generate Purchase requistion for all. I am not getting that for which logic it generating Planned order as well as purchase requisition.
    Pl. explain.
    Thanks,
    Prasun.

    Hi Prasun
    The procurement proposal indicator dependes on the procurement type assigned in material master. If you assign prod Type F it will automatically generate PR. If the procurement type is E or X the system will generate plan order .
    This configured in Plan order type LA means it should be for in house production E.
    There are two ways of solving this. If you want always PR for FERT. Assign Proc type F in material master MRP view. It will always generate PR for that particular material.
    Or
    You can run MRP with planning mode 3 create PR in front screen.
    Regards
    J . Saravan

  • 6534 in Pattern Generation Input and Output

    Hello All
    I have a PCI 6534 High Speed Digital I/O card that I am trying to use to generate a pattern output from port A and acquire some data from port C. I have connected Port C, bit 0 to high and all the others low and I have also connected the two REQ pins together. This is to allow for the REQ pin from the pattern generation output to drive the input as an external clock. I have set the timebase as 1uS and the request interval as 10, to give a REQ pulse every 10uS. The idea being that the pattern generation output will generate a REQ pulse every 10uS and this would cause an input read to occur. My code can be found in the attached word file.
    Now initially I placed the DIG_Block_In command before the DIG_Block_Out and set the two counts to 100. For a single run of the application this filled my input buffer array with 50 elements of 257.... which I think is what I would expect as for a count of 100 it takes 2 to fill both the upper and lower 8 bits of the input array. OK....
    Now if I change the In Count to 200 and leave the Out Count at 100 I only fill 48 elements. I have no idea why this would happen. In my finall application I hope to increase the count to nearer 2000 and this loss of elements becomes significant.
    If I swap the DIG_Block_Out command to go before the DIG_Block_In then with both counts set to 100 I get no data acquired at all. If I increase both counts to say 2000, I actually acquire 944 elements, 56 less than I would expect? Why is this....?? Is it because the DIG_Block_Out command has already started the process before the DIG_Block_In command is initiated?
    Does anybody know what is going on here? I have had the same problem with a PCMCIA 6533 card (worse) and thought it would be solved with the PCI 6534. Does anybody know how I can ensure the correct numbers of data are acquired every time I run this operation? I need to be sure that all the desired data is being acquired as my final application is very dependent on this.
    Any help would be gratefully appreciated.
    Jamie
    Attachments:
    6534_Timing_Issues.doc ‏27 KB

    Hi Jamie,
    Whenever you are communicating from one group to the other on the 653x boards, you should have the input clocked on an external signal and you should have the output start AFTER the input process has started.
    As for why your input buffer is half your output buffer, it could be that the intermediate PC memory buffer is in terms of bytes and your application buffer was casting this data to a 2 byte word.
    I linked on one of your other posts 2 example programs. Adapting those might suit your needs best. Have a good day.
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HFORCEKWTID=75069:5&HOID=5065000000080000008BA10000&HExpertOnly=&UCATEGORY_0=_31_%24_12_&UCATEGORY_S=0
    Ron

Maybe you are looking for

  • Try to add the ESX to n1kv it give the below error got (vim.fault.PlatformConfigFault) exception

    Hello i m sharing to the forum the discussion we had in fb about my issue with a host see below: Guys anyone saw this error when u try to add the ESX to n1kv it give the below error vDS operation failed on host esxXX, An error occurred during host co

  • Plz can you help me. How to increase the Heap Size!!!!!!!!!!!

    Hi, i'm new to 10g appl server Failed to deploy web application "AGXI51". Failed to deploy web application "AGXI51". . The evaluate phase failed. The Adapter used in the evaluate may have thrown an exception. Resolution: Please call Oracle support. B

  • How to get Most current record in the reporting

    Hi All, I have reporting requiremnt  like to get the most recent record. Please see the below example we have 3 records but with 2 different sales represtentatives assigened to the same document.but i need to get most recently assigned sales represen

  • Javascript to check for duplicate entries in 2 pull-down lists

    I have created an application form in Acrobat 8 Professional, using LiveCycle and would like to compare selections in 2 drop-down lists so that the same option is not selected twice. I think this is something that could be done with javascript, but m

  • Erratic behaviour with iPod

    My iPod keeps behaving erratically. Sometimes it is detected and works fine with iTunes, other times is is not detected at all on my PC. I an unable to restore the software as iTunes throws up a "Unknown Error (-48)". Any help would be appreciated on