Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

Constraint handler for knapsack constraints of the form \(a^T x \le b\), x binary and \(a \ge 0\).

Author
Tobias Achterberg
Kati Wolter
Michael Winkler

Definition in file cons_knapsack.h.

#include "scip/def.h"
#include "scip/type_cons.h"
#include "scip/type_lp.h"
#include "scip/type_retcode.h"
#include "scip/type_scip.h"
#include "scip/type_sepa.h"
#include "scip/type_sol.h"
#include "scip/type_var.h"

Go to the source code of this file.

Functions

SCIP_EXPORT SCIP_RETCODE SCIPincludeConshdlrKnapsack (SCIP *scip)
 
Knapsack Constraints

This constraint handler handles a special type of linear constraints, namely knapsack constraints. A knapsack constraint has the form

\[ \sum_{i=1}^n a_i x_i \leq b \]

with non-negative integer coefficients \(a_i\), integer right-hand side \(b\), and binary variables \(x_i\).

SCIP_EXPORT SCIP_RETCODE SCIPcreateConsKnapsack (SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Longint *weights, SCIP_Longint capacity, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
 
SCIP_EXPORT SCIP_RETCODE SCIPcreateConsBasicKnapsack (SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Longint *weights, SCIP_Longint capacity)
 
SCIP_EXPORT SCIP_RETCODE SCIPaddCoefKnapsack (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Longint weight)
 
SCIP_EXPORT SCIP_Longint SCIPgetCapacityKnapsack (SCIP *scip, SCIP_CONS *cons)
 
SCIP_EXPORT SCIP_RETCODE SCIPchgCapacityKnapsack (SCIP *scip, SCIP_CONS *cons, SCIP_Longint capacity)
 
SCIP_EXPORT int SCIPgetNVarsKnapsack (SCIP *scip, SCIP_CONS *cons)
 
SCIP_EXPORT SCIP_VAR ** SCIPgetVarsKnapsack (SCIP *scip, SCIP_CONS *cons)
 
SCIP_EXPORT SCIP_LongintSCIPgetWeightsKnapsack (SCIP *scip, SCIP_CONS *cons)
 
SCIP_EXPORT SCIP_Real SCIPgetDualsolKnapsack (SCIP *scip, SCIP_CONS *cons)
 
SCIP_EXPORT SCIP_Real SCIPgetDualfarkasKnapsack (SCIP *scip, SCIP_CONS *cons)
 
SCIP_EXPORT SCIP_ROWSCIPgetRowKnapsack (SCIP *scip, SCIP_CONS *cons)
 
SCIP_EXPORT SCIP_RETCODE SCIPsolveKnapsackExactly (SCIP *scip, int nitems, SCIP_Longint *weights, SCIP_Real *profits, SCIP_Longint capacity, int *items, int *solitems, int *nonsolitems, int *nsolitems, int *nnonsolitems, SCIP_Real *solval, SCIP_Bool *success)
 
SCIP_EXPORT SCIP_RETCODE SCIPsolveKnapsackApproximately (SCIP *scip, int nitems, SCIP_Longint *weights, SCIP_Real *profits, SCIP_Longint capacity, int *items, int *solitems, int *nonsolitems, int *nsolitems, int *nnonsolitems, SCIP_Real *solval)
 
SCIP_EXPORT SCIP_RETCODE SCIPseparateKnapsackCuts (SCIP *scip, SCIP_CONS *cons, SCIP_SEPA *sepa, SCIP_VAR **vars, int nvars, SCIP_Longint *weights, SCIP_Longint capacity, SCIP_SOL *sol, SCIP_Bool usegubs, SCIP_Bool *cutoff, int *ncuts)
 
SCIP_EXPORT SCIP_RETCODE SCIPseparateRelaxedKnapsack (SCIP *scip, SCIP_CONS *cons, SCIP_SEPA *sepa, int nknapvars, SCIP_VAR **knapvars, SCIP_Real *knapvals, SCIP_Real valscale, SCIP_Real rhs, SCIP_SOL *sol, SCIP_Bool *cutoff, int *ncuts)
 
SCIP_EXPORT SCIP_RETCODE SCIPcleanupConssKnapsack (SCIP *scip, SCIP_Bool onlychecked, SCIP_Bool *infeasible)