minimum

ASP.NET MVC2 DataAnnotations Minimum length

Because I'm not using .net 4 I can't use StringLength.MinimumLength property. What is alternative? I suppose I should write regular expression: [Required] [RegularExpression("", ErrorMessage = "Minimum 3 characters")] public string Password { get; set; } Thanks, Ile ...

Is there a better way to check if a value is bigger than of type double?

double x; cin>>x; if( x > 1.7976931348623157e+308 || x < -1.7976931348623157e+308 ) { cout<<"value not in range"<<endl; exit(1); } Is there like a DOUBLE_MAX or DOUBLE_MIN and would I need to include any header files? ...

In a graph, how to find the nearest node to a group of nodes?

Hello, I have an undirected, unweighted graph, which doesn't have to be planar. I also have a subset of graph's nodes (true subset) and I need to find a node not belonging to the subset, with minimum sum of distances to all nodes in the subset. So far, I have implemented breath-first search starting from each node in the subset, and th...

Minimum vs Minimal vertex covers

I am studying for an exam and one of the sample questions is as follows: Vertex cover: a vertex cover in a graph is a set of vertices such that each edge has at least one of its two end points in this set. Minimum vertex cover: a MINIMUM vertex cover in a graph is a vertex cover that has the smallest number of vertices among all possib...

Cheapest Spanning Transitive Closure in Directed Graph

Hi, Given some positive-weighted directed graph, I'd like to find a cheapest set of edges s.t. 1. The set of vertices is a spanning tree, i.e. all vertices are present in the final graph 2. Every vertex is reachable from any other vertex through a directed path (transitive closure??) 3. Set of edges has the minimum cost Essentially, I ...

Numpy minimum in (row, column) format

How can I know the (row, column) index of the minimum of a numpy array/matrix? For example, if A = array([[1, 2], [3, 0]]), I want to get (1, 1) Thanks! ...

Python: get key with the least value from a dictionary

If I have a Python dictionary, how do I get the key to the entry which contains the minimum value? I was thinking about something to do with the min() function... Given the input: {320:1, 321:0, 322:3} It would return 321. Any ideas? Thanks! ...

Set minimum value of MySQL field - possible?

Quick newbie MySQL question. What would be the simplest way to ensure that the minimum value of a given field is 0? Basically, we have a script that runs automatically and subtracts an integer value from the value of a field every 15 minutes--but we want any entry that gets to 0 to stay at 0 and not go negative. This could be simply d...

R solver for non linear constraints

Is there R solver function similar to solve.QP but for non linear constraints? Also, is there another generic solver for cubic or higher degree contraints and minimum/maximum functions? ...

find a minimum value in an array of floats

how would one go about finding the minimum value in an array of 100 floats in python? I have tried minindex=darr.argmin() and print darr[minindex] with import numpy (darr is the name of the array) but i get: minindex=darr.argmin() AttributeError: 'list' object has no attribute 'argmin' what might be the problem? is there a better alte...

find value of forloop at which event occurred Python

hey guys, this is very confusing... i am trying to find the minimum of an array by: for xpre in range(100): #used pre because I am using vapor pressures with some x molarity xvalue=xarray[xpre] for ppre in range(100): #same as xpre but vapor pressures for pure water, p pvalue=parray[p] d=math...

How to get all the minimum elements according to its first element of the inside list in a nested list?

Simply put! there is this list say LST = [[12,1],[23,2],[16,3],[12,4],[14,5]] and i want to get all the minimum elements of this list according to its first element of the inside list. So for the above example the answer would be [12,1] and [12,4]. Is there any typical way in python of doing this? Thanking you in advance. ...

Crystal Reports Help

Hi I have a Crystal Report set up to run with my windows forms application. I am passing a string to the SelectionFormula of the report. What I am doing is: I have 3 tables - StockFile, BranchFile and Supplier A Stock item is created when that item is added to branch stock, an item can be moved around branches until it is sold, so c...

Finding minimum values of (properties of ) collections in C#

Given the following code from a Microsoft example: public class EngineMeasurementCollection : Collection<EngineMeasurement> { public EngineMeasurementCollection() { Add(new EngineMeasurement { Speed = 1000, Torque = 100, Power = 20 }); Add(new EngineMeasurement { Speed = 2000, Torque = 160, Power = 60 }); ...

[python] get numbers from user & print maximum and minimum (w/o using built-in function)

I'm reviewing a python exercise which does the following : reads list of numbers til "done" gets entered. When "done" is inputted, print largest and smallest of the numbers. And it should be without directly using the built-in functions, max() and min(). Here is my source. Traceback says, "'float' object is not iterable" I think my...

Prolog, find minimum in a list.

Hi, in short: How to find min value in a list? (thanks for the advise kaarel) long story: I have created a weighted graph in amzi prolog and given 2 nodes, I am able to retrieve a list of paths. However, I need to find the minimum value in this path but am unable to traverse the list to do this. May I please seek your advise on how t...