C/C++ :: How To Write Multi-layered Perceptron

Jan 26, 2014

I recently wrote a perceptron that determines whether a point is above or below a line. I'm trying to write a multi-layered ANN so I can use it to solve more complicated problems than "is this point above/below this line?"

Here's my source code: [URL] ....

Considering that a A XOR B is simply (NOT A AND OR (A AND NOT , and both of those are linearly separable...

View 14 Replies


ADVERTISEMENT

C++ :: Cannot Seem To Find Logic Error In Perceptron

Jan 28, 2014

I can't seem to find the logic error in my perceptron. The perceptron's feedback function pushes back a bias of 1.0 into the input vector, and calculates the dot product of the input vector and it's weight vector, and returns 1 if the dot product is > 0, and -1 otherwise. This will determine whether the inputted point is above or below the hyperplane given by the functor.

The training function instantiates a trainer object , which feeds it a vector random numbers, along with the correct answer (in this case, whether the point is above or below the hyperplane given by a functor). It then calls the feedback function, and subtracts its answer from the correct answer, and updates the weights by adding the input vector to the weight vector, and multiplying the weight vector by the error, and by a correction factor, in this case 0.01.

Typedef.hpp

Code:
#ifndef TYPEDEF_HPP
#define TYPEDEF_HPP
#include <vector>
#include <random>
typedef std::vector<float> FloatV;
typedef std::random_device RNG;
typedef std::uniform_int_distribution<> UID;

[Code] ....

View 14 Replies View Related

C++ :: Why Can't Perceptron Determine If Point Is Exactly On The Line

Jan 26, 2014

When I use my perceptron, it classifies everything appropriately, except it always says points that are exactly on the line are above it.

View 9 Replies View Related

C++ :: Multi Threaded Insertion Into STL Map?

Aug 25, 2014

Suppose multiple threads are are trying to insert into a STL Map, both are trying to insert with same key. As per my understanding it will not cause any issue till you invalidate the iterator. Here as per me it will not invalidate the iterator.

View 2 Replies View Related

C :: Multi Character Is Showing Error

Mar 26, 2014

When i am entering single character instead of 'miz' then it is working great. But when i am using multi character like 'miz' it is showing error output. i did this program with c++ it is working but not working in c.When i am running this program it is showing {warning] multi character constant.

Code:

#include<stdio.h>
#include<string.h>
main()
{
char a;
printf("Please Enter your First Name: ");
scanf("%s",&a);

[Code]....

View 1 Replies View Related

C++ :: How To Make Minimax Multi Player

Nov 29, 2013

I have pseudo code for the minimax algorithm but i was wondering what i would need to add to make it work with many players (n players)?

score minimax(state s, int n)
if (n = 0 OR s is a terminal node) {
if win position for program
return +inf;
if loss position for prg

[Code] ....

View 3 Replies View Related

C++ :: Multi-dimensional Arrays Of Objects

Feb 15, 2013

i want to make a two-dimensional array that is consisted by objects but i dont want to initialize the objects when i make the array.. i just want to make an array that each of his "cells" has the size of an object.For example,

class Human{
int hm=5;
...
};

and now i want to make a two dimensional array that each "cell" has the size of an Human but not a Human itself.

View 2 Replies View Related

C# :: Swapping Multi Usercontrol In 1 Winform?

Jul 29, 2014

So basically, I started out with each wizard == 1 winform, but then I found another way to do it by making the content of each wizard step a user control, then say, on initial deployment, it load usercontrol1, then when i click next, the panel hide usercontrol1 for usercontrol2 and so forth. Would it be feasible to create all usercontrols (all the wizard step) and add them in an array, then i can load them by index?

View 7 Replies View Related

C++ :: Multi Agent Path Finding

Feb 25, 2014

I am new to Path Finding so I just know BFS, DFS, Djisktra, and Basic A*

I've searched for a few multi agent pathfind paper here and there. But I can't seem to understand them..

I am path finding in a grid map, 4 ways neighbor movement

My map isn't so big it's 300 x 300 up to 400 x 400

Most of the map is open space, I would say that at worst case 4/5 of the map is open space.

And there is probably around 100 agents.

I've tried running BFS 100 times and it takes around 200ms on average

Changing BFS to A* which I am thinking right now will definitely cost lesser time

But are there better ways in doing this ? and also Does running Single Agent A* multiple times doesn't cause problem for other agent ? perhaps causes deadlocks ? ( Considering that the path that have been determine for agents before the current searched is considered blocked )

View 1 Replies View Related

C/C++ :: Make Multi Cout / Cin In The Same Line?

Nov 17, 2014

#include<iostream.h>
#include<conio.h>
main()

[Code]....

I tried to make the output look like this --> ENTER YOUR NAME:Victor Collin ENTER YOUR COURSE:BSComSci
but everytime I entered my name the course went to the next line.How to make the output in the same?

View 7 Replies View Related

Visual C++ :: ODBC Multi Connections To Same DB Or Not?

Oct 16, 2012

I made a C++ Wrapper on top of ODBC.

I got a Connection, and a Statement class.

The Connection class holds the Database Connection ODBC Handle.

The Statement class holds the Statement Handle, there can be multiple per Connection. It is made and destroyed each time a query must be done on the DB.

Now I'm just wondering.

I have a multithreaded application.

Is keeping one Connection for one DB enough for the whole application? Where the different threads will make Statements based on that one Connection.Or is it better to keep a Connection per thread?

View 3 Replies View Related

C :: How To Remove Multi Character Constant Warning

Feb 20, 2013

Here's the line of code with the warning

Code: if((addressbook[3][num][4]=='-')&&(strlen(addressbook[3][num])=='10'))

Or what might be the possible causes of such a warning?

View 2 Replies View Related

C :: Multi User Chat Over TCP/IP In Visual Studio

Jun 1, 2014

I want to have a multi user chat over TCP/IP. I already have the code for both the server and the client and so far I am able to send messages from the client to the server. Now I want to make it a multi user chat. I am executing the codes using Visual studio's Command prompt(not Windows Command Prompt). I have read somewhere that we have to use select() function.

View 2 Replies View Related

C++ :: How To Share Information In Multi File Project

Dec 9, 2013

this last few days I've been coding this one particular file

Hero.cpp

namespace Hero {
namespace {
// all data here
}
}

then the code grew a bit to about 700 line

Then now I want to implement hero skill system It needs the access to data inside the unnamed namespace where I put just about everything.. but it's unnamed namespace, it's only valid within one file and I should hide all that data from Hero interface in Hero.h How should I do this ?

View 12 Replies View Related

C++ :: Delete Object In Multi-thread Situation

Feb 11, 2014

I have to delete an object at a time that I don't know it's held by another thread(s) or not. For example

static void foo(CLASS* ref){
pthread_mutex_lock(&l);//[POINT-A]
//using ref
//do something thread safe
pthread_mutex_unlock(&l);
delete ref;// how can I find out there is no any thread held at [POINT-A]
}

View 2 Replies View Related

C++ :: Passing Dynamic Multi-Dimensional Arrays

Jan 29, 2015

I need to create subfunctions to do basic Matrix mathematics (addition, subtraction, etc.) I need to be able to pass bot of my Matrices to subfunctions. I started with the addition sub function and I cant get the code to run. I keep getting expected primary-expression before ']' token error for line 75.

#include <iostream>
#include <stdio.h>
using namespace std;

[Code].....

View 1 Replies View Related

C++ :: Multi Condition Function For Char Type

Jan 30, 2013

I have always written like a>='0'&&a<='9'&&a>='a'&&a<='z' in loops etc, but no more. Basically add whatever you want to condition, and if you want point a to point b just separate them with a '-' sign. Simply

while(!isCharInside(x,"|a-zA-Z0-9.*/=|-|")){/*code*/}
bool isCharInside(char check,string condition="a-zA-Z*/+=|-|0-9"){
for(unsigned int x=0,z=getLenght(condition);x<z;++x){
if(condition[x+1]=='-'&&(condition[x]!='|'&&condition[x+2]!='|')){
if(condition[x]>condition[x+2])swap(condition[x],condition[x+2]);
for(;condition[x]<=condition[x+2];++condition[x]){if(condition[x]==check)return true;};x+=2;}
else if(check==condition[x])return true;
}
return false;}

View 1 Replies View Related

C++ :: Save The Indexes Of Multi-dimensional Arrays

Apr 8, 2014

I am working on the game of fifteen.Yes this is home work. I was wondering if it is possible to save the indexes of an element in a two dim array. I need to find the position of the space in the two dim array save it, find the position of the tile which is passed in as an int and swap the two if they are adjacent. Here is my code

Edit: I can do this by saving i and j in separate int variables but is there a more elegant way of doing this

int board[MAX][MAX];
void init();
void swap(int* lhs, int* rhs);

[Code].....

View 3 Replies View Related

C# :: T-SQL Multi Table Union To Call Out Data

Jul 15, 2014

I'm trying to union eleven tables to call out data. Parent table is 'Events', child tables are 'SR1Laptimes', 'SR2Laptimes' and so on (there are ten SR... tables). Primary key in all tables is EventName. Parent/Child relationship is Events.EventName/SR1Laptimes.EventName etc All tables that start with SR have the same Schema. I'm trying to call out MIN(Q1) across all table but first need to Union them I believe. Here is my code.

myCommand.CommandText = "SELECT MIN(Q1), MIN(Q2), MIN(Q3), MIN(Q4), MIN(LaptimesMinutes), MIN(LaptimesSeconds) FROM (SELECT * FROM Events UNION ALL SELECT * FROM SR1Laptimes UNION ALL SELECT * FROM SR2Laptimes) WHERE (Events.Track = @track) AND (Events.Number = @number) AND (Events.Rider = @rider)";
myCommand.Parameters.AddWithValue("@track", analysisTrackComboBox.Text);
myCommand.Parameters.AddWithValue("@number", analysisNumberComboBox.Text);
myCommand.Parameters.AddWithValue("@rider", analysisRiderComboBox.Text);

View 4 Replies View Related

C Sharp :: How To Delete Multi Rows In Datagridview

Sep 14, 2014

I delete rows in datagridview using chcekbox column. I write the following code:

private void btndelpay_Click(object sender, EventArgs e) {
DialogResult dr = MessageBox.Show("delete row", "do you want to delete", 
MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (dr == DialogResult.Yes)

[Code] ......

my problem is /how to umcheck from rows in datagridview in chechboxes column when the user select dialogResult.NO

View 1 Replies View Related

C++ :: Handle Exception In Multi-threaded Environment

Oct 24, 2014

Here is the code,

Code:
void foo() {
Acquiring lock
do something...
Func();
Releasing Lock
}

If the function Func throws an exception, there is potential deadlock issue. Then I handle exception like this,

Code:
void foo() {
Acquiring lock
do something...
try{
Func();

[Code] ....

Is this a good practice? I wonder how I can apply RAII in handling exception here.

View 2 Replies View Related

C++ :: Intermediate File Multi-process Safety?

Jul 21, 2012

I have a compressor that takes a file and first compresses it to an intermediate file "temp.lz", before compressing it to the final format. Immediately after that the file be removed by calling c's remove(char*). The problem I am afraid of is if calling this compressor from different processes is safe because of the intermediate file created which has the same name for all. (say temp.lz). Will I have problems when callinga sytem call from different process something like: system ("compress -i test.txt -o test.z") ?

I was thinking of rewriting the compressor to avoid the use of the temporary file but that is a bit awkward. I just need to use a temporary stream (file) different for each process to avoid race conditions.

View 8 Replies View Related

C++ :: Can Use Templates To Make A Multi-type Linked List?

Apr 28, 2014

If I wanted an int connected to a float connected to a string connected to a POD, would all I have to do is :

Code:

template<class T, class X>
struct node {
T data;
node<X> *next;
};

Or would I be forced into using polymorphism?

View 10 Replies View Related

C++ :: Recursive Directory Scan - Can Use Multi-threading For Speed?

May 11, 2014

In our Qt application, we have to load several files on application start-up starting from a root directory.

We are recursively scanning the directories and loading the files.

The total time it takes is about 12 seconds. Can we reduce this time if we use multi-threading?

I have heard that multi-threading does not work everywhere and it increases code complexity and debugging issues.

Would multi-threading solve the above problem? We want it to be platform independent (Mac, Linux, Windows).

View 9 Replies View Related

C++ :: Finding Lowest / Highest In Multi-dimensional Array

Mar 25, 2013

I have this multi-dimensional array. There are 12 rows, each represents the months, and 2 columns, the 1st column represents the lowest temperature and the 2nd column represents the highest temperature.

I need to find the lowest temperature in only the first column and the highest in only the 2nd column.

This takes in the temperatures. LOHI = 2, MONTHS = 12, LOW = 0, HIGH = 1

void PopulateTemp(int temp[][LOHI])
{
for(int month = 0; month < MONTHS; month++)
{
cout << "Month " << month+1 << endl;

[Code]......

My professor said we only needed 1 for loop as you only need to read the data from one column in each?

View 10 Replies View Related

C++ :: Global Class Instance In Multi-File Project

May 3, 2013

I'll just tell you in short how my Problem looks like: I should implement a New Class in a SourceCode i didnt write myself. The source code is extremely sized (i think approx >100.000 Lines of Code), so i dont want to change too much in it in order to get my Implementation done.

MY problem looks simplicified like that: Starting from 3 classes and my new class the pseudo-code looks like that:

Class1(){
float* m_CalibX, m_CalibY;
.. }
Class2(){
char* m_ImageData[];

[Code] .....

So, i need Parameters from 3 different classes to insert in my NewClass. The 3 Classes dont know anyting about each other. So, i need to implement a Class-Instance from Type NewClass which is known by the other 3 Classes. I did solve it in this way:

//ClassInstance.h

#include "NewClass.h"
static NewClass ClassInstance

I just wrote a headerfile with a class-instance which is getting included by the other 3 Classes. So they all know the same Instance and writing their Parameters into it. Is this a decent solution or could it happen to get bugs/ logical mistakes with it?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved