Search Results

Search found 4955 results on 199 pages for 'range'.

Page 88/199 | < Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >

  • How to generate and encode (for use in GA), random, strict, binary rooted trees with N leaves?

    - by Peter Simon
    First, I am an engineer, not a computer scientist, so I apologize in advance for any misuse of nomenclature and general ignorance of CS background. Here is the motivational background for my question: I am contemplating writing a genetic algorithm optimizer to aid in designing a power divider network (also called a beam forming network, or BFN for short). The BFN is intended to distribute power to each of N radiating elements in an array of antennas. The fraction of the total input power to be delivered to each radiating element has been specified. Topologically speaking, a BFN is a strictly binary, rooted tree. Each of the (N-1) interior nodes of the tree represents the input port of an unequal, binary power splitter. The N leaves of the tree are the power divider outputs. Given a particular power divider topology, one is still free to map the power divider outputs to the array inputs in an arbitrary order. There are N! such permutations of the outputs. There are several considerations in choosing the desired ordering: 1) The power ratio for each binary coupler should be within a specified range of values. 2) The ordering should be chosen to simplify the mechanical routing of the transmission lines connecting the power divider. The number of ouputs N of the BFN may range from, say, 6 to 22. I have already written a genetic algorithm optimizer that, given a particular BFN topology and desired array input power distribution, will search through the N! permutations of the BFN outputs to generate a design with compliant power ratios and good mechanical routing. I would now like to generalize my program to automatically generate and search through the space of possible BFN topologies. As I understand it, for N outputs (leaves of the binary tree), there are $C_{N-1}$ different topologies that can be constructed, where $C_N$ is the Catalan number. I would like to know how to encode an arbitrary tree having N leaves in a way that is consistent with a chromosomal description for use in a genetic algorithm. Also associated with this is the need to generate random instances for filling the initial population, and to implement crossover and mutations operators for this type of chromosome. Any suggestions will be welcome. Please minimize the amount of CS lingo in your reply, since I am not likely to be acquainted with it. Thanks in advance, Peter

    Read the article

  • What is a good resources to add content snippets (widgets) to many sites like iGoogle, Facebook and

    - by Brennan
    I have found services like ClearSpring and Widgetbox for putting content snippets onto a widget range of social networking web sites, but I would like to build my own widgets without a third party dependency. I have been looking but I have not yet found a good resource to learn how to create widgets/gadgets for multiple sites. It was easy to build a gadget for iGoogle, but Facebook, MySpace and the others are less obvious. What is a good resource to create content snippets for multiple sites?

    Read the article

  • VBA How to find last insert id?

    - by Muiter
    I have this code: With shtControleblad Dim strsql_basis As String strsql_basis = "INSERT INTO is_calculatie (offerte_id) VALUES ('" & Sheets("controleblad").Range("D1").Value & "')" rs.Open strsql_basis, oConn, adOpenDynamic, adLockOptimistic Dim last_id As String last_id = "select last_insert_id()" End With The string last_id is not filled. What is wrong? I need to find te last_insert_id so I can use it in an other query.

    Read the article

  • the error "invalid literal for int() with base 10:" keeps coming up

    - by ratce003
    I'm trying to write a very simple program, I want to print out the sum of all the multiples of 3 and 5 below 100, but, an error keeps accuring, saying "invalid literal for int() with base 10:" my program is as follows: sum = "" sum_int = int(sum) for i in range(1, 101): if i % 5 == 0: sum += i elif i % 3 == 0: sum += i else: sum += "" print sum Any help would be much appreciated.

    Read the article

  • Enable UIBarButtonItem if multiple UITextFields are all populated

    - by CrystalSkull
    I have 3 UITextFields in a grouped UITableView and am trying to figure out the correct logic to only have my 'Save' UIBarButtonItem enabled when none of the UITextFields are empty. I'm currently using the - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string UITextField delegate method to detect changes to the field character by character, but it is providing inconsistent results. Any ideas?

    Read the article

  • Python beginner confused by a complex line of code

    - by Protean
    I understand the gist of the code, that it forms permutations; however, I was wondering if someone could explain exactly what is going on in the return statement. def perm(l): sz = len(l) print (l) if sz <= 1: print ('sz <= 1') return [l] return [p[:i]+[l[0]]+p[i:] for i in range(sz) for p in perm(l[1:])]

    Read the article

  • assigning a list in python

    - by mekasperasky
    pt=[2] pt[0]=raw_input() when i do this , and give an input suppose 1011 , it says list indexing error- " list assignment index out of range" . may i know why? i think i am not able to assign a list properly . how to assign an array of 2 elements in python then?

    Read the article

  • Formula to follow addition of rows

    - by Wayne McCaslin
    New to VBA, please help. I have a range say A2:D10; input causes rows to be added. New entries are being added using NextRow=_. Works perfectly, however, how do I get the formulas in columns C and D to follow each new row being added. I cannot just format entire column due to my sort criteria. Example formula is =IF(ISTEXT($B11),$C$2-$D11,"")

    Read the article

  • write in file is not complete without quitting the IDLE(Python GUI)

    - by Yi-Ping
    I want to write something in a file. for example, fo=open('C:\Python\readline_test.txt','a') for i in range(3): st='abc'+'\n' fo.write(st) fo.close then I open this python file in IDLE, and click "Run Module". There is no error message but I find the writing is not complete if I didn't quit IDLE. How can I complete the file writing without quitting the IDLE? Thanks. (I use Python 2.6.2 on Windows XP.)

    Read the article

  • How to insert a new row between two existing rows of MsChart?

    - by Meera
    Hi..Is there any provision to insert a new row between two existing rows of a rangebar chart? If so,please suggest me.Example:Adding a new row at the position where xaxis label equals 2 so that we will get a new row with the axis label as 3(normally in range bar chart type,xaxis representations are taken as yaxis,so here "xaxis label" denotes "yaxis label") .How can i do this?

    Read the article

  • How to run an equation along whole column in excel vba

    - by Elad Sommer
    I want to run an excel vba which will go down column E and upon finding the value = "capa" will go two cell below, calculate the hex2dec value of that cell, present it by the cell with the value "capa" in column F and continue to search down column E. So far I've came with the below but it doesn't work: For Each cell In Range("E:E") If cell.Value = "Capa" Then ActiveCell.Offset.FormulaR1C1 = "=HEX2DEC(R[2]C[-1])" End If Next cell Thanks!

    Read the article

  • How to convert pdf to png ?

    - by lisyqiao
    ( www.pdftopng.net )*PDF to PNG*Converter is the professional software that can convert PDF to PNG with high quality and fast speed. Besides, Free PDF to PNG can convert PNG to the other images like PDF to JPG, PDF to GIF, PDF to TIFF, PDF to BMP and so on. What's more, PDF to PNG can customize your output settings including output type, output color and page range etc.

    Read the article

  • C: Random Number Generation - What (If Anything) Is Wrong With This

    - by raoulcousins
    For a simple simulation in C, I need to generate exponential random variables. I remember reading somewhere (but I can't find it now, and I don't remember why) that using the rand() function to generate random integers in a fixed range would generate non-uniformly distributed integers. Because of this, I'm wondering if this code might have a similar problem: //generate u ~ U[0,1] u = ( (double)rand() / ((double)(RAND_MAX)); //inverse of exponential CDF to get exponential random variable expon = -log(1-u) * mean; Thank you!

    Read the article

  • Perturb vector by some angle

    - by Myx
    Hello: I have a unit vector in 3D space whose direction I wish to perturb by some angle within the range 0 to theta, with the position of the vector remaining the same. What is a way I can accomplish this? Thanks.

    Read the article

  • Imagemagick Resizing in Paperclip

    - by jonathan.soeder
    So, I want to resize images to a FIXED width, but proportional height. I have been trying a wide range of operators: 380x242# 380x242 380!x242 380x242< none of them have the desired effect. Any help? I want it to fill or resize to the 380 width, then resize / shrink the height by the same factor it used to shrink or resize the image to 380 wide.

    Read the article

  • Search for -1 in Solr

    - by Znarkus
    Hi! I have an optional property of type pfloat, that can either be an encoded numeric value, or -1 if the property is not set. Numerics are encoded to be range searchable (1 is encoded to something like 10000000001), but -1 will always be -1. How can I search a field for -1? property:-1 throws parse error and property:'-1' doesn't return anything. Thanks for help!

    Read the article

  • How to overwrite an excel application without prompting the users..

    - by Mark
    Can anyone help me on how can I overwrite the excel file without prompting the users in VB.Net.. I have try this code but It doesn't work.. Dim xlsApp As New Excel.Application Dim xlsBook As Excel.Workbook Dim xlsSheet As Excel.Worksheet Dim dir As String = Application.StartupPath & "\Template\SampleTemplate.xls" xlsBook = GetObject(dir) xlsSheet = xlsBook.Sheets("Per BPA Error Report") xlsSheet.Range("C2:T2").Merge() xlsApp.DisplayAlerts = False xlsSheet.SaveAs(Application.StartupPath & "\Template\SampleTemplate.xls") xlsBook = Nothing xlsSheet = Nothing xlsApp.Quit()

    Read the article

  • Using RangeValidator with byte

    - by KevDog
    This is the property declaration in question: [RangeValidator(1,RangeBoundaryType.Inclusive,255,RangeBoundaryType.Inclusive,MessageTemplate = "StartFlexibility is out of range")] public byte StartFlexibility { get; set; } When the validate method is called, a FormatException is thrown telling me that the value type needs to be Int32. How to fix, please?

    Read the article

  • Python begineer confused by a piece of code

    - by Protean
    I understand the gist of the code, that it forms permutations; however, I was wondering if someone could explain exactly what is going on in the return statement. def perm(l): sz = len(l) print (l) if sz <= 1: print ('sz <= 1') return [l] return [p[:i]+[l[0]]+p[i:] for i in range(sz) for p in perm(l[1:])]

    Read the article

  • Large number of UPDATE queries slowing down page

    - by Bryan Lewis
    I am reading and validating large fixed-width text files (range from 10-50K lines) that are submitted via our ASP.net website (coded in VB.Net). I do an initial scan of the file to check for basic issues (line length, etc). Then I import each row into a MS SQL table. Each DB rows basically consists of a record_ID (Primary, auto-incrementing) and about 50 varchar fields. After the insert is done, I run a validation function on the file that checks each field in each row based on a bunch of criteria (trimmed length, isnumeric, range checks, etc). If it finds an error in any field, it inserts a record into the Errors table, which has an error_ID, the record_ID and an error message. In addition, if the field fails in a particular way, I have to do a "reset" on that field. A reset might consist of blanking the entire field, or simply replacing the value with another value (e.g. replacing the string with a new one that has all illegals chars taken out). I have a 5,000 line test file. The upload, initial check, and import takes about 5-6 seconds. The detailed error check and insert into the Errors table takes about 5-8 seconds (this file has about 1200 errors in it). However, the "resets" part takes about 40-45 seconds for 750 fields that need to be reset. When I comment out the resets function (returning immediately without actually calling the UPDATE stored proc), the process is very fast. With the resets turned on, the pages take 50 seconds to return. My UPDATE stored proc is using some recommended code from http://sommarskog.se/dynamic_sql.html, whereby it uses CASE instead of dynamic SQL: UPDATE dbo.Records SET dbo.Records.file_ID = CASE @field_name WHEN 'file_ID' THEN @field_value ELSE file_ID END, . . (all 50 varchar field CASE statements here) . WHERE dbo.Records.record_ID = @record_ID Is there any way I can help my performance here. Can I somehow group all of these UPDATE calls into a single transaction? Should I be reworking the UPDATE query somehow? Or is it just sheer quantity of 750+ UPDATEs and things are just slow (it's a quad proc server with 8GB ram). Any suggestions appreciated.

    Read the article

< Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >