Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I try to make an survey/history of all C-to-hardware compilers.
For all that dont know them: they take C code then translate it into some hardware description language (like VHDL or Verilog), which then can be used to generate hardware (usually it gets mapped to an FPGA - but I am not limited to that, ASIC as target would be fine too).
I already have quite collected some (+ info about them). So my question is: Do you know any other compilers (and if so have any references, pointers, information about them)?
My list so far:
AutoESL
Bach-C (Sharp)
C2H (Altera)
C2R (Cebatech)
C2Verilog (CompiLogic / C Level Design / Synposys)
Carte / MAP (SRC Computers)
Cascade (CriticalBlue)
CASH (Carnegie Mellon University, Pittsburgh)
Catapult-C (Mentor Graphics)
CHC (Altium)
CHiMPS (University of Washington (Seattle) / Xilinx / soon commercial?)
C-to-Verilog (Haifa)
Comrade (TU Braunschweig E.I.S. + TU Darmstadt E.S.A.)
CVC (Hitachi)
Cyber (NEC)
Daedalus (Uni Amsterdam, Uni Leiden)
DIME-C (Nallatech)
eXCite (YXI)
FP-Compiler (Altera)
FpgaC (OpenSource)
GarpCC (Callahan, University of California at Berkeley)
GAUT (UBS-Universität Frankreich)
Handel-C (Celoxica)
Hthreads (University of Kansas)
Impulse-C (Impulse Accelerated Technologies)
Mitrion-C (Mitrionics)
DWARV (TU Delft)
NIMBLE (Synopsys, E.I.S. Braunschweig)
NISC (University of California, Irvine)
PICO-Express (Synfora => Synopsys)
PRISC (Harvard University, Cambridge)
ROCCC (University of California, Riverside)
SPARK (University of California, Irvine)
SpecC (Gajski et al.)
Trident (OpenSource, Los Alamos National Laboratory)
UGH
VEAL
vfTools (Vector Fabric)
xPilot (University of California, Los Angeles)
(I know not all on the list have C as soure, some use C-similar dialect, and almost all support only a subset, I am also interrested in such).
EDIT: I know how to use google, so I already checked the ususal suspects and have included the results. So it is very likely that someone can only answer here if he does really know some paper or exotic tool (or maybe not so exotic but that implements the functionality somehow hidden, and the compiler is not advertised).
System-C?
Rotem CToVerilog, I don't know anything about it, just googled it up.
LegUp: http://legup.eecg.utoronto.ca/
There is also HercuLeS (provisional name), which is MY HLS tool.
Get the (old) tech. demo from here
http://www.nkavvadias.co.cc/misc/hls-demo-linux-0.0.1.tar.gz
Things have progressed since then.
Let me know if you want a tech. presentation detailing a real-life examples, e.g. a multi-function CORDIC.
Cheers,
Nikolaos Kavvadias
OpenCL support at Altera and Xilinx.
OpenCV support by Xilinx. OpenCL + OpenCV support by Altera. See this post. I talk about the OpenCL+OpenCV both based on C languages.
Altera has OpenCL SDK which is used with Quartus. Xilinx has Vivado HLS.
Cynthesizer, which is SystemC based. CellMath will go the other way, take Verilog and create a C model.
Related
I use AngularJS to create a page where a user can correct a text (for example grammar, typo ... ).
I cannot use a Textarea because I want to keep trace about changes and let user rollback a correction on each word.
The following code work but it take a few seconds to render with page freeze, specialy on IE like 30 seconds), the text to correct can be very long like in the example.
I use a ng-repeat to display the text (which is an array of word). For each word I text in html if it is punctuation or a <br> or an editable word.
Is there a way to optimize this or to create in a JS way (like a compile html or anything faster)?
PLUNKER
HTML
<div ng-controller="Ctrl1">
Correct the text
<span ng-repeat="word in words track by $index">
<br ng-if="word.br"/>
<span ng-show="(!word.br)&& !word.edited">
<span ng-if="word.editable" class="correct-span" ng-click="word.edited = true">{{word.u}}</span>
<span ng-if="!word.editable">{{word.u}}</span>
</span>
<span class="my-danger" ng-show="(!word.br)&& word.edited">
<input type="text" ng-model="word.u">
<button ng-click="word.edited = false;word.u = word.o">X</button>
</span>
</span>
</div>
My controller :
var myApp = angular.module('myApp', []);
myApp.controller('Ctrl1', ['$scope', function($scope) {
function tools_isString(myVar){
return (typeof myVar == 'string' || myVar instanceof String);
}
/***
* test if object if defined
* #param object
* #returns {boolean}
*/
function tools_defined(object){
return (( typeof object !== undefined) && ( typeof object !== 'undefined') && ( object !== null ) && (object !== "")) ;
}
/**
* test if a word is in array
* #param mot : string
* #param tableau : array list
* #returns {boolean}
*/
function tools_inArray(word, array) {
if(tools_defined(array)&&tools_defined(word)) {
var length = array.length;
if (tools_isString(word)) {
word = word.toLowerCase();
}
for (var i = 0; i < length; i++) {
if (tools_isString(array[i])) {
array[i] = (array[i]).toLowerCase();
}
if (array[i] == word) return true;
}
}
return false;
}
function escapeRegExp(string) {
return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
function tools_replaceAll(str, find, replace) {
if(str == null ){
return null
}
return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);
}
var prepareTextToCorrect = function(inputstring){
//encode new lines
inputstring = tools_replaceAll(inputstring,"<br/>","*br*");
inputstring = tools_replaceAll(inputstring,"<br>","*br*");
// unescape
inputstring = inputstring.replace(/&(lt|gt);/g, function (strMatch, p1){
return (p1 == "lt")? "<" : ">";
});
// remove all the hmtl tags
var rex = /(<([^>]+)>)|(<([^>]+)>)/ig;
inputstring = inputstring.replace(rex , "");
// re encode new lines
inputstring = tools_replaceAll(inputstring,"*br*"," <br/> ");
// separating punctuation from words
var ponctuations = [",","?",",",";",".",":","!","-","_","(",")","«","»","—"];
for(var p in ponctuations){
inputstring = tools_replaceAll(inputstring,ponctuations[p]," "+ponctuations[p]);
}
inputstring = tools_replaceAll(inputstring," "," ");
inputstring = tools_replaceAll(inputstring," "," ");
var elements = inputstring.split(" ");
var res = [];
/**
* "o" : original word
* "u" : word edited by user
* "edited" : if user edited this word
* "editable" : if the word can be edited ( ponctuation and <br> cannot )
*/
for(var i in elements){
if(elements[i].length>0) {
if(elements[i] == "<br/>") {
res.push({
"o": null, "u": null, "edited": false, "br":true
});
} else if (tools_inArray(elements[i], ponctuations)) {
res.push({
"o": elements[i], "u": elements[i], "edited": false,"editable": false , "br":false
});
}else{
res.push({
"o": elements[i], "u": elements[i], "edited": false,"editable": true , "br":false
});
}
}
}
return res ;
};
var text = "Stack Overflow is a question and answer site for professional and enthusiast programmers. It's built and run by you as part of the Stack Exchange network of Q&A sites. With your help, we're working together to build a library of detailed answers to every question about programming.<br/><br/>We're a little bit different from other sites. Here's how:<br/>Ask questions, get answers, no distractions<br/><br/>This site is all about getting answers. It's not a discussion forum. There's no chit-chat.<br/><br/>Just questions...<br/>...and answers.<br/>Good answers are voted up and rise to the top.<br/><br/>The best answers show up first so that they are always easy to find.<br/>accept<br/><br/>The person who asked can mark one answer as accepted.<br/><br/>Accepting doesn't mean it's the best answer, it just means that it worked for the person who asked.<br/>Do Swift-based applications work on OS X 10.9/iOS 7 and lower?<br/>up vote 14 down vote favorite<br/><br/>Will Swift-based applications work on OS X 10.9 (Mavericks)/iOS 7 and lower?<br/><br/>For example, I have a machine running OS X 10.8 (Mountain Lion), and I am wondering if an application I write in Swift will run on it.<br/>ios osx swift<br/>asked Jun 2 '14 at 19:25<br/>MeIr<br/>3,27752557<br/>2 Answers<br/>up vote 4 down vote accept<br/><br/>Swift code can be deployed to OS X 10.9 and iOS 7.0. It will usually crash at launch on older OS versions.<br/>answered Jun 3 '14 at 8:25<br/>Greg Parker<br/>6,21011118<br/>up vote 3 down vote<br/><br/>Apple has announced that Swift apps will be backward compatible with iOS 7 and OS X Mavericks. The WWDC app is written in Swift.<br/>answered Jun 3 '14 at 0:03<br/>Ben Gottlieb<br/>73.3k19161166<br/>Get answers to practical, detailed questions<br/><br/>Focus on questions about an actual problem you have faced. Include details about what you have tried and exactly what you are trying to do.<br/><br/>Ask about...<br/><br/>Specific programming problems<br/>Software algorithms<br/>Coding techniques<br/>Software development tools<br/><br/>Not all questions work well in our format. Avoid questions that are primarily opinion-based, or that are likely to generate discussion rather than answers.<br/><br/>Questions that need improvement may be closed until someone fixes them.<br/><br/>Don't ask about...<br/><br/>Questions you haven't tried to find an answer for (show your work!)<br/>Product or service recommendations or comparisons<br/>Requests for lists of things, polls, opinions, discussions, etc.<br/>Anything not directly related to writing computer programs<br/><br/>Tags make it easy to find interesting questions<br/><br/>Stack Overflow is a question and answer site for professional and enthusiast programmers. It's built and run by you as part of the Stack Exchange network of Q&A sites. With your help, we're working together to build a library of detailed answers to every question about programming.<br/><br/>We're a little bit different from other sites. Here's how:<br/>Ask questions, get answers, no distractions<br/><br/>This site is all about getting answers. It's not a discussion forum. There's no chit-chat.<br/><br/>Just questions...<br/>...and answers.<br/>Good answers are voted up and rise to the top.<br/><br/>The best answers show up first so that they are always easy to find.<br/>accept<br/><br/>The person who asked can mark one answer as accepted.<br/><br/>Accepting doesn't mean it's the best answer, it just means that it worked for the person who asked.<br/>Do Swift-based applications work on OS X 10.9/iOS 7 and lower?<br/>up vote 14 down vote favorite<br/><br/>Will Swift-based applications work on OS X 10.9 (Mavericks)/iOS 7 and lower?<br/><br/>For example, I have a machine running OS X 10.8 (Mountain Lion), and I am wondering if an application I write in Swift will run on it.<br/>ios osx swift<br/>asked Jun 2 '14 at 19:25<br/>MeIr<br/>3,27752557<br/>2 Answers<br/>up vote 4 down vote accept<br/><br/>Swift code can be deployed to OS X 10.9 and iOS 7.0. It will usually crash at launch on older OS versions.<br/>answered Jun 3 '14 at 8:25<br/>Greg Parker<br/>6,21011118<br/>up vote 3 down vote<br/><br/>Apple has announced that Swift apps will be backward compatible with iOS 7 and OS X Mavericks. The WWDC app is written in Swift.<br/>answered Jun 3 '14 at 0:03<br/>Ben Gottlieb<br/>73.3k19161166<br/>Get answers to practical, detailed questions<br/><br/>Focus on questions about an actual problem you have faced. Include details about what you have tried and exactly what you are trying to do.<br/><br/>Ask about...<br/><br/>Specific programming problems<br/>Software algorithms<br/>Coding techniques<br/>Software development tools<br/><br/>Not all questions work well in our format. Avoid questions that are primarily opinion-based, or that are likely to generate discussion rather than answers.<br/><br/>Questions that need improvement may be closed until someone fixes them.<br/><br/>Don't ask about...<br/><br/>Questions you haven't tried to find an answer for (show your work!)<br/>Product or service recommendations or comparisons<br/>Requests for lists of things, polls, opinions, discussions, etc.<br/>Anything not directly related to writing computer programs<br/><br/>Tags make it easy to find interesting questions<br/><br/>Stack Overflow is a question and answer site for professional and enthusiast programmers. It's built and run by you as part of the Stack Exchange network of Q&A sites. With your help, we're working together to build a library of detailed answers to every question about programming.<br/><br/>We're a little bit different from other sites. Here's how:<br/>Ask questions, get answers, no distractions<br/><br/>This site is all about getting answers. It's not a discussion forum. There's no chit-chat.<br/><br/>Just questions...<br/>...and answers.<br/>Good answers are voted up and rise to the top.<br/><br/>The best answers show up first so that they are always easy to find.<br/>accept<br/><br/>The person who asked can mark one answer as accepted.<br/><br/>Accepting doesn't mean it's the best answer, it just means that it worked for the person who asked.<br/>Do Swift-based applications work on OS X 10.9/iOS 7 and lower?<br/>up vote 14 down vote favorite<br/><br/>Will Swift-based applications work on OS X 10.9 (Mavericks)/iOS 7 and lower?<br/><br/>For example, I have a machine running OS X 10.8 (Mountain Lion), and I am wondering if an application I write in Swift will run on it.<br/>ios osx swift<br/>asked Jun 2 '14 at 19:25<br/>MeIr<br/>3,27752557<br/>2 Answers<br/>up vote 4 down vote accept<br/><br/>Swift code can be deployed to OS X 10.9 and iOS 7.0. It will usually crash at launch on older OS versions.<br/>answered Jun 3 '14 at 8:25<br/>Greg Parker<br/>6,21011118<br/>up vote 3 down vote<br/><br/>Apple has announced that Swift apps will be backward compatible with iOS 7 and OS X Mavericks. The WWDC app is written in Swift.<br/>answered Jun 3 '14 at 0:03<br/>Ben Gottlieb<br/>73.3k19161166<br/>Get answers to practical, detailed questions<br/><br/>Focus on questions about an actual problem you have faced. Include details about what you have tried and exactly what you are trying to do.<br/><br/>Ask about...<br/><br/>Specific programming problems<br/>Software algorithms<br/>Coding techniques<br/>Software development tools<br/><br/>Not all questions work well in our format. Avoid questions that are primarily opinion-based, or that are likely to generate discussion rather than answers.<br/><br/>Questions that need improvement may be closed until someone fixes them.<br/><br/>Don't ask about...<br/><br/>Questions you haven't tried to find an answer for (show your work!)<br/>Product or service recommendations or comparisons<br/>Requests for lists of things, polls, opinions, discussions, etc.<br/>Anything not directly related to writing computer programs<br/><br/>Tags make it easy to find interesting questions<br/><br/>Stack Overflow is a question and answer site for professional and enthusiast programmers. It's built and run by you as part of the Stack Exchange network of Q&A sites. With your help, we're working together to build a library of detailed answers to every question about programming.<br/><br/>We're a little bit different from other sites. Here's how:<br/>Ask questions, get answers, no distractions<br/><br/>This site is all about getting answers. It's not a discussion forum. There's no chit-chat.<br/><br/>Just questions...<br/>...and answers.<br/>Good answers are voted up and rise to the top.<br/><br/>The best answers show up first so that they are always easy to find.<br/>accept<br/><br/>The person who asked can mark one answer as accepted.<br/><br/>Accepting doesn't mean it's the best answer, it just means that it worked for the person who asked.<br/>Do Swift-based applications work on OS X 10.9/iOS 7 and lower?<br/>up vote 14 down vote favorite<br/><br/>Will Swift-based applications work on OS X 10.9 (Mavericks)/iOS 7 and lower?<br/><br/>For example, I have a machine running OS X 10.8 (Mountain Lion), and I am wondering if an application I write in Swift will run on it.<br/>ios osx swift<br/>asked Jun 2 '14 at 19:25<br/>MeIr<br/>3,27752557<br/>2 Answers<br/>up vote 4 down vote accept<br/><br/>Swift code can be deployed to OS X 10.9 and iOS 7.0. It will usually crash at launch on older OS versions.<br/>answered Jun 3 '14 at 8:25<br/>Greg Parker<br/>6,21011118<br/>up vote 3 down vote<br/><br/>Apple has announced that Swift apps will be backward compatible with iOS 7 and OS X Mavericks. The WWDC app is written in Swift.<br/>answered Jun 3 '14 at 0:03<br/>Ben Gottlieb<br/>73.3k19161166<br/>Get answers to practical, detailed questions<br/><br/>Focus on questions about an actual problem you have faced. Include details about what you have tried and exactly what you are trying to do.<br/><br/>Ask about...<br/><br/>Specific programming problems<br/>Software algorithms<br/>Coding techniques<br/>Software development tools<br/><br/>Not all questions work well in our format. Avoid questions that are primarily opinion-based, or that are likely to generate discussion rather than answers.<br/><br/>Questions that need improvement may be closed until someone fixes them.<br/><br/>Don't ask about...<br/><br/>Questions you haven't tried to find an answer for (show your work!)<br/>Product or service recommendations or comparisons<br/>Requests for lists of things, polls, opinions, discussions, etc.<br/>Anything not directly related to writing computer programs<br/><br/>Tags make it easy to find interesting questions<br/><br/>" ;
$scope.words = prepareTextToCorrect(text) ;
}]);
Try using ng-if instead of ng-show in your <span> tags. In such a way the browser does not need to render all the DOM nodes that you use when the word is edited. With ng-show the nodes are rendered and then hidden from the DOM using CSS. This means that the browser has to render nodes that you potentially do not use, it is highly probable that you only need to change few words and not the entire document! Try to see if this can improve the rendering time.
Whatever the front-end framework, tracking each word of a text is going to put the browser on its knees, no matter if you have V8, Turbo, 4x4 or whatever.
Just picture the number of nodes. Take a deep deep look at your DOM element, just one of your ng-if spans in your case, and imagine each one of its endless list of attributes being tracked. But you probably already know.
With angular 1.x, you can check if a textarea is $dirty on mouseup, and/or blur, and/on mousemove with a simple directive.
Just wire a service that stores any change made to the whole textarea whenever one of the above events triggers.
In short, it's going to be less expensive to store the whole textarea on every event (after all, its content is just a string, nothing too hard for a browser to handle, even if the string is big — but I'm sure you care about your users and your textarea won't end up to be massive).
To store every change made to the textarea, you can use localStorage and/or a remote DB, using possibly angular locker for localStorage abstractions, and Firebase (AngularFire), which is going to handle automagically any changes made to the textarea given you previously wire the textarea content to a Firebase object.
But your back-end could be of course any data API. I would to suggest to store a limited amount of "Ctrl/Cmd+Z" into localStorage, and for the external DB, well, it's up to you to store infinite versions. That's where Firebase would come in handy, because by forcing you to make adhere to a JSON, you can store by month, week, day, therefore accelerating your retrieval queries for when the end user wants to go back in history.
(I am not sure if this question belongs to the meta website or not, but here we go)
I want to add stackoverflow to the bibliography of a research paper I am writing, and wonder if there is any bibTeX code to do so. I already did that for gnuplot
I searched online, but in most cases the citation goes to a specific thread. In this case, I want to acknowledge SO as a whole, and add a proper citation, probably to the website itself. Hopefully somebody already did this in the past?
As an example, below are the codes I use for R and gnuplot:
#Manual{rproject,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2015},
url = {https://www.R-project.org/},
}
#MISC{gnuplot,
author = {Thomas Williams and Colin Kelley and {many others}},
title = {Gnuplot 5.0: an interactive plotting program},
month = {June},
year = {2015},
howpublished = {\href{http://www.gnuplot.info/}{http://www.gnuplot.info/}}
}
I know that both are software, not website resources, but maybe something along those lines would work. Any feedback is appreciated!
Thanks!
I did not realize this question never got answered. The solution I found was to acknowledge the SO website in the LaTeX code with the following:
This research has made use of the online Q\&A platform {\texttt{stackoverflow}}
(\href{http://stackoverflow.com/}{http://stackoverflow.com/}).
Hope it helps somebody in the future!
Actually, for my paper I am using the following citation:
#misc{stackoverflow,
url={https://stackoverflow.com/},
title={Stack overflow},
year={2008}
}
I hope it helps!
I am current tweaking and fine tuning my installer booking assignment optimizer, just recently upgraded my library to Optaplanner 6.2.0 Final. I am using the benchmarker to observe which optimization strategy (EntityTabu, SimulatedAnnealing, with or without TailChainSwapMove) I have a few questions:
1) I made an eventListener attached to my Solver, for displaying any improvements in scoring. Can I attached the eventListener to my benchmark?
2) For ChangeMove and SwapMove selector, can I use a filterClass in conjuction with an entitySelector, so I could utilize nearbyDistanceMeterClass?
<solverBenchmark>
<name>Entity tabu w tailChainSwapMove</name>
<solver>
<localSearch>
<unionMoveSelector>
<changeMoveSelector>
<filterClass>com.tmrnd.pejal.opta.solver.move.InstallerChangeMoveFilter</filterClass>
</changeMoveSelector>
<swapMoveSelector>
<filterClass>com.tmrnd.pejal.opta.solver.move.SamePttSwapMoveFilter</filterClass>
</swapMoveSelector>
<tailChainSwapMoveSelector>
<entitySelector id="entitySelector3"/>
<valueSelector>
<nearbySelection>
<originEntitySelector mimicSelectorRef="entitySelector3"/>
<nearbyDistanceMeterClass>com.tmrnd.pejal.opta.solver.move.BookingNearbyDistanceMeter</nearbyDistanceMeterClass>
<parabolicDistributionSizeMaximum>20</parabolicDistributionSizeMaximum>
</nearbySelection>
</valueSelector>
</tailChainSwapMoveSelector>
</unionMoveSelector>
<acceptor>
<entityTabuRatio>0.05</entityTabuRatio>
</acceptor>
<forager>
<acceptedCountLimit>1000</acceptedCountLimit>
</forager>
</localSearch>
</solver>
1) Do you mean like all the optional statistics that the benchmarker supports, such as the BEST_SCORE statistic (see docs) etc? All those statistics are nicely shown in the benchmark report.
2) Try it out.
does anyone use arima.rob() function described by Eric Zivot and Jiahui Wang in { Modelling Financial Time Series with S-PLUS } ?
I have a question about it:
I used a dataset of network traffic flows that has anomaly, and I tried to predict the last part of dataset by robust ARIMA method (Arima.rob() function) .I compare this model with arima.mle of S-PLUS. But Unexpectedly, arima.rob’s prediction did not better than that.
I’m not sure my codes are correct and may be the reason of fault is my codes.
Please, help me if I used Arima.rob inappropriately?
tmp.rr<-arima.rob((tmh75)~1,p=2,d=1,q=2,freq=24,maxiter=4,max.fcal=80000)
tmp.for<-predict(tmp.rr,n.predict=10,newdata=df1,se=T)
plot(tmp.for,tmh75)
summary(tmp.for)
my code for classic arima:
`model <- list(list(order=c(2,1,2)),list(order=c(3,1,2),period=24))
fith <- arima.mle(tmh75-mean(tmh75),model=model)
foreh <- arima.forecast(tmh75,n=25,model=fith$model)
tsplot(tmh75,foreh$mean,foreh$mean+foreh$std.err,foreh$mean-foreh$std.err)
`
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
Do you know any example for this topic?.
I have searched google but had no luck with any Decision Making using Artificial Intelligence example ( at least any truly developed)
i have an example for decision making in AI. it is about choosing a dress to purchase. It asks for inputs as follows:
1) Whether you are Male or Female
2)Price range must be less than 1000 or greater than 1000
3)Age <20 or >20
Based on these inputs , my code will analyse which type of dress suits you and in which shop you can purchase it. I have just given few knowledge in my code. Only 3 shop's names i have kept in my knowledge base.
It gives output as a percentage .
Eg) Shop A: 20.5%
Shop B: 40.5&
Shop C: 39.0%
This means that you have high probability of finding your favourite dresses in Shop B.
$ import java.util.*;
import java.lang.*;
import javax.swing.*;
import java.util.Collection.*;
import java.util.Set.*;
public class dress1
{
static int i,j;
static float[] count=new float[3];static int[] count1=new int[3];
static String[] shop=new String[] {"Jean and Tops","Jean and T-shirt","Jean and Shirt/T-shirt","Sherwani","Pyjamas","Formal shirt and Pant","Shorts and shirt","Coat Suit","Sari","Skirt and Tops","Ghagra Choli","Salwar kameez","Churidaar","Pattu Pavadai","Frock"};
static int[] divac= {10,9,8,1,1,2,1,1,7,1,1,1,5,1,1};
static int[] kalac= {1,1,1,2,1,1,1,1,10,1,8,2,2,9,1};
static int[] megac= {7,5,6,3,2,8,2,6,2,4,2,1,2,2,2};
static String[] selected=new String[15];
static boolean value;
public static void main(String arg[])
{
count[0]=0;count[1]=0;count[2]=0;
Set uni = new HashSet();
uni.add("Jean and Tops");
uni.add("Jean and T-shirt");
uni.add("Sari");
uni.add("Skirt and Tops");
uni.add("Ghagra Choli");
uni.add("Salwar kameez");
uni.add("Churidaar");
uni.add("Pattu Pavadai");
uni.add("Sherwani");
uni.add("Frock");
uni.add("Formal shirt and Pant");
uni.add("Jean and Shirt/T-shirt");
uni.add("Shorts and shirt");
uni.add("Coat Suit");
uni.add("Pyjamas");
Set male = new HashSet();
male.add("Sherwani");
male.add("Pyjamas");
male.add("Formal shirt and Pant");
male.add("Jean and Shirt/T-shirt");
male.add("Shorts and shirt");
male.add("Coat Suit");
Set fem = new HashSet();
fem.add("Jean and Tops");
fem.add("Jean and T-shirt");
fem.add("Sari");
fem.add("Skirt and Tops");
fem.add("Ghagra Choli");
fem.add("Salwar kameez");
fem.add("Churidaar");
fem.add("Pattu Pavadai");
fem.add("Frock");
Set l20=new HashSet();
l20.add("Jean and Tops");
l20.add("Jean and T-shirt");
l20.add("Skirt and Tops");
l20.add("Churidaar");
l20.add("Pattu Pavadai");
l20.add("Frock");
Set g20=new HashSet();
g20.add("Jean and T-shirt");
g20.add("Sari");
g20.add("Salwar kameez");
g20.add("Churidaar");
Set ml20=new HashSet();
ml20.add("Pyjamas");
ml20.add("Shorts and shirt");
Set mg20=new HashSet();
mg20.add("Sherwani");
mg20.add("Formal shirt and Pant");
mg20.add("Coat Suit");
mg20.add("Jean and Shirt/T-shirt");
Set mpl1000= new HashSet();
mpl1000.add("Pyjamas");
mpl1000.add("Shorts and shirt");
mpl1000.add("Formal shirt and Pant");
Set mpg1000=new HashSet();
mpg1000.add("Sherwani");
mpg1000.add("Coat Suit");
mpg1000.add("Jean and Shirt/T-shirt");
Set pl1000=new HashSet();
pl1000.add("Frock");
pl1000.add("Skirt and Tops");
pl1000.add("Churidaar");
pl1000.add("Salwar kameez");
Set pg1000=new HashSet();
pg1000.add("Jean and Tops");
pg1000.add("Jean and T-shirt");
pg1000.add("Sari");
pg1000.add("Ghagra Choli");
pg1000.add("Pattu Pavadai");
Scanner input=new Scanner(System.in);
System.out.println("Enter M for Male and F for Female");
String st=input.nextLine();
Set int1 = new HashSet (uni);
if(st.equals("M"))
{
System.out.println("Male");
int1.retainAll(male);
Scanner input1=new Scanner(System.in);
System.out.println("Enter 1 if age <20 or enter 2 if age > 20");
String st1=input1.nextLine();
Set int2= new HashSet (int1);
if(st1.equals("1"))
{
System.out.println("Age Less than 20 Male");
int2.retainAll(ml20);
}
else if(st1.equals("2"))
{
System.out.println("Age Greater than 20 Male");
int2.retainAll(mg20);
}
Scanner input2=new Scanner(System.in);
System.out.println("Enter 1.Price Range < 1000 or 2. Price Range >1000");
String st2=input2.nextLine();
Set int3= new HashSet (int2);
if(st2.equals("1"))
{
System.out.println("Price Less than 1000 ,Male");
int3.retainAll(mpl1000);
}
else if(st2.equals("2"))
{
System.out.println("Price Greater than 1000 ,Male");
int3.retainAll(mpg1000);
}
i=0;
for(Object object : int3)
{
String element = (String) object;
selected[i++]=element;
System.out.println(element);
}
calc();
} /*end of male*/
else if(st.equals("F"))
{
System.out.println("Female");
int1.retainAll(fem);
Scanner input1=new Scanner(System.in);
System.out.println("Enter 1 if age <20 or enter 2 if age > 20");
String st1=input1.nextLine();
Set int2= new HashSet (int1);
if(st1.equals("1"))
{
System.out.println("Age Less than 20 Female");
int2.retainAll(l20);
}
else if(st1.equals("2"))
{
System.out.println("Age Greater than 20 Female");
int2.retainAll(g20);
}
Scanner input2=new Scanner(System.in);
System.out.println("Enter 1.Price Range < 1000 or 2. Price Range >1000");
String st2=input2.nextLine();
Set int3= new HashSet (int2);
if(st2.equals("1"))
{
System.out.println("Price Less than 1000 ,Female");
int3.retainAll(pl1000);
}
else if(st2.equals("2"))
{
System.out.println("Price Greater than 1000 ,Female");
int3.retainAll(pg1000);
}
i=0;
for(Object object : int3)
{
String element = (String) object;
selected[i++]=element;
System.out.println(element);
}
calc();
}/*end of female*/
}/*end of main*/
public static void calc()
{
float finalcount=0;
int k=0;
while(k<i)
{
for(j=0;j<15;j++)
{
value=selected[k].equals(shop[j]);
if(value)
{
break;
}
}/*end of j*/
count[0]=count[0]+divac[j];
count[1]=count[1]+kalac[j];
count[2]=count[2]+megac[j];
k++;
}/*end of while*/
for(int c=0;c<3;c++)
{
finalcount=finalcount+count[c];
}
for(int c=0;c<3;c++)
{
count[c]=((count[c]*100)/finalcount);
}
System.out.println("Availability of dresses available in various shops are:");
System.out.println("Diva is "+count[0]+"%");
System.out.println("Kalanikethan is "+count[1]+"%");
System.out.println("Megamart is "+count[2]+"%");
}
}/*end of class*/
http://msl.cs.uiuc.edu/~lavalle/cs397/
Read this. There are different ways to go about AI decision making. The examples are on the bottom.
Decision-making (DM) is a topic widely studied by different fields of science. (Cognitive sciences, Neurosciences, Computer sciences, Behavioral Economics, Operations research, etc. *1)
However, DM problems are varied and the computational approach to address that problem will vary accordingly. For instance:
If you have to make a frequent decision that affects the previous one you are dealing with a sequential DM problem. In those cases, reinforcement learning *2 or deep reinforcement learning *3 can be used to tackle this problem. Examples of these problems can be seen in video-games where the game AI needs to take different actions (policies) over time to maximise its score. (reward)
If you the problem is not sequential but you deal with multiple criteria to find the most attractive alternative then you are dealing with a multi-criteria decision-making problem, topic widely researched in operations research. There are some typically-used algorithms that are utilised to assist human-decision making like AHP*4, TOPSIS*5, ELECTRE*6, PROMETREE*7. An example of MCDC is selecting a house to buy, where you have to consider location, price among other desirable or undesirable characteristics.
Depending on the level of uncertainty, subjective data and incomplete information of the problem you might require to use fuzzy, intuitionistic or neutrosophic variations of the mentioned algorithms. *8
You might need to optimise DM through different competing goals. In that case, you are dealing with a multi-objective decision-making optimisation problem (MODM). See Decision trees*9, genetic algorithms*10 .
Furthermore, a DM problem can have different 'agents' making decision that can affect ours. So that is known as 'multi-agent' decision-making. In computer science, multi-agent system simulations are commonly used to research these problems. *11
You can also have the case where the agents have to make a collaborative decision that affects all of them. So that is known as 'group' decision-making.
In the industry, computational DM can be seen with the widely used recommender systems such as the ones in Netflix or Amazon.*13 In the B2B sector, AI in DM can be seen in decision-support systems and prescriptive analytics services *14.
I hope you find that information useful. There is indeed, much more about this complex topic, I just tried to summarise.
Some resources you might want to check:
Deep RTS: A playground for reinforcement learning agents in real-time strategy game environments. (Repository: https://github.com/cair/deep-rts) (Pre-print Paper: https://arxiv.org/abs/1808.05032)
OpenAI Gym: A general-purpose playground to test reinforcement learning AI algorithms. (Github: https://github.com/openai/gym, page: https://gym.openai.com/)
DecisionRadar: An online application to apply TOPSIS decision-making algorithm. (Site: https://decision-radar.com/)
AgentSimJS: A 3D multi-agent simulation system built in Javascript. (Repository: https://github.com/maxdeben83/agentsimjs)
REFERENCES:
*1 Atkinson, J. W. (1964). An introduction to motivation.
*1 Berridge, K. C. (2004). Motivation concepts in behavioral neuroscience. Physiology & behavior, 81(2), 179-209.
*1 Hwang, C. L., & Yoon, K. (1981). Methods for multiple attribute decision making. In Multiple attribute decision making (pp. 58-191).Springer, Berlin, Heidelberg.
*1 Tversky, A., & Kahneman, D.(1981). The framing of decisions and the psychology of choice science, 211(4481), 453-458.
*2 Littman, M. L. (1994). Markov games as a framework for multi-agent reinforcement learning. In Machine Learning Proceedings 1994 (pp. 157-163).
*3 Van Hasselt, H., Guez, A., & Silver, D. (2016, February). Deep Reinforcement Learning with Double Q-Learning. In AAAI (Vol. 2, p. 5).
*4 Aczél, J., & Saaty, T. L. (1983). Procedures for synthesizing ratio judgements. Journal of Mathematical Psychology, 27(1),
93–102. doi:10.1016/0022-2496(83)90028-7
*4 Saaty, R. W. (1987). The analytic hierarchy process—what it is and how it is used. Mathematical Modelling, 9(3-5), 167.
doi:10.1016/0270-0255(87)90473-8
*4 Saaty, T. L. (1986). Axiomatic Foundation of the Analytic Hierarchy Process. Management Science, 32(7), 841.
doi:10.1287/mnsc.32.7.841
*4 Hwang, C. L., & Yoon, K. (1981). Methods for multiple attribute decision making. In Multiple attribute decision
making (pp. 58-191). Springer, Berlin, Heidelberg.
*6 Zhou, Y. (1915). Multi-Criteria Decision Making in Software Development: A Systematic Literature Review.
*7 Zhou, Y. (1915). Multi-Criteria Decision Making in Software Development: A Systematic Literature Review.
*8 Pramanik, S., Biswas, P., & Giri, B. C. (2015). Hybrid vector similarity measures and their
applications to multi-attribute decision making under neutrosophic
environment. Neural Computing and Applications, 28(5), 1163
doi:10.1007/s00521-015-2125-3
*8 Mardani, A., Nilashi, M., Zavadskas, E. K., Awang, S. R., Zare, H., & Jamal, N. M. (2018). Decision Making Methods Based on Fuzzy
Aggregation Operators: Three Decades Review from 1986 to 2017.
International Journal of Information Technology & Decision Making,
17(02), 391–466. doi:10.1142/s021962201830001x
*9 Zhao, H. (2007). A multi-objective genetic programming approach to developing Pareto optimal decision trees. Decision Support
Systems, 43(3), 809-826.
*9 Laumanns, M., & Ocenasek, J. (2002, September). Bayesian optimization algorithms for multi-objective optimization. In
International Conference on Parallel Problem Solving from Nature (pp.
298-307). Springer, Berlin, Heidelberg.
*9 Jin, Y. (Ed.). (2006). Multi-objective machine learning (Vol. 16). Springer Science & Business Media.
10 Tamaki, H., Kita, H., & Kobayashi, S. (1996, May).
Multi-objective optimization by genetic algorithms: A review.
In Evolutionary Computation, 1996., Proceedings of IEEE
International Conference on (pp. 517-522). IEEE.
*11 Rodriguez, S., Gaud, N., & Galland, S. (2014, August). SARL: a general-purpose agent-oriented programming language. In
Web Intelligence (WI) and Intelligent Agent Technologies (IAT),
2014 IEEE/WIC/ACM International Joint Conferences on (Vol. 3,
pp. 103-110). IEEE.
*12 Rao, A. S. (1996, January). AgentSpeak (L): BDI agents speak out in a logical computable language. In European Workshop on Modelling Autonomous Agents in a Multi-Agent World (pp. 42-55). Springer, Berlin, Heidelberg.
*13 Ricci, F., Rokach, L., & Shapira, B. (2015). Recommender systems: introduction and challenges. In Recommender systems
handbook (pp. 1-34). Springer, Boston, MA.
*14 https://www.ibm.com/analytics/prescriptive-analytics
There are simply too many examples to count! The whole (large) field of expert systems development, for example, consists of building programs whose explicit purpose is to emulate human decision making. Google "expert systems" to find thousands of examples.
I'll put in a plug for Jess, an expert system shell written in Java which I developed. It's used by thousands of companies world wide to automate decision-making processes.
I did a bit of browsing on the web and I came across this example project.
You might also check out the AI-Depot website here.
Probably the reason there are not so many working examples is because AI decision algorithms, such as neural networks, genetic algorithms, and decision trees get very complex, very quickly. Most developers of such algorithms, at least the algorithms that are stable and actually work, are very protective of their IP. And, for good reason.
In any case, hope this helped.
Let It Be Known