source: tags/initial/PARSIMONY/GA_window.cxx

Last change on this file was 2, checked in by oldcode, 24 years ago

Initial revision

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