Example Code

Global Optimization Game Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview

This game is simple. Match the given graph. You can take the detail in File - VI properties - Documentation.

 

Description

You are given the ability to adjust the frequency and amplitude of two sin waves. The two waves are added together and displayed to the screen. If you can not solve it just hit the help button and the Global Optimization VI will solve it for you and show you the correct amplitude and frequency needed for the graph. The Global Optimization VI uses a genetic algorithm. To learn more about genetic algorithms check out Wikipedia. For this example, the algorithm is given an objective function that calculates the average difference between a guess and the graph to match. This optimization VI can be used to solve many problems where there are set objectives and constraints given a finite number of inputs. I hope this example is fun and interesting.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Run the VI.
  2. Configure frequencies or amplitudes.
  3. Find the graph to match.

 

Additional Information or References VI Block Diagram

VI Block Diagram

 match.png

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

 

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.