Dip
0.95.0
src
UtilKnapsack.h
Go to the documentation of this file.
1
//===========================================================================//
2
// This file is part of the DIP Solver Framework. //
3
// //
4
// DIP is distributed under the Eclipse Public License as part of the //
5
// COIN-OR repository (http://www.coin-or.org). //
6
// //
7
// Authors: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com) //
8
// Ted Ralphs, Lehigh University (ted@lehigh.edu) //
9
// Jiadong Wang, Lehigh University (jiw408@lehigh.edu) //
10
// //
11
// Copyright (C) 2002-2019, Lehigh University, Matthew Galati, Ted Ralphs //
12
// All Rights Reserved. //
13
//===========================================================================//
14
15
#ifndef UTIL_KNAPSACK_INCLUDED
16
#define UTIL_KNAPSACK_INCLUDED
17
18
19
/*==========================================================================*/
20
/* SOR_IntDblArr */
21
/*==========================================================================*/
22
23
typedef
struct
SOR_IntDblT
{
24
int
i
;
25
double
x
;
26
}
SOR_IntDbl
;
27
28
typedef
struct
SOR_IntDblArrT
{
29
SOR_IntDbl
*
arr
;
30
int
len
;
31
int
size
;
32
}
SOR_IntDblArr
;
33
34
typedef
SOR_IntDblArr
SOR_IntDblArr
;
35
typedef
SOR_IntDblArr
*
SOR_IntDblArrPtr
;
36
37
SOR_IntDblArrPtr
SOR_IntDblArrNew
(
int
size,
38
int
* pstatus);
39
void
SOR_IntDblSwap
(
SOR_IntDbl
* A,
40
SOR_IntDbl
* B);
41
void
SOR_IntDblArrPrint
(
const
SOR_IntDblArr
* A);
42
void
SOR_IntDblArrFree
(
SOR_IntDblArrPtr
* A);
43
44
45
void
KnapsackSortRatioOut
(
const
int
n,
46
const
double
* p,
47
const
double
* w,
48
double
* psort,
49
double
* wsort,
50
SOR_IntDbl
* ratio);
51
int
KnapsackOptimizeHS
(
const
int
n,
52
const
double
c,
53
double
* p,
54
double
* w,
55
int
* x,
56
double
* z,
57
int
* pstatus);
58
59
60
61
#endif
SOR_IntDblT::x
double x
Definition:
UtilKnapsack.h:25
SOR_IntDblT::i
int i
Definition:
UtilKnapsack.h:24
SOR_IntDblArrT::len
int len
Definition:
UtilKnapsack.h:30
KnapsackSortRatioOut
void KnapsackSortRatioOut(const int n, const double *p, const double *w, double *psort, double *wsort, SOR_IntDbl *ratio)
KnapsackOptimizeHS
int KnapsackOptimizeHS(const int n, const double c, double *p, double *w, int *x, double *z, int *pstatus)
SOR_IntDblArrFree
void SOR_IntDblArrFree(SOR_IntDblArrPtr *A)
SOR_IntDblArrT
Definition:
UtilKnapsack.h:28
SOR_IntDblT
Definition:
UtilKnapsack.h:23
SOR_IntDblArrNew
SOR_IntDblArrPtr SOR_IntDblArrNew(int size, int *pstatus)
SOR_IntDblArrT::size
int size
Definition:
UtilKnapsack.h:31
SOR_IntDblArr
struct SOR_IntDblArrT SOR_IntDblArr
Definition:
UtilKnapsack.h:34
SOR_IntDbl
struct SOR_IntDblT SOR_IntDbl
SOR_IntDblArrPtr
SOR_IntDblArr * SOR_IntDblArrPtr
Definition:
UtilKnapsack.h:35
SOR_IntDblArrPrint
void SOR_IntDblArrPrint(const SOR_IntDblArr *A)
SOR_IntDblArrT::arr
SOR_IntDbl * arr
Definition:
UtilKnapsack.h:29
SOR_IntDblSwap
void SOR_IntDblSwap(SOR_IntDbl *A, SOR_IntDbl *B)
Generated by
1.8.17