Jump to content

  • Log In with Google      Sign In   
  • Create Account

Chad Smith

Member Since 26 Jun 2005
Offline Last Active Yesterday, 08:19 PM

Topics I've Started

AETG Algorithm

02 September 2014 - 01:36 PM

I first want to start off by saying that this is an assignment.  While I do need some help I am not looking for the answer on the exact implementation or for someone to write the code for me.  I'm really just looking to get a little help on getting my head around the algorithm without getting my head stuck on the abstract idea of it and some ideas to build on.


Anyway, the assignment is to implement the AETG algorithm that generates combinatorial test suites.  For example: Lets say that we have this very simple table as an example for us to work from:


f0 | f1 | f2 | f3


0  | 3  | 6  | 9


1  | 4  | 7  | 10


2  | 5  | 8  | 11 



Simple enough, it has 4 factors and 3 levels.  I get that we have a total of 34 total different combinations. 


Now I need to create all the pairs and in the assignment I only have to support 2-way coverage.  So to work from the example I gave above here some pairs:

Note: these aren't all the pairs to create of course, just a quick example

{0,3} {0,6} {0,9}

{1,3} {1,6} {1,9}

{2,3} {2,6} {2,9}

so on and so on, until you have all the pairs


And then the suite that covers all pairs and report or save the smallest test suite.  

While when working it out by hand I get this and I seem to understand the basics of it and could solve it by hand given enough time.  I felt if I could solve it that way then I could sit down and put the thought process I did by hand into code, though nothing really seems to be coming out and I am struggling to put this thought process into code and I think it is because that is all my understanding of this algorithm is, just very basic.  I've tried to read some papers on it though the abstract approach to it gets me a little lost in a few areas.  Sadly combinatorical math is not my strong suit at all.


So here is my though process and what I am looking at and what I have so far:

  1. Create the initial covering array/table (like the example I gave at the start of this post).  I am just using my own 2D dynamic array class I created (Basically a wrapper of std::vector< std::vector<int> >
  2. Enumerate all the pairs.  I was thinking of just using another 2D dynamic array.  When I find all the pairs for that row, pushing that row into the dynamic array and just noting that two indexs right next to each other are the pairs.  This though seems like it'd be incredibly slow when the in the end the program uses 50 candidates and that there should be an easier way that I am missing.  Though I also know that it can be evil to try to optimize  something before something gets working.
  3. Create a test suite that uses all pairs.  Report/Save it to the user.  I can see just a 2D Dynamic Array working for this.  Then just reporting that array to the user (printing it out or saving the array to a file).

As you can see I have a pretty bare bone basic knowledge of it and each paper I read on it i just seem to confuse myself more with with the abstract view they seem to give.  With that I am struggling knowing about this algorithm and hoping someone here could try to explain some things, really anything about it.


Is there something I should look at or have any ideas for me?  Right now I am stuck on the loop to enumerate all the pairs.  If I was doing it on paper I would just start on the top left and pair that up with everything to the right of it (using example from above, that'd give me the pairs)

{0,3} {0,4} {0,5} {0,6} {0,7} {0,8} {0,9} {0,10} {0,11}

then just move down to the next row in that column, then move to the next column once I have done all the rows for a column.  Though I seem to be struggling in putting that into the correct for loop.


Thanks for any ideas anyone may have.  I'll take any ideas in trying to translating it into code.




Fixing your own problems

30 October 2013 - 10:34 PM

So I just had this happened to me so I had to ask.  How many times have some of y'all have been having a weird problem in your code and you just needed to get some help.  So you come here to post a question and while typing out the question, explaining what you want, and providing some code you immediately see your issue and can fix it yourself?


Yep that just happened to me.  Couldn't figure out what was wrong.  I was on it for about an hour looking at code and debugging and couldn't find anything and it seemed so simple.  So I came here to type out a question and explaining what in theory thought should be happening I immediately saw my issue.  Fixed it in my code and sure enough bam it runs as desired.  Well at least I caught it before I clicked post so I didn't look too dumb.


How many times has this or something similar happened to you?

Ubuntu 13.04/13.10 Issue

20 October 2013 - 01:30 PM

I am a Linux/Ubuntu "noob" really so forgive me ahead of time.  I I wanted to ask this question here also as I know there are some people on here who seem to be experts with some Linux distributions.


Anyway I started Dual Booting Ubuntu 13.04 with Windows 8 a couple days ago.  The installation went smoothly and everything worked great.  I was read up on some things about the Nvidia Drivers (was using my Intel 4000 Card first couple days) and seemed from everything I read, this command should work:

sudo apt-get install nvidia-current

everything seemed fine.  I then did the update to 13.10.  That seemed to go smoothly and it asked me to restart so I rebooted.  On the reboot into Ubuntu that didn't go so smoothly.  All I have is the desktop background.  The Unity Launcher doesn't seem to load up.  All I see is my desktop background and I can do crtl+alt+T to bring the terminal up but that seems to be it.  Nothing else.  I tried another reboot and the same thing.


I thought I would try to remove the nvidia packages and see if that helped.  So I did

dpkg -l | grep nvidia-

so list the packages then removed them with 

sudo apt-get purge <insert package name here>

that seemed to remove them.  Rebooted and the same thing.  Still only have the desktop background with no Unity Launcher or anything.  anyone here have any advice about what the issue could be?  I'm not sure what do about a recovery or anything like that.  So if anyone has any advice to try or know what the issue could be that'd be great.  A Google Search seems to lead that this was a Nvidia issue and to remove the packages.  So I followed those instructions like I listed and nothing.  So I am a little lost right now.


Thanks to all who help!  

PS: my Windows 8 installation remains unaffected and is what I am using right now to type this and look for solutions.


SFML: Wrong Entity Movement

13 July 2013 - 02:50 PM

This really feels like a dumb question because of how basic it seems but  yet for some reason I must be over looking it.  I've been working on a way to allow custom configuration of controls and movement of entity's that wasn't all hard coded into the game logic.


Anyway, I have something working but it seems my movement of the Entity is wrong.  No matter what key I press the Entity always moves up.  I use a Functor to pass in the input action.  This is how I do it:

void Player::InitializeActions()
	const float playerSpeed = 200.0f;
	actionBinding[MoveLeft].action = derivedAction<Aircraft>(AircraftMover(-playerSpeed, 0.f));
	actionBinding[MoveRight].action = derivedAction<Aircraft>(AircraftMover(+playerSpeed, 0.f));
	actionBinding[MoveUp].action = derivedAction<Aircraft>(AircraftMover(0.f, -playerSpeed));
	actionBinding[MoveDown].action = derivedAction<Aircraft>(AircraftMover(0.f, +playerSpeed));

The Aircraft Mover Functor looks as follows:

struct AircraftMover
	AircraftMover(float vx, float vy)
		: velocity(vx, vy)

	void operator() (Aircraft& aircraft, sf::Time) const

	sf::Vector2f velocity;

The accelerate function just adds the given velocity with the current.  Something like this:

void Entity::Accelerate(sf::Vector2f theVelocity)
	velocity += theVelocity;

The problem seems to be no matter if I press Up, Down, Left, or Right the entity always moves up.  I can't seem to figure out why.  It feels so basic and I feel like I should know/see something like this but I can't seem to figure out why the velocity is always in the Y Direction.  


Anyone else see anything?  This is really the only place I handle movement.  Only other things just sets the velocity to 0 when it loads the entity.


Thanks for any help.  This just sees so basic...

std::move and std::unique_ptr

07 July 2013 - 03:41 AM

I'm pretty new to some C++11 and also smart pointers.  While reading and studying part of the bare bone basics of a scene graph I came across the following C++11 code.  Guess just wanted to make sure I am on the right track on what I believe is happening and just wanted some clarification.


Here is the function:

RemoveChild(const SceneNode& node)
	auto found = std::find_if(children.begin(), children.end(), [&] (ScenePointer& p) -> bool {return p.get() == &node; });

	assert(found != children.end());

	ScenePointer result = std::move(*found);
	result->parent = nullptr;

	return result;

Couple notes:

  • children is just a vector container.  It contains std::unique_ptrs of SceneNodes
  • ScenePointer is just a typedef of std::unique_ptr<SceneNode>


It's using the find_if algorithm to go through each element in the vector.  Uses a Lambda Expression to check if that elements pointer is the address of the node we are searching for (whew I need to study up more on Lambda Expressions I'm noticing).

It then uses an assertion to validate that the node we searched for could actually be found


It will store the result by just using the C++11 move semantics in std::move.  Because found is actually an iterator (I think?) I need to dereference it?


Then since it is removing a child we set the child's parent pointer to null then just use erase to remove it from the vector since it's not longer a child.  Finally return the detached node/smart pointer.


Am I close on this?  My main question is about the std::move(*found).  I understand hat this would actually be moving the content and won't require a copy of the entire object.  So that position in the vector is empty now, right?  My main question is: why exactly was the dereference needed here really?  


Thanks to any and to all who can give me the confirmation and help!