310 Lab OTL Problems----Convert a well-written C + + file into a Python file and visualize the data

Source: Internet
Author: User

Folder

First: Add the header file of the code you wrote in the Optimizer folder: Optimizer.h file #include <otl/optimizer/reference-nsga-ii/reference-nsga-ii.h >

Second place: Add code to the Switch.h file, and format it to mimic the contents of the file #define Export_reference_nsga_ii

The third place: Because our general code is encoded in real form, so modify the contents of the file Optimizer.h file under Optimizer.real, the format mimics the contents of the file typedef otl::optimizer::reference_nsga_ Ii::reference_nsga_ii<treal, Tdecision, Trandom &> Treference_nsga_ii;, and then add write implementation The function just in the Optimizer.h file is in the Optimizer.cpp, note here, if it is to get a quote worthy of the words, need this. def ("Getcrossover", &treference_nsga_ii:: Getcrossover, Boost::p ython::return_value_policy<boost::p ython::reference_existing_object> ()), if only a worthy word is obtained, You do not need boost::p ython::return_value_policy<boost::p ython::reference_existing_object> ()

This completes the setup of Pyotl (as a bridge between C + + and Python).

To modify the contents of the Pyoptimization:

First: Locate the optimizer folder under __init__.py, and then modify the format to mimic the pattern in its file. One is the _MAKE_XXX function and one is the MAKE_XXX function.

Second, if you need to run the code, select the outermost optimization.py, if the code is correct, C + + and Python bridge succeeds, the resulting data will be saved in the path of database under the documents file, and the path of the databases is modified by itself. If you need to modify a running parameter, modify it in the Optimization.ini file and modify the configuration in Evalution.ini if it is a review. If you need to see it, you can click Visualize.py to run it and you can see it.

Finally, if you need to evaluate, after running evalution.py, the database file (the system by default is under the documents file) in the use of the Sqliteman tool to view

310 Lab OTL Problems----Convert a well-written C + + file into a Python file and visualize the data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.