-
Notifications
You must be signed in to change notification settings - Fork 0
/
clp-wasm.d.ts
77 lines (65 loc) · 2.34 KB
/
clp-wasm.d.ts
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
interface Result {
objectiveValue: string;
variables: string[];
solution: string[];
unboundedRay: string[];
infeasibilityRay: string[];
integerSolution: boolean;
}
type NumericType = number | string;
interface LP {
name: string;
objective: {
direction: number,
name: string,
vars: { name: string, coef: NumericType }[]
},
subjectTo: {
name: string,
vars: { name: string, coef: number }[],
bnds: { ub?: NumericType, lb?: NumericType, type?: number }
}[],
bounds?: {
name: string,
ub?: NumericType,
lb?: NumericType,
type?: number
}[],
binaries?: string[],
generals?: string[]
}
interface CLP {
/* direction */
readonly GLP_MIN: number; /* minimization */
readonly GLP_MAX: number; /* maximization */
/* type of auxiliary/structural variable: */
readonly GLP_FR: number; /* free (unbounded) variable */
readonly GLP_LO: number; /* variable with lower bound */
readonly GLP_UP: number; /* variable with upper bound */
readonly GLP_DB: number; /* double-bounded variable */
readonly GLP_FX: number; /* fixed variable */
/* message level: */
// readonly GLP_MSG_OFF: number; /* no output */
// readonly GLP_MSG_ERR: number; /* warning and error messages only */
// readonly GLP_MSG_ON: number; /* normal output */
// readonly GLP_MSG_ALL: number; /* full output */
// readonly GLP_MSG_DBG: number; /* debug output */
/* solution status: */
readonly GLP_UNDEF: number; /* solution is undefined */
readonly GLP_FEAS: number; /* solution is feasible */
readonly GLP_INFEAS: number; /* solution is infeasible */
readonly GLP_NOFEAS: number; /* no feasible solution exists */
readonly GLP_OPT: number; /* solution is optimal */
readonly GLP_UNBND: number; /* solution is unbounded */
version(): Promise<string>;
solve(lp: string, precision: number): Promise<Result>
toLpFormat(lp: LP): Promise<string>; /* Converts LP problem to LP format string */
bnRound(bn: string): Promise<string>; /* rounds a big number from a string */
bnCeil(bn: string): Promise<string>; /* ceil of a big number from a string */
bnFloor(bn: string): Promise<string>; /* floor of a big number from a string */
}
export {
LP,
Result,
CLP
}