-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpartalloc.h
79 lines (49 loc) · 2.43 KB
/
partalloc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef PARTALLOC_H
#define PARTALLOC_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "schchprob.h"
#include "sprsmtrx.h"
struct partial_alloc {
int no_students;
int no_schools;
struct dbl_sparse_matrix sparse;
};
struct pure_alloc {
int no_students;
int no_schools;
struct int_sparse_matrix sparse;
};
double get_entry(struct partial_alloc* alloc, int i, int j);
void set_entry(struct partial_alloc* alloc, int i, int j, double val);
void increment_entry(struct partial_alloc* alloc, int i, int j, double incr);
int partial_allocs_are_same(struct partial_alloc* first, struct partial_alloc* second);
int students_are_fully_allocated(struct partial_alloc* my_alloc);
int is_a_feasible_allocation(struct partial_alloc* my_alloc, struct process_scp* my_scp);
int partial_alloc_is_consistent(struct partial_alloc* my_alloc);
struct partial_alloc zero_alloc_for_process_scp(struct process_scp* my_scp);
struct partial_alloc zero_alloc_for_input_scp(struct input_sch_ch_prob* my_scp);
double* school_sums(struct partial_alloc* my_alloc);
struct partial_alloc left_sub_process_feasible_guide(struct partial_alloc* feasible_guide,
struct subset* J_subset, struct subset* P_subset);
struct partial_alloc right_sub_process_feasible_guide(struct partial_alloc* feasible_guide,
struct subset* J_subset, struct subset* P_subset);
void increment_partial_alloc(struct partial_alloc* base, struct partial_alloc* increment,
struct index* stu_index,struct index* sch_index);
struct partial_alloc copy_of_partial_alloc(struct partial_alloc* given);
/* At the end we need to pass from a partial_alloc whose values (which
are doubles) are all close to 0 and 1, to the corresponding pure
allocation, whose values are in {0,1}. */
struct pure_alloc pure_allocation_from_partial(struct partial_alloc* my_alloc);
int get_pure_entry(struct pure_alloc* alloc, int i, int j);
void set_pure_entry(struct pure_alloc* alloc, int i, int j, int val);
int pure_alloc_is_valid(struct pure_alloc* my_pure_alloc);
void increment_pure_entry(struct pure_alloc* alloc, int i, int j, int incr);
void print_sparse_partial_alloc(struct partial_alloc* my_alloc);
void print_partial_alloc(struct partial_alloc* my_alloc);
void print_pure_alloc(struct pure_alloc* my_pure_alloc);
void destroy_partial_alloc(struct partial_alloc my_alloc);
void destroy_pure_alloc(struct pure_alloc my_pure_alloc);
#endif /* PARTALLOC_H */