Agents and Environments in AI

Agents and Environments play a big part in Artificial Intelligence and in the post I am just going to lay out the basics of what Agents and Environments are made up of.

An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators. You can think of an agent as being like a robotic player in a chess game. Its sensors are the ability to see the other players moves in the game. The environment is the game of chess, the board, the other player, and all of the pieces. The actuators of the chess game agent could be a robotic arm or in software the ability to make or making moves. There are many different examples of agents and environments of artificial intelligence in the world today, for example the self driving car, the car is the agent and the world is the environment.
A rational agent could be seen as an agent that tries its best to make the right decision.

The definition of a rational agent is:

For each possible percept sequence, a rational agent should select an action that is expected to maximize its performance measure, given the evidence provided by the percept sequence and the agents built-in knowledge.

The Performance Measure is an objective criterion for success of an agents behavior.

The performance measure embodies criterion for success and is generally defined in terms of desired effect on the environment (not on actions of agent)

When specifying a task environment we use what is called PEAS.  The task environment must be defined to design a rational agent.

PEAS: Performance measure, Environment, Actuators, Sensors

Performance Measure: a function the agent is maximizing (or minimizing)

Environment: a formal representation for world states

Actuators: actions that change the state according to a transition model

Sensors: observations that allow the agent to infer the world state

When thinking about the environment there are many different types of environments.  It is good to know what type of environment your agent will be interacting with and the types can tell you the difficulty of defining your agent altogether.

Environment Types:

Fully observable vs. Partially observable

Do the agents sensors give it access to the complete state of the environment?  For any given world state, are the values of all the variables known to the agent?

Deterministic vs. Stochastic

Is the next state of the environment completely determined by the current state and the agents action. Strategic: The environment is deterministic except for the actions of other agents.

Episodic vs. Sequential

Is the agents experience divided into unconnected single decisions/actions, or is it a coherent sequence of observations and actions in which the world evolves according to the transition model?

Static vs. Dynamic

Is the world changing while the agent is thinking?

Semi-dynamic: the environment does not change with the passage of time, but the agents performance score does.

Discrete vs. Continuous

Does the environment provide a fixed number of distinct percepts, actions, and environment states?

Are the values of the state variables discrete or continuous?

Time can also evolve in a discrete or continuous fashion

Single Agent vs. Multi Agent

Is an agent operating by itself in the environment?

Known vs. Unknown

Are the rules of the environment (transition model and rewards associated with states) known to the agent?

With the types of environments laid out they can be easy or hard:

Easy: Fully Observable, Deterministic, Episodic, Static, Discrete, Single Agent

Hard: Partially Observable, Stochastic, Sequential, Dynamic, Continuous, Multi-Agent

The environment type largely determines the agent design.

The Structure of Agents:

There are four basic types of agents, here they are in order of increasing generality:

  1.  Simple Reflex Agents
  2. Reflex Agents with State
  3. Goal-based Agents
  4.  Utility-based Agents

Each kind of agent program combines particular components in particular ways to generate actions.

Simple Reflexive Agent handles the simplest kind of world.  This agent embodies a set of condition-action rules.  Basically works with If perception then action.  The agent simply takes in a percept, determines which action could be applied, and does that action.  The action is dependent on the current precept only.  This type of agent only works in a fully observable environment.

A Model-Based Reflex Agent works so when it gets a precept it updates the state, chooses a rule to apply, and then schedules the action associated with the chosen rule.

Goal-Based Agent is like a model based agent but it has goals so it will think about the state that it is in and then depending on the goals that it has it will take an action based on reaching its goals.

A Utility-Based Agent is the same as a goal based agent but it evaluates how performant the action it will perform to achieve its goal will be.  In other words how happy will the agent be in the state that would come if the agent made an action.

Finally there is Learning Agents it says above that there are four agent types but a learning agent is a special kind of agent.  One part of the learning agent is a utility-based agent and it is connected to a critic, a learning element, and a problem generator.  These three other parts make the learning agent able to tackle problems that are very hard.  The critic of a learning agent is just what it sounds like. It criticizes the agents actions with some kind of score so the agent knows the difference between good actions and bad actions.  The problem generator is used by the learning element to maybe introduce a small measure of error because if the agent always does the highest critic graded actions then the agent may be missing a more optimal solution because they have not tried something that should be unlikely but was better.

I hope you liked this post.  I am going to continue doing more Artificial Intelligence posts if I get the time as I am very busy.  I hope you learned a bit about agents and environments in AI because making this post has helped me solidify some of this knowledge in my own mind.

Merge Sort algorithm with Generics that implement Comparable interface

Sorting algorithms are used everyday to sort all types of information in computer programs so I decided to share a O(Nlog2N) sorting algorithm called Merge Sort with you today. This is written in Java Programming. I shared a post last year on Quick Sort algorithm and I just decided to do all of the Big-O (Nlog2N) sorting algorithms. Of course Java has many built in data structures and uses the best sorting algorithms already, but if you are learning about data structures and algorithms you might find this post handy.

First I will post the Circle class just like in the Quicksort example that can be found here by the way QuickSort sorting algorithm in java with Generics that implement Comparable

 * author: copypasteearth
 * date: 7/17/2019
public class Circle implements Comparable<Circle> {
    public int xValue;
    public int yValue;
    public int radius;

    public int compareTo(Circle o) {
        return (this.radius - o.radius);
    public String toString() {
        return "x: " + xValue + " ---y: " + yValue + " ---radius: " + radius;

Secondly you are going to need the MergeSort class which also has the main method inside it so it can run the program. The class has static methods called merge and mergeSort that do all of the work. They basically keep splitting and sorting the array untill everything is sorted and then merges it all back together.

import java.util.Arrays;
import java.util.Random;

 * author: copypasteearth
 * date: 7/17/2019
public class MergeSort<T extends Comparable<T>> {

    public static <T extends Comparable<T>> void merge(int leftFirst, int leftLast, int rightFirst, int rightLast, T[] array){
        T[] tempArray = Arrays.copyOf(array,array.length);
        int index = leftFirst;
        int saveFirst = leftFirst;

        while((leftFirst <= leftLast) && (rightFirst <= rightLast)){
            if(array[leftFirst].compareTo(array[rightFirst]) < 0){
                tempArray[index] = array[leftFirst];
                tempArray[index] = array[rightFirst];
        while(leftFirst <= leftLast){
            tempArray[index] = array[leftFirst];
        while(rightFirst <= rightLast){
            tempArray[index] = array[rightFirst];
        for(index = saveFirst; index <= rightLast;index++){
            array[index] = tempArray[index];
    public static <T extends Comparable<T>> void mergeSort(int first, int last,T[] array){
        if(first < last){
            int middle = (first + last) / 2;

    public static void main(String[] args){
        Circle[] circlearray = new Circle[20];
        Random rand = new Random();
        for (int index = 0; index < 20; index++)
            circlearray[index] = new Circle();
            circlearray[index].xValue = Math.abs(rand.nextInt()) % 100;
            circlearray[index].yValue = Math.abs(rand.nextInt()) % 100;
            circlearray[index].radius = Math.abs(rand.nextInt()) % 100;
        System.out.println("Circle Array Unsorted....");
        for(int i = 0;i < 20;i++){

        MergeSort<Circle> mscircle = new MergeSort<Circle>();
        mscircle.mergeSort( 0, circlearray.length-1,circlearray);
        System.out.println("Circle Array Sorted");
        for(Circle i: circlearray) {

And that pretty much sums it up for MergeSort. Another one of your should be favorited sorting algorithms that run at a whopping O(Nlog2N) complexity. Thanks for your time and i hope you liked this article and got some use out of it. I am leaving the Link to this and QuickSort on github here it is

The Pros and Cons of Raiding Area 51

One of the latest crazes on the internet today is about people getting together and raiding area 51. Celebrities have stated that they are down to go raid area 51, and there is supposedly and event organized for a certain day when all of these people are going to get together and march into the unknown. One thing that is totally great about this event is that the memes are going to be gold for the rest of the world to enjoy and laugh about for probably a long time to come.

So what are some pros to people actually raiding area 51? With anything that goes on there are pros and cons and I have been thinking about this event lately even though I am not attending I have been thinking of the possibilities. You know I love the idea of a naked man space suit (By the way where do I sign up to be a tester of it) and my favorite animal is the tardigrade that can actually live in the vacuum of space. Any way here is a list of some pros I have been thinking about concerning raiding area 51.

  1. They discover that there really are aliens that have came to earth and are somehow being held captive there.
  2. The discovery of some types of alien technology like teleportation or telepathy.
  3. Secret weapons that are unheard of being experimented with
  4. The results of the age old experiment of what came first the chicken or the egg(trillions of dollars have probably been dumped into this)
  5. Maybe an alien spacecraft could be discovered being held in this facility.
  6. Years of research knowledge about things that no one has ever even heard of.
  7. Maybe the possibility of knowledge of habitable planets that has not been released to the public.
  8. Secret alien recipes for 5 star alien restaurants haha

Not only is this mission to raid area 51 not well thought out and pretty much ridiculous, it is a secret place for a reason. So I get to the cons of raiding area 51. I really hope that people do raid area 51 just because I would like to see what comes of it. There are some pros that I think would come of it but there are many more cons associated with raiding a top secret facility.

  1. Armed Guards
  2. Releasing an alien toxin into the atmosphere.
  3. Armed Guards killing civilians to protect area 51 secrets.
  4. The aliens there want to remain secret and if word gets out they will destroy earth because they are so technologically advanced to even be able to travel this far.
  5. Armed Guards
  6. The military nukes area 51 to destroy everything that has been going on there.
  7. We find out all of the technology that we love so much comes from aliens and that we are all just pawns in their intergalactic game of chess.
  8. And last but not least Armed Guards!!!!!!!!

That is my very small rendition of the pros and cons of raiding area 51. I personally wouldn’t do it in respect for our own government in keeping secrets and making America a great place to live, but I hope that this group does raid area 51 because I would like to see how everything would turn out. I just hope if there is aliens there that they do not destroy earth because they have been revealed to the public while if there is aliens here and they have the technology to come all of this way then they could probably destroy earth with the snap of their fingers. Thank you for reading haha!!!!!! Good luck raiders of the area 51 lost arc!!!!!!

Information Warfare: Closing Thoughts

This will be my last blog dealing with information warfare even though I may eventually pick back up and make more information warfare related blogs. I wanted to close with a view about information warfare and dealing with malware attacks like stuxnet. Stuxnet was a malicious program made in secret by the United States. Its main goal was to breech Iranian uranium enrichment plants security in an effort to disrupt the normal operations of the centrifuges. Now that sounds great in preventing other countries from obtaining nuclear weapons but how I see it is that using malware to attack other countries facilities could be a very dangerous game. Stuxnet was not supposed to be made public and for good reasons. The people who made stuxnet were very angry that it was spread around and made public, and this kind of carelessness when making malware to attack adversary’s facilities should not be taken lightly.

First of all, one thing that I have always thought of and fear the most about information warfare since I heard of stuxnet a couple years back is when if a country attacked another countries nuclear power plants. That would be very catastrophic if a country were able to cause a nuclear meltdown of a nuclear power plant with malware. We all know from experience in Chernobyl that a nuclear meltdown can be a very expensive thing to fix and can cause many deaths to civilians. That is my main concern about information warfare. Although information warfare will likely cause fewer deaths due to non-physical means of use, if the right malware were spread into the right facility it could be even more catastrophic than the effects of physical warfare. I hope that the United States and all of their allies work together in an effort to eradicate the world of such malware attacks used for information warfare.

Stuxnet was a marvel in malware and could be one of the most important information warfare lessons that any nation could learn from. While it did complete its objective and disable the Iranian uranium enrichment plants, it also got out into the public. Even though stuxnet getting out into the public did not cause any harm, the lesson learned from that type of malware is tenfold important to nations everywhere. If another stuxnet that was more lethal in the sense that it could attack a very volatile facility causing the deaths of many people were made, even if the objective was completed there could be a chance that it may backfire on the country that created it and cause a great deal of damage.

source :

Information Warfare: Cyber Command

The cyber command was created in 2009 to work as a department in battling cyber crimes in the United States. Since cyber crimes are increasing rapidly between allies and adversaries the demand of having a cyber command organization has also increased rapidly. If you think of all of the cyber attacks on different countries you will start to wonder what exactly is being done about this. President trump wants to elevate the Cyber Command organization to Unified Combatant Command and this view that Donald trump has is consistent with Defense Secretary Mattis. They both agree that cyber crimes is becoming more and more important of a situation to be dealing with as technology advances very rapidly.

The cyber command division will probably consist of over 6000 workers divided into approximately 133 teams. With those numbers, you can see that there are many different kinds of cyber threats that the United States has to deal with these days. I think that Donald trump is definitely on the right track beefing up the cyber crimes departments because this is the future and all that may be left someday is to reign supreme in the information warfare sector. All the different countries agree that loosing lives in physical warfare is unacceptable and are working to eliminate deaths by means of physical warfare. That leaves the question of who will dominate the information warfare sector as warfare settles down to a subtle game of chess.

New decisions are being made every day to elevate the position of cyber warfare divisions because of the ever-evolving threat of information technology. The president of the United States has a huge responsibility in preserving the security of America’s information infrastructure day by day. I think personally that the cyber command should be a very well funded organization in the United States, as it is partially responsible for national security from adversarial threats. It would not surprise me if the numbers of workers for the cyber command grows exponentially because that seems what the rate of technological evolution seems to be and we need at least a team of workers for every single technological advance that is made.

source :

Information Warfare: New Russian Details

The defense intelligence agency makes reports on threat levels of Russia in using information warfare and it included a cyber-enabled psychological warfare operation. Russia has many known government backed trolls to spread the pro-Moscow information all around the world and no one knows if that number of trolls is increasing or declining although I would say that they are increasing with the amount of misinformation spreading around these days. The DIA director says that the Russian military threat will likely increase. They say in the future the Russians may be able to create information blockades and achieve information dominance. The Russians have been in the information warfare sector probably since the very beginning and there is no chance that they will ever back down.

The Russians aim to shape and manipulate the perception of foreign people. They have been doing it for a long time now because of the speed of the spread of information over the internet it seems Russia is on top of that game. Russia wants to sway the peoples view into thinking that Russia is superior to any other nation state in information dissemination. This kind of persuasion or spreading of propaganda is proven very effective in spreading division in other countries. If you think about it if you can divide a country to an extent that everyone hates each other for opposing views than maybe that country would be much more susceptible to an invasion with physical force. I don’t know if that will ever happen but with how politics works in the united states there is plenty of division so maybe the people of the united states already are trained for these kind of divisive tactics which means that they are pretty much useless.

There is also mention of automated bots being used by Russia in information warfare, which is a real threat. Programming bots to spread information dividing the public opinion even further can be effective because bots work at a level that is not achievable by man. Bots work so fast that one message could be spread a million times in a second if the bot is programmed to do so. The use of bots can only increase in the realm of information warfare especially with the up and coming artificial intelligence capabilities. Bots are a real threat to be looked at very carefully if we are ever going to get the edge in the information warfare sector.

source :

Information Warfare: Russia and GMO’s

Everyone knows the controversy surrounding (GMO’s) Genetically Modified Organisms. Whether or not they are better or worse than natural organisms is still up for debate. Russia it seems has been spreading false information about GMO’s, portraying them in a very negative sense. They are claiming that they have a much cleaner agricultural way that those countries that use GMO’s. This claim that Russians were spreading misinformation about GMO’s was brought to attention by researchers at Iowa State University who were on a research project to find the underlying cause of the controversy surrounding GMO’s. Russia would link GMO related articles to very negative topics on the internet so when a person was reading something that was actually very negative like a crime or something then the link at the bottom of the article was to GMO related article. Hence, if an article about a crime is thought of negatively than the GMO link must mean that GMO’s should be seen negatively too.

Whether Russia has a cleaner source for agriculture or that the claim is misinformation itself is completely irrelevant when it comes to their ability to sway the public opinion. Russia is known for amplifying certain sensitive issues in the media, like black lives matter, and the 2016 presidential election. Russian propaganda is so discretely placed that anyone would think that it could be from anyone and it could even be a very credible source. Russia is on top of their information warfare game and they will not stop. I personally cannot criticize the Russians for leveraging their advanced skills in the dissemination of information because they are damn good at it. It seems that there is nothing that anyone can do about the spread of misinformation to sway the public opinion. Some people out there are very gullible and will believe anything that will fit into their belief system.

Russia must have some master trolls because their dissemination of information is proven very effective. I have some friends on social media and I laugh at their attempts to troll other people that are discussing issues that are sensitive to them. Russia on the other hand has taken the troll aspect of the information highway and turned it into an extremely effective means of altering the public opinion. Thinking about ways to defend against this kind of information warfare has me drawing blanks. It is a very difficult thing to defend against because many people will hop on the bandwagon just because it fits into their belief system and they will spread and troll just the same. In the United States of America, freedom of speech allows anyone to state their opinions but you just have to remember that sometimes it is the facts that matter and not what you would like to believe.

source :

Information Warfare: North Korean Agents

North Korea may not have a relatively sound information infrastructure but you can bet that they are training their people to indulge in the field of information warfare for the benefit of their country. North Korea is training their elite families in a school meant to transform these families into government and military workers. They are training them to be agents to track down and possibly kill defectors of North Korea. They will either kill them or convince them to come back to North Korea supposedly. The school called Mandyongdae will train agents to go to “enemy” countries to carry out plans to find certain defectors of their country. They are being trained in hacking skills and all of the underground hacking abilities along with speaking fluent South Korean with according accent. The most important skill that these students of the Mandyongdae school will learn is loyalty to North Korea.

Hunting down defectors using social media and other media outlets will be a strong training point for the students. North Korea is becoming more and more concerned with their people defecting to South Korea and China. These agents are also trained to monitor other North Korean hackers and determine their loyalty to the country. That is because many hackers from North Korea become defectors and release some very top secret information that is not too top secret anymore. These agents are difficult to identify or detect because of their intense training. With all of the sanctions put on North Korea, they are desperate for money, which is what many of the agents are after with their hacking abilities. The Chinese government approves these North Korean agents to work out of china in exchange for special favors and guarantee that they will not hack into any of Chinas networks.

South Korea claims that annually they spend about 800 million dollars in dealing with North Korean cyber attacks. North Korea always had it in for the South Korean people and they are sparing no expense to get the defectors eliminated. Many of the North Korean people want to leave because they find that the government is a complete failure and many flee the country every year. I think that Kim Jung Un truly wants better for his people because he met with president trump to discuss the ending of their nuclear program. The leaders of the United States and North Korea meeting up is a very rare thing to occur and aside from hacking, I would hope that North Korea really changes their government and frees their people to join the rest of the free world.

source :

Information Warfare: Russia and Europe

Russia is known to commence information warfare tactics on different countries and they do it quite well because everyone just talks about it and no one does anything about it. A general from Russia noted that information warfare is much more powerful than physical warfare with weapons and it is much more effective. Some say that Russia has committed much information warfare on countries in Europe since information warfare became a plausible means for warfare in today’s world. Russia is addicted to controlling information in other countries and the main reason is that they crave power. They love to disseminate propaganda and sway the public opinion in their favor. However, not only has the use of propaganda benefited Russia in the new age of information warfare, but malicious attacks on other countries information infrastructures have taken place.

No one really knows if Russia is behind some of the malicious attacks on other countries. It could simply be someone framing Russia for attacks. In 2015, a broadcaster in France was attacked and taken offline and its resources were nearly destroyed. Russia was also blamed for a massive data breach in Germany’s parliament having acquired gigabytes of data. Bulgaria was attacked in 2016 and is said to be one of the biggest attacks in south Eastern Europe. I mentioned before the huge denial of service attack on Estonia that happened a while back that Russia had commenced, disabling Estonia’s web sites. The Estonian officials compare the Russian attacks on their infrastructure to the September 11 attacks on the United States, even though I think that is a little too extreme. The Russians supposedly even did an attack on a Ukrainian power plant in 2015 that lead to days of a blackout. Luckily, it was just a blackout and not a major problem like a meltdown which really concerns me with all of the information warfare going on these days I hope that it will not hurt any people.

Even though Russia denies any of these attacks, all parties involved are pointing fingers in the direction of Russia. Russia’s information warfare abilities are becoming more and more advanced in the world today especially with the quickly evolving information infrastructures of the world. That could be one of the reasons that president trump is trying to have good relations with Russia, which I think is a good idea. If the United States and Russia teamed up, they could be powerful allies in the conquest of information warfare and even possibly bring peace to the whole world. Information warfare is quickly replacing physical warfare and I think that is a great thing. Instead of a game of Russian roulette where a person are critically injured we could all just settle for a game of chess.

source :

Information Warfare: Americas Response

The United States has one of the most powerful information infrastructures in the world. That being said, the Russians have been known to use information warfare for a long time, probably since the internet became available to them. The Russians invented Tetris, which was a big hit around the world, which is somewhat how I think about Russians when it comes to information warfare. The Russians are known for commencing information warfare attacks in what is known as the “grey area”. The grey area is the part of information warfare that does not have any known laws that apply to international affairs concerning information warfare. There are sanctions that are placed on countries and that is pretty much as far as it goes with international affairs that concern information warfare. So what can the United States do in an effort to broaden their influence on information warfare? Legislative measures are what needs to be taken to prevent the other super powerful countries from committing acts of information warfare.

When laws are made and actually taken into consideration about cyber crimes then the United States will be able to prevent cyber attacks. Russia is known to boast about their interference in elections and espionage behavior. They carried out an attack on Estonia to cripple their networks when they tried to remove a Soviet era memorial. There was nothing that any other countries could do about it because there are not any international laws put in place about cyber crimes. Is the rest of the world waiting for America to step in and take care of the other super power countries use of information warfare? The other countries in the world are probably waiting for the international legislation to substantiate in the favor of the United States stepping in and resolving cyber criminal’s activity when using information warfare tactics. Russia is so advanced at information warfare using propaganda, disinformation, and spying on other countries that there needs to be some sort of measures that can be taken to prevent them from using information warfare.

The United States of America needs to work on a response to information warfare attacks not just on the United States but also on any country in the world that would seem less information infastructurally advanced. We will just have to work for years and years on international laws to be able to enforce actions on adversaries and any other cyber criminal countries. Everything seems to be on an international type of peaceful platform when it comes to warfare with guns and physical weapons of war, but the information warfare abilities has pretty much just begun. We are in a new era of propaganda and other ways to influence the public opinion and Russia seems to be ahead of the game when it comes to these information warfare tactics.

source :