tag:blogger.com,1999:blog-7746035232350865175.post8860765531041339635..comments2024-03-28T07:52:54.780+00:00Comments on A. Nene: The traveling robot problemUnknownnoreply@blogger.comBlogger6125tag:blogger.com,1999:blog-7746035232350865175.post-57984310335587925232022-05-19T11:15:41.072+01:002022-05-19T11:15:41.072+01:00Java Training In Noida<a href="https://www.behance.net/gallery/143710493/Boost-Your-Java-Training-Institute-In-Noida-BY-Aptron" rel="nofollow">Java Training In Noida</a>Aptron Noidahttps://www.blogger.com/profile/16058071516332054928noreply@blogger.comtag:blogger.com,1999:blog-7746035232350865175.post-91497142025624431502022-03-21T10:58:31.343+00:002022-03-21T10:58:31.343+00:00At this point you'll find out what is importan...At this point you'll find out what is important, it all gives a url to the appealing page: <a href="https://satta-king-game.com" rel="nofollow">Satta king 786</a><br />Yousuf Ansarihttps://www.blogger.com/profile/11882492230450504927noreply@blogger.comtag:blogger.com,1999:blog-7746035232350865175.post-12117833450659661542021-01-05T22:23:41.487+00:002021-01-05T22:23:41.487+00:00I conceive you have noted some very interesting po...I conceive you have noted some very interesting points, regards for the post.<br /><a href="https://ufanews800.blogspot.com/2021/01/blog-post_5.html" rel="nofollow">สล็อตเล่นง่าย แตกไว เว็บไหนดี</a>UfaNews800https://www.blogger.com/profile/08095401597737200870noreply@blogger.comtag:blogger.com,1999:blog-7746035232350865175.post-14859404247030671262014-10-15T20:56:26.510+01:002014-10-15T20:56:26.510+01:00I recently learned about the Silicon Valley Roboti...I recently learned about the Silicon Valley Robotic Services and their innovative start-up, so if you want to learn more abut the Silicon Valley or you need some reliable and professional robotic services I suggest you to look at http://www.reuters.com/article/2014/06/10/idUSnGNX6C1r2L+1d1+GNW20140610 Anonymoushttps://www.blogger.com/profile/05846144497875973836noreply@blogger.comtag:blogger.com,1999:blog-7746035232350865175.post-10977215393922663072012-12-14T02:05:53.041+00:002012-12-14T02:05:53.041+00:00I used JavaScript instead of Java, since I do not ...I used JavaScript instead of Java, since I do not like the overhead Java uses to juggle with arrays and collections. (In fact I do not care to understand most of them. :-P)<br /><br />O(n*k) with n = number of distances and k = actual steps the robot needs to take<br /><br />https://gist.github.com/4281820<br /><br />I used prototypes to define the methods of the objects. If you are not familiar with prototypes: Think of them as classes that have their guts (methods) hanging outside instead of them tucked away in the inside.Anonymoushttps://www.blogger.com/profile/08332590929577123652noreply@blogger.comtag:blogger.com,1999:blog-7746035232350865175.post-12720456363418150452012-04-27T03:25:54.397+01:002012-04-27T03:25:54.397+01:00import java.util.Comparator;
import java.util.Tree...import java.util.Comparator;<br />import java.util.TreeSet;<br /><br />// i have no idea what i'm doing exactly, just messing around.... some kind of graph search, i guess... <br />class Test{<br /> // distances including cooldown. ultimately we just get rid of the last two minutes. <br /> final static int d[] = { 1, 2, 3,5,10};<br /> final static int t[] = {12, 7, 5,4, 3};<br /> <br /> public static void main( String[] args ){<br /> <br /> TreeSet nodes = new TreeSet( new Comparator(){<br /> @Override<br /> public int compare( Node a, Node b ){<br /> return a.t < b.t? -1 : a.t > b.t? 1 : ( b.d-a.d ); <br /> }<br /> });<br /> <br /> <br /> // throw in the original nodes ...<br /> for( int i = 0; i < t.length; i++ )<br /> nodes.add( new Node( null, d[i], t[i] ) ); <br /> <br /> // now search for a solution :) <br /> while( true ){<br /> Node cheapo = nodes.first(); <br /> <br /> // done? <br /> if( cheapo.d == 43 ){<br /> System.out.println( "HOLY SHIT, WE'RE DONE!" );<br /> System.out.println( cheapo.toString() ); <br /> System.out.println( "Total time (excluding final cooldown): " + (cheapo.t - 2) + "min" ); <br /> break; <br /> }<br /> // expand the cheapest node ... <br /> else{<br /> nodes.remove( cheapo );<br /> for( int i = 0; i < t.length; i++ )<br /> nodes.add( new Node( cheapo, d[i], t[i] ) ); <br /> }<br /> }<br /> }<br /> <br /> <br /> static class Node{<br /> Node parent; <br /> int d, myD, t, myT; <br /> <br /> public Node( Node parent, int distance, int time ){<br /> this.parent = parent; <br /> this.d = ( parent != null? parent.d:0 ) + ( myD = distance ); <br /> this.t = ( parent != null? parent.t:0 ) + ( myT = time );<br /> }<br /> <br /> public String toString(){<br /> String str = "Node[d=" + d + "km, t=" + t + "min, path=" + myD;<br /> Node n = this.parent; <br /> while( n != null ){ <br /> str += "," + n.myD;<br /> n = n.parent; <br /> }<br /> <br /> return str + "]"; <br /> }<br /> }<br />}<br /><br /><br />it outputs<br /><br />HOLY SHIT, WE'RE DONE!<br />Node[d=43km, t=17min, path=3,10,10,10,10]<br />Total time (excluding final cooldown): 15min<br /><br /><br /><br /><br />oh, also i didn't read the post right and overlooked the "it has to be java" part, so here's my first solution in mathematica: <br />Minimize[{12 a + 7 b + 5 c + 4 d + 3 e, <br /> a + 2 b + 3 c + 5 d + 10 e == 43 && # >= 0 & /@ {a, b, c, d, <br /> e}}, {a, b, c, d, e}, Integers]kritzikratzihttps://www.blogger.com/profile/13600743757791581301noreply@blogger.com