Forum Replies Created

Viewing 10 posts - 301 through 310 (of 462 total)
  • Author
    Posts
  • in reply to: Tutorial for jfuzzylite #1650

    Hi,

    please check the examples bundled in fuzzylite. There are over 30 examples available. You can also check http://www.fuzzylite.com/java . In addition, you can read the documents in http://www.fuzzylite.com/downloads and watch the videos in http://www.fuzzylite.com .

    Cheers,

    in reply to: Create engine in Netbeans Java #1649

    Hi Roxanne,

    the problem you might be having is in the constructor. Please, make sure the constructor starts as follows.

    
    public Roxanne(){
    this.engine = new Engine();
    engine.setName(“Traffic Light Controller”);
    

    Cheers.

    in reply to: Create engine in Netbeans Java #1647

    Hi Roxanne,

    thank you for your email.

    First, you will need to create a new Java Application project in NetBeans. In the project, you need to add the jfuzzylite.jar file that you can download from http://www.fuzzylite.com/downloads. Once you have done this, the next step is to create your class that will utilize the Fuzzy Engine you have exported from QtFuzzyLite. There are different ways you can achieve this, but an example of your class would be as follows:

    
    public class Roxanne{
        
        private Engine engine;
    
        public MyFuzzyClass(){
            //setup the engine, 
            engine = new Engine();
            engine.setName(“Traffic Light Controller”);
           //and the rest of parameters...
        }
    
       public Engine getEngine(){
          return this.engine;
       }
    
       public static void main(String[] args){
           Roxanne instance = new Roxanne();
           Engine engine = instance.getEngine();
           engine.getInputVariable("TQ").setInputValue(10.0); 
           engine.getInputVariable("WT").setInputValue(2.0);
           engine.process();
           double output = engine.getOutputVariable("PD").defuzzify();
           System.out.println("PD=" + output);
       }
    }
    

    I think this should give you a starting point to run a basic example. The next step is to loop setting different input values and processing the engine (revise example in http://fuzzylite.com/java). Another good advice is to study object oriented programming, which will help you design the classes to satisfy your needs.

    Let me know if this information helps you, or if you need something else.

    Cheers,

    Juan.

    in reply to: Fuzzylite 4.0 Patches #1644

    Hi Fishwaldo,

    thank you for your post and patches to FuzzyLite. Please, excuse my late reply. I will revise the patches as soon as I have a chance.

    Cheers,

    Juan.

    in reply to: jfuzzylite with two input values #1643

    Hi,

    you should use QtFuzzyLite to help you with this kind of issues.

    The term Limit and Perfect are not triangles but Ramps. Check in QtFuzzyLite the difference between Triangle and Ramp. Basically, Ramp yields a membership of 1.0 after the limits it is defined, whereas a Triangle does not.

    InputVariable: Availability
      enabled: true
      range: 85.000 100.000
      term: Limit Ramp 95.000 90.000
      term: Very_Low Triangle 90.000 95.000 98.000
      term: Low Triangle 95.000 98.000 99.000
      term: Average Triangle 98.000 99.000 99.900
      term: High Triangle 99.000 99.900 100.000
      term: Perfect Ramp 99.900 100.000
    
    in reply to: Problem with importing and getting results #1642

    Hi Mohammad,

    you should use QtFuzzyLite to help you with such kind of issues.

    The problems you have are:
    (1) the first rule starts with is instead of if
    (2) the fuzzy operators (AND, OR) are case sensitive, and in fuzzylite you utilize “and” and “or” instead of their upper-case operators.

    Cheers,

    Juan

    in reply to: [C++] Is there a coding style? #1640

    Hi Marco,

    I follow Java conventions in C++ with a few exceptions. Within a class, I utilise mostly protected members whose names start with _ (e.g. Term* _myTerm). A header file (e.g. MyTerm.h) that contains no implementation and it is located at fuzzylite/fl, and the source file (e.g. MyTerm.cpp) located at fuzzylite/src.

    I think if you revise the source code you might have an idea about the coding style.

    Cheers,

    Juan

    in reply to: fuzzylie error – use of undefined type 'T' #1634

    Hi,

    I think there is a problem in the type of the Visual Studio project that you have created. I am not a regular user of VS, but perhaps make sure you have selected a Console Project.

    Have you successfully built fuzzylite from the console? If so, then you need to add the INCLUDE_PATH, LIBRARY_PATH and library to your project, that is, “-I/path/to/fuzzylite”, “-L/path/to/fuzzylite/bin”, “-lfuzzylite”, respectively. These are in Unix mode, and you would need to find out how to correctly add them in your project properties.

    in reply to: need for helping #1602

    Hi,

    thanks for your responses. As vurtue mentions, use the UI component instead of the logger.

    In addition, you should have the engine as a member of your class such that you can retrieve the engine later in a different method. For example,

    public class MyActivity extends Activity {
    
    private Engine engine;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    MyFuzzy myFuzzy=new MyFuzzy();
    try {
    engine = new Engine(“simple-dimmer”);
    InputVariable ambient = new InputVariable();
    ambient.setName(“Ambient”);
    ...
    }
    
    public void someOtherMethodCalledByAnEvent(){ //A button click?
       engine.getInputVariable("Ambient").setInputValue(someUiComponent.getDoubleValue());
       engine.process();
       double output = engine.getOutputVariable("Power").defuzzify();
       anotherUiComponent.setText(Op.str(output));
    }
    

    I hope this helps.

    Cheers.

    in reply to: Importing fll,fcl,fis #1596

    Hi,

    Thank you for your kind words.

    There is no API documentation as of now, unfortunately. Once I get time, I will write some, but for now, you can read the code and should not be too hard to follow.

    It is definitely possible to import a fuzzy engine and use it. In fuzzylite 5.0, you can do:

    Engine* engine = FllImporter().fromFile("path/to/file.fll");

    In addition, you can export the data to a file using the FldExporter, specifically, one of the following two methods:

     virtual void toFile(const std::string& path, Engine* engine, int maximumNumberOfResults) const;
     virtual void toFile(const std::string& path, Engine* engine, const std::string& inputData) const;
    

    The first divides the values of the input variables such that the total number of combinations is at most maximumNumberOfResults.

    The second takes the input values separated by spaces (or tabs) and each is the input value for the input variables in your engine. You can use it as:

    FldExporter exporter;
    exporter.toFile("path/to/yourFile.fld", engine, contentsOfFile);
    

    where contentsOfFile is the data read from a file, the engine refers to the engine previously imported using FldImporter and “path/to/yourFile.fld” is the file where the output values will be written.

    You can also configure the FldExporter, please check the source code of FldExporter.h and FldExporter.cpp. Both should be self-explanatory.

Viewing 10 posts - 301 through 310 (of 462 total)