This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • 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
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

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

 
Ranch Hand
Posts: 50
  • 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: 5627
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
Ranch Hand
Posts: 50
  • 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
Ranch Hand
Posts: 50
  • 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: 5627
55
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
 
Negar Afrasiabi
Ranch Hand
Posts: 50
  • 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: 5627
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
Ranch Hand
Posts: 50
  • 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: 5627
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
Ranch Hand
Posts: 50
  • 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.  
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!