<html>
  <head>
    <title>Isight - External Executable Approximation Example</title>
    <link rel="stylesheet" href="../../../EStyle.css" type="text/css">
    <link rel="stylesheet" href="../../../ETables.css" type="text/css">
  </head>
<body>
<a href="http://www.simulia.com/products/sim_opt.html"><img src="../../../../examples/logo.gif"></a>
<h1>External Executable Approximation Plug-in</h1>
<table>
    <tr><td>Description:</td>
        <td>This example demonstrates how to integrate into Isight an approximation plug-in 
            implemented as an external executable program. Such implementation of a plug-in does not require 
            that you have any Java knowledge as there is no custom Java code required. Only
            an external executable program must be created, such that it is capable of
            communicating with Isight by reading and writing special files as described
            in the Isight Development Guide. <br><br>
            In this particular example, a fake approximation algorithm called "Averaging Approximation" 
            is used. This approximation simply returns average value of all input values as the predicted
            output value.
        </td>
    </tr>
    <tr><td>Support files:</td>
        <td>
            <ul>
                <li><a href="AveragingApproximation.c">AveragingApproximation.c</a> -
                    C source code for the Averaging Approximation algorithm which is capable of
                    communicating with Isight by reading and writing all required files. 
                </li>
            </ul>
        </td>
    </tr>
    <tr><td>Instructions:</td>
        <td>
        <ol>
    <li>You must have a C-compiler installed on your machine. Compile the provided C-source file 
        (<a href = "AveragingApproximation.c">AveragingApproximation.c</a>) to create an executable program called 
        "AveragingApproximation.exe". <br>
        On Windows the compilation command may look like this: "<i><b>cl -o AveragingApproximation.exe AveragingApproximation.c</b></i>" <br>
        On Unix the compilation command may look like this: "<i><b>cc -o AveragingApproximation.exe AveragingApproximation.c</b></i>"
        <br><br>

    <li>Open Isight SDK Generator. Select "New - Plug-in" command from the "File" menu. Select
        "Approximation Technique" on the small dialog window and click OK to create a new approximation plug-in.
        <br><br>
        <img src="SDK-Generator-Approx-New-Plugin.png">
        <br><br>

    <li>Click "Name" to open the "Name" page. Enter plug-in name, display name, version, 
        description as shown on the picture below.
        <br><br>
        <img src="SDK-Generator-Approx-Name.png">
        <br><br>

    <li>Click "Technique Options" to open the "Technique Options" page. 
        Create technique options as shown on the picture below. The provided C-source file is
        expecting to find these technique options at run-time, but it will not actually use
        the options for initialization or evaluation.
        <br><br>
        <img src="SDK-Generator-Approx-Tech-Options.png">
        <br><br>

   <li>Click "Java Wrapper" to open the "Java Wrapper" page. Click the top radio button
        "Call external executable directly without a Java wrapper". Click "Add Program to JAR..." button to invoke
        a dialog for adding your executable program to the JAR file of your new plug-in.
        <br><br>
        <img src="SDK-Generator-Approx-Java-Wrapper.png">
        <br><br>

    <li>On the small pop-up dialog, click "Browse" button and find
        the executable file that you created in step 1. 
        Change the "OS Platform" selection to reflect the OS platform that you compiled the executable on. 
        Click "Add to JAR file" button at the bottom of the small
        dialog. If you plan to use your approximation plug-in on multiple platforms, repeat this step. You
        must have compiled your executable program on all desired OS platforms prior to this step.
        <br><br>
        <img src="SDK-Generator-Approx-Publish-Exe.png">
        <br><br>

    <li>Select "Publish" command from the "File" menu or click "Publish" button on the toolbar to invoke a
        publishing dialog for your new approximation plug-in. Verify that all
        information is correct. Click "Publish" button at the bottom of the dialog. This will create a JAR
        file and publish it to the Isight library.
        <br><br>
        <img src="SDK-Generator-Approx-Publish-JAR.png">
        <br><br>

    <li>You may now build models using the new approximation plug-in. On the Approximation Wizard,
        select the new approximation technique that you created and published to Isight library. 
        <br><br>
        <img src="Approx-Wizard-1.png">
        <br><br>
    
    <li>Configure technique options on the "Averaging Approximation technique Options" page. As mentioned
        earlier, these option values are for demonstration purposes only and will not be used by the approximation
        algorithm. Finish creating the approximation, initialize it or execute the model.
        <br><br>
        <img src="Approx-Wizard-2.png">
        </ol>
        </td>
    </tr>
</table>
</body>
</html>
