From CSULA CS Wiki
Jump to: navigation, search

Torpedo strategies

Hey guys, i guess someone beat me to it in getting this page up. Anyways, I was thinking that maybe, "Herding the boat: forcing the boat to go to a position that is advantageous to the torpedoes. This could be merely away from the base or towards a strike point. It might not be possible given our constraints.", might be possible. I think that as long as we have torpedoes in each quadrant (circling) while the other group of torpedoes attack the boat within the quadrant we have a higher probability of hitting the boat.

-- Armando Padilla

So, what if we have the torpedoes, since they have a large radios, circles all 4 quadrants on the map. If the boat is in the quadrant that a torpedo is currently in, the torpedo will be the designated torpedo to attack the boat.

-- Armando Padilla

I should clarify what I meant about whether or not it's possible - it really depends on what we mean by herding. Taken too far, it would become game playing. We aren't allowed to create trees to determine counters to every move the boat will make; we can only create strategies based on the position and vector of the boat. However, attempting to block off escape paths while other torpedoes attack would be a simpler form of herding, and does not seem like it would violate any rules. In this case, it would probably fall into a subset of torpedo positioning.

Having some torpedoes circle seems like a viable strategy. I think we should all come up with as many methods as possible and try implementing them.

-- Jerry

Here's a question: Which of the following is preferable/valid?

  • A system in which torpedoes need to individually make decisions on where to move by collaborating with other torpedoes.
  • A system in which a single strategist evaluates the map and directs all of the torpedoes.

--Jerry 18:25, 1 October 2007 (PDT)

What would serve as the strategist? If it were a torpedo, then this torpedo would have to make strategies within the limitations of torpedoes. In this case, maybe the strategist torpedo role could be switched from torpedo to torpedo, depending upon the position of the boat and a torpedo's proximity to the boat, for example. I'm not sure how difficult this would be to actually implement.

-- Manuel

We could just designate one torpedo to do the planning, if it must be done by an agent. Since all torpedoes have the same knowledge of the whole map and can't be destroyed, would the role really need to be switched to different torpedoes? I suspect it would be much simpler to implement a single strategist than to make the torpedoes smart enough to plan cooperatively and democratically.

Also, does anyone know what the SVN url needs to be in Eclipse? I've tried variations of svn://<username> with no success.

-- Jerry 18:32, 3 October 2007 (PDT)

Hi Jerry,

Although, subversion accounts has been setup by CS department for our class, svn URL is not working accessing from off campus. I am working with Fernando and trying to resolve the problem. As soon as it gets resolved, I will post the required svn URL in the main page of CS460 for all classmates.

The required svn URL is svn:// But, once again, I have not imported the project yet. You can try the TEST project though using "svn://" user name and password will be prompted depending on subversion client application. If you are around the campus and try it, it will be helpful if you let me know the result.

-- MK 12:20, 4 October 2007 (PDT)

Hi Armando,

Your email address is bouncing back. Can you check?

-- MK 12:25, 4 October 2007 (PDT)

Hey all,

I found a bug in in the leftOrRightToIntersect() method. "target.angle" and "target.speed" were being overwritten in the call to getTorroidalNearest() and set to zero, which threw off torpedo interception. Saving the angle and speed prior to the getTorroidalNearest() call resulted in vastly reduced performance on the boat's part with the default settings. Reducing the torpedo speed or touchEpsilon values will compensate and bring evasion back up to normal with 5 torpedoes. I e-mailed Aaron about it already.

I'm currently working on a simple method the torpedoes to synchronize. The basic idea is that the distance to the boat are calculated for each torpedo at each step. The closest torpedo will delay by continually turning right until a second torpedo is equidistant (within some threshold) to the boat. Then the closest two will delay until a third is at the same distance. Then the three will take a direct path. Once that works, I'll try getting them to be equidistant at different angles to the boat.

I'm getting bogged down in problems with different variations of calling the built-in getDistanceTo methods, though. I think I'm calling it in the wrong modelState, which is throwing the numbers off wildly. I'm basically making updates to TreeNode.updateState(), because that seems to be the only place where TorpedoAgent.decideLeftOrRight() is called. However, if I do an "isRoot()" check in TreeNode.updateState(), it never evaluates to true.

Any thoughts/suggestions? I think my understanding of the program must be flawed somewhere. I was under the impression that the current state is in the root TreeNode. Where are you guys making your torpedo logic changes?

--Jerry 14:49, 12 October 2007 (PDT)

Does anyone know if we are allowed to keep the history of boat's movement?

-- MK 15:49, 12 October 2007 (PDT)

I think saving the history is valid.

--Jerry 16:35, 12 October 2007 (PDT)

Going off of what the prof said last week about the speed of the missle, im going to focus on writting up some code to slow down the missile dramatically when the missle and the boat are close enough to one another. Im guessing that if we sow down the missle slow enough it can turn enough to capture the boat.

-- Armando Padilla

Hi guys,

I managed to get the torpedoes to aim directly in front of the boat by a given distance, and have the torpedoes aim directly at the boat when in range. This seems to be overkill on the boat with the default parameter settings, with both tree searches the boat implements. I added a few lines of code to the TorpedoAgent class for this to work; instead of calling the leftOrRightToIntersect() method from the AgentState class, I implement the same code from this method inside the decideLeftOrRight() method in the TorpedoAgent class, with some modifications. If anyone wishes to see the code, I can email them the file that I modified to get the torpedoes to aim in this manner.

-- Manuel 00:36, 14 October 2007 (PDT)

Hi Manuel,

Can you commit your changes to subversion server (to your branch)? or you may want to upload here as zip file. Thanks.

-- MK 17:00, 18 October 2007 (PDT)

Hello MK,

I think I've managed to properly commit the change to my branch. When I use subclipse's SVN Repository Exploring, it shows the change. I am student 26, and I renamed the src folder to "Sea War". All of the changes I made to the code itself were made in the TorpedoAgent class. Let me know if I committed correctly.

--Manuel 21:36, 18 October 2007 (PDT)

Hi Manuel,

I ran your version of source code. It appears to me that 95% of the time, torpedoes are hitting the boat (good for torpedoes).

For the subversion commit, everything seems to be correct except, the root directory of the source code structure. I think if you keep the same source code structure ("src" instead of "Sea War2", rest of the class can check in and out easily without having to change anything on their part.


-- MK 9:45, 19 October 2007 (PDT)

Hello MK,

I've sent my email to your email address; in case your looking here first, my email is I'll try to change the source folder back to src.

--Manuel 13:01, 19 October 2007 (PDT)

Hi MK,

I sent you an email but it bounced back. here is my email address.

--Armando Padilla

Hi Armando,

I added your email address to Subversion.

-- MK 11:20, 22 October 2007 (PDT)

Hi everyone,

We have only one more class meeting to show a torpedo strategy where the torpedoes communicate with each other. We should all have at least one torpedo strategy to show in class by the last class meeting.

--Manuel 12:04, 18 November 2007 (PST)

Hey Manuel, Sounds good to me. I had a family emergency over the weekend.

Hey MK. Im trying to commit my torpedo code to svn but im having no luck. its telling me that i dont have access to the folder cs460/branches/stu27/src

This is what ive been working on for the last 2.5 weeks. 1. Added JavaDoc to the application. There was so much going on that I just decided to document everything. 2. Created Missle Run #1 = Given X number of torpedos the nearest torpedo locks onto the boat. This location is then passed to the other boats which in turn move toward that location. If the torpedo is far it increases speed to reach the boat the same time (roughly the same time) as the closest boat (Abbott briefly touched on this last Sat) 3. Currently running 100 runs with original code (before missle upgrade) 4. Currently running 100 runs with missle upgrade. This will give us a clue if the upgrade increased missle hits by X%.

Well hopefully i can upload soon.

Armando Padilla

Hi Armando, I think you are missing the full path to svn URL, here is the full path to your branch, svn:// (you do not need to include /src)

-- -- MK 9:45, 21 November 2007 (PDT)

Hey Armando,

That sounds great! The strategy I've been working on involves getting to the boat at the same time from multiple angles, with different waves of attacks (i.e. a first wave of torpedoes attack the boat at the same time, followed by a second wave of torpedoes). What I had in mind for my strategy at first was slowing down the torpedoes closest to the boat to wait for other torpedoes by extending the zig-zag pattern to be larger (i.e. left,left,left,right,right,right,left,left,left,etc. instead of left,right,left,right,...). If you've already incorporated code to allow torpedoes reach the boat at the same time by speeding up torpedoes that are farther away, this would greatly help my strategy as well (it would make it easier).


Humm do w have class today??? I didnt hear anything about not having class today.

Armando Padilla

Hi everyone. I was playing around with my code last night and i stumbbled accross something. maybe you guys already have seen this. If you get all the torpedoes that are marked as dangerous and slow it down to 0.02 as the speed the torpedo will alwasy hit the boat.

Armando Padilla

Hi Armando,

I think this is same as setting up the repast parameter(TorpedoSpeedFactor = 4.0). That means, it is actually twice faster as default parameter settings with TorpedoSpeedFactor = 2.0. The only difference when setting up with repast parameter is that the speed remains the same from the beginning (not only when it becomes dangerous).

With the current default settings the max speed of the torpedo(es) is/are as follows: TorpedoSpeedFactor * BoatSpeed = 2.0 * 0.005 = 0.01

The TorpedoSpeedFactor = 2.5 always hit the boat (as I tested).

-- MK

im going to present the speed increment as the main way to destroy the boat. version I and Version II of the code looks like something chewed on it lol. But ill still cover it along with the Java Doc I made a while back. Hope he likes it.

--Armando Padilla

Current Plan

Hi, all. This is a summary of what we discussed on Saturday (9/29/07). Let's try to flesh it out and decide what we want work on. Please note that we do not necessarily have to work on the same code, and it may be more enlightening to try different approaches to the same problem. --Jchang 12:35, 30 September 2007 (PDT)

Current Strategies

These are different strategies that we want to apply in order to successfully hit the boat. They are not mutually exclusive.

  1. Torpedo communication
    1. This is absolutely necessary to get the torpedoes into strategic positions.
  2. Determining a circle or ellipse of boat movement
    1. The boat, at a certain time x and a certain speed and vector, can only be at a limited number of points at a later time y, which should roughly fall within the shape of a circle or ellipse. This information will be useful for positioning torpedoes for a coordinated attack.
    2. The circle/ellipse, of course, must recalculated at every time step.
  3. Herding the boat: forcing the boat to go to a position that is advantageous to the torpedoes. This could be merely away from the base or towards a strike point. It might not be possible given our constraints.
  4. Torpedo cooperation and positioning
    1. Using communication, maneuvering torpedoes such that they will surround the boat and attack at relatively the same time. The reason the boat cannot evade when there are too many torpedoes around it is because it simply has no viable options. Therefore, our goal should be to position the fewest number of torpedoes necessary to cut off all options.
    2. There are different strategies to this – not all torpedoes need to go about positioning. Some could be assigned to chase the boat, protect the base, etc.
      1. How to position and attack: this is probably the bulk of the problem
      2. Assigning torpedoes to groups at the start of the simulation. Groups could have different “duties”. For example, the torpedoes closest to the boat at the beginning of the simulation would be assigned to the “attack boat immediately” group. The four furthest torpedoes could attempt to maneuver themselves to attack the boat at a specific point in time.
      3. Dynamically changing groups depending on the current layout of the map
  5. Torpedoes that miss the boat – strategies to reroute them effectively.