-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem.cpp
More file actions
54 lines (41 loc) · 1.1 KB
/
Copy pathproblem.cpp
File metadata and controls
54 lines (41 loc) · 1.1 KB
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
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "problem.h"
problem_t *create_problem(int num_S, int num_W)
{
problem_t *problem = new problem_t;
problem->num_S = num_S;
problem->num_W = num_W;
problem->fixedcost = new double[num_W];
problem->capacity = new int[num_W];
problem->goods = new int[num_S];
problem->inc_s = new int[num_S];
problem->supplycost = new double*[num_S];
problem->inc = new int*[num_S];
problem->best_warehouse_S = new int*[num_S];
for (int i = 0; i < num_S; i++)
{
problem->best_warehouse_S[i] = new int[5];
problem->best_warehouse_S[i][0] = -1;
problem->best_warehouse_S[i][1] = -1;
problem->best_warehouse_S[i][2] = -1;
problem->best_warehouse_S[i][3] = -1;
problem->best_warehouse_S[i][4] = -1;
problem->inc[i] = new int[num_S];
problem->supplycost[i] = new double[num_W];
}
vector<int> temp;
for (int i = 0; i < num_W; i++)
{
problem->best_store_W.push_back(temp);
}
return problem;
}
void free_problem(problem_t *problem)
{
if (problem != NULL) {
delete[] problem;
}
}
//