source: branches/profile/PARSIMONY/GA_window.cxx

Last change on this file was 8300, checked in by westram, 12 years ago
  • cppchecked (1.52)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1#include <cstdio>
2#include <iostream.h>
3#include <memory.h>
4#include <cstring>
5#include <arbdb.h>
6#include <arbdbt.h>
7#include <cmath>
8#include <servercntrl.h>
9#include <cstdlib>
10#include <aw_device.hxx>
11#include <aw_window.hxx>
12#include <aw_display.hxx>
13#include "AP_buffer.hxx"
14#include "ap_main.hxx"
15#include "ap_tree_nlen.hxx"
16#include "GA_genetic.hxx"
17#include <phwin.hxx>
18#include <ntcanvas.hxx>
19
20void start_genetic(GBDATA *);
21void quit_genetic();
22AP_ERR * make_start_population(GBDATA *gbmain, AP_tree *tree);
23extern FILE *GAout;
24extern GA_genetic *GAgenetic;
25
26void start_genetic_cb(AW_window *, AW_CL) {
27    start_genetic(ap_main->gb_main);
28}
29
30void savetree_genetic_cb(AW_window */*aww*/, AW_CL /*cld1*/) {
31    // AW_root *aw_root = aww->get_root();
32
33}
34
35void test_genetic_cb(AW_window */*aww*/, AW_CL /*cld1*/) {
36    // AW_root *aw_root = aww->get_root();
37}
38
39void save_genetic_cb(AW_window *aww, AW_CL /*cld1*/) {
40    AW_root *aw_root = aww->get_root();
41    int cluster = (int)aw_root->awar("genetic/presets/curCluster")->read_int();
42    GAgenetic->put_start_tree(ap_main->tree_root, 0, cluster);
43    return;
44}
45
46void quit_genetic_cb(AW_window */*aww*/, AW_CL /*cld1*/) {
47    quit_genetic();
48    // AW_root *aw_root = aww->get_root();
49}
50
51void create_genetic_variables(AW_root *aw_root, AW_default def)
52{
53
54    aw_root->awar_int("genetic/presets/max_jobs", 50, def);
55    aw_root->awar_int("genetic/presets/max_cluster", 4, def);
56    aw_root->awar_int("genetic/presets/jobOpt", 2, def);
57    aw_root->awar_int("genetic/presets/jobCross", 2, def);
58    aw_root->awar_int("genetic/presets/jobOther", 2, def);
59    aw_root->awar_int("genetic/presets/curCluster", 0, def);
60    aw_root->awar_float("genetic/presets/bestTree", 0, def);
61    aw_root->awar_int("genetic/presets/jobCount", 0, def);
62    aw_root->awar_int("genetic/presets/maxTree", 100, def);
63}
64
65AW_window *create_genetic_window(AW_root *aw_root, AW_display *awd)
66{
67
68    AW_window_simple *aws = new AW_window_simple;
69    aws->init(aw_root, "GENETIC_MAIN", "Kernighan", 10, 10);
70    aws->load_xfig("ph_gen.fig");
71    aws->button_length(10);
72
73    aws->at("close");
74    aws->callback((AW_CB0)AW_POPDOWN);
75    aws->create_button("CLOSE", "CLOSE", "C");
76
77
78    aws->at("start");
79    aws->callback((AW_CB1)start_genetic_cb, (AW_CL)awd);
80    aws->create_button("START", "START", "S");
81
82    aws->at("save");
83    aws->callback((AW_CB1)save_genetic_cb, (AW_CL)aw_root);
84    aws->create_button("SAVE", "SAVE", "S");
85
86    aws->at("quit");
87    aws->callback((AW_CB1)quit_genetic_cb, (AW_CL)aw_root);
88    aws->create_button("QUIT", "QUIT", "Q");
89
90    aws->at("savetree");
91    aws->callback((AW_CB1)savetree_genetic_cb, (AW_CL)aw_root);
92    aws->create_button("SAVETREE", "SaveTree", "Q");
93
94    aws->at("jobs");
95    aws->create_input_field("genetic/presets/max_jobs", 8);
96    aws->at("cluster");
97    aws->create_input_field("genetic/presets/max_cluster", 8);
98    aws->at("jobOpt");
99    aws->create_input_field("genetic/presets/jobOpt", 8);
100    aws->at("jobCross");
101    aws->create_input_field("genetic/presets/jobCross", 8);
102    aws->at("jobOther");
103    aws->create_input_field("genetic/presets/jobOther", 8);
104    aws->at("curCluster");
105    aws->create_input_field("genetic/presets/curCluster", 8);
106    aws->at("maxTree");
107    aws->create_input_field("genetic/presets/maxTree", 8);
108
109    aws->at("jobCount");
110    aws->create_label("genetic/presets/jobCount", 8);
111
112    return (AW_window *)aws;
113
114}
Note: See TracBrowser for help on using the repository browser.