• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Finding the one index with the highest value in the 3D array of object of classes  RSS feed

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this example I have 3D array which is named Decision_variable. Class ArgMax with the  argMaxFunction function.In this function I can return all the indexes with highest value.But I want to return only the first index which is node.Do you know how can I do it? and is it possible to return the value node[0] of class Node that here is the index with the largest value.









 
Bartender
Posts: 5303
55
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Negar Afrasiabi wrote:In this example I have 3D array which is named Decision_variable. Class ArgMax with the  argMaxFunction function.In this function I can return all the indexes with highest value.But I want to return only the first index which is node.Do you know how can I do it? and is it possible to return the value node[0] of class Node that here is the index with the largest value.


Your requirements aren't quite clear enough. "I want to return the first index which is node"? How about...
How do you expect to get from an array of int's to a Node object?
 
Negar Afrasiabi
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this example I have 3D array which is named Decision_variable. Class ArgMax with the  argMaxFunction function.In this function I can return all the indexes with highest value.But I want to return only the first index which is node.Do you know how can I do it? and is it possible to return the value node[0] of class Node that here is the index with the largest value.
Your requirements aren't quite clear enough. "I want to return the first index which is node"? How about...
How do you expect to get from an array of int's to a Node object? exactly


This is my question now in this example I know that index 1 has the highest value in array Decision_variable. Then I want to say that index 1 means this object of Node "nodes[1] = new Nodes(2,"cloud")" and the change "Cloud" to "VNF" by setNodeType(String nodeType).But I 'm not sure is feasible or not?
 
Negar Afrasiabi
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This is my question now in this example I know that index 1 has the highest value in array Decision_variable. Then I want to say that index 1 means this object of Node "nodes[1] = new Nodes(2,"cloud")" and the change "Cloud" to "VNF" by setNodeType(String nodeType).But I 'm not sure is feasible or not?
 
Carey Brown
Bartender
Posts: 5303
55
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
 
Negar Afrasiabi
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not want to write nodes[1].setNodeType( type ). when I find the highest index which is 1 the program can access to node[1] and for example setNodeType.
 
Carey Brown
Bartender
Posts: 5303
55
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Negar Afrasiabi wrote:I do not want to write nodes[1].setNodeType( type ).

Why not?

when I find the highest index which is 1 the program can access to node[1] and for example setNodeType.

How is that different than what I said?
 
Negar Afrasiabi
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can do it manually nodes[1].setNodeType( "sky"). But if the index of highest value is 0 again I should manually change node object. I want to know how to write a program that when the the program find the index of highest value of array. That index refer to the class node.I can access to the object of class with that index.  
 
Carey Brown
Bartender
Posts: 5303
55
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm guessing here. If this is still "wrong", then I suggest re-writing your requirements as pseudo code or a list of bullet items. Breaking requirements down to individual steps makes them clearer.

Nit picks:
The class Nodes should be singular.
Method and variable names should be in camel case and not contain an underscore (_).
 
Negar Afrasiabi
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can do it manually nodes[1].setNodeType( "sky"). But if the index of highest value is 0 again I should manually change node object. I want to know how to write a program that when the the program find the index of highest value of array. That index refer to the class node.I can access to the object of class with that index.  
 
The moth suit and wings road is much more exciting than taxes. Or this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!