Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
uvahotspot
GitHub Repository: uvahotspot/HotSpot
Path: blob/master/npe.h
612 views
1
#ifndef __NPE_H_
2
#define __NPE_H_
3
4
#include "flp.h"
5
6
/* normalized polish expression */
7
typedef struct NPE_t_st
8
{
9
int *elements;
10
int size;
11
12
/* positions of the units */
13
int *unit_pos;
14
int n_units;
15
16
/*
17
* flipping positions - where
18
* a unit is immediately adjacent
19
* to a cut_type and vice-versa
20
*/
21
int *flip_pos;
22
int n_flips;
23
24
/* positions of the chains */
25
int *chain_pos;
26
int n_chains;
27
28
/* no. of units till this position */
29
int *ballot_count;
30
}NPE_t;
31
32
/* NPE routines */
33
34
/* the starting solution for simulated annealing */
35
NPE_t *NPE_get_initial(flp_desc_t *flp_desc);
36
/* uninitialization */
37
void free_NPE(NPE_t *expr);
38
/* debug print */
39
void print_NPE(NPE_t *expr, flp_desc_t *flp_desc);
40
/*
41
* move M1 of the floorplan paper
42
* swap two units adjacent in the NPE
43
*/
44
void NPE_swap_units(NPE_t *expr, int pos);
45
/* move M2 - invert a chain of cut_types in the NPE */
46
void NPE_invert_chain(NPE_t *expr, int pos);
47
/* move M3 - swap adjacent cut_type and unit in the NPE */
48
int NPE_swap_cut_unit(NPE_t *expr, int pos);
49
/* make a random move out of the above */
50
NPE_t *make_random_move(NPE_t *expr);
51
/* make a copy of this NPE */
52
NPE_t *NPE_duplicate(NPE_t *expr);
53
54
#endif
55
56