1
// Copyright (C) 2005, International Business Machines
2
// Corporation and others. All Rights Reserved.
3
#ifndef CbcBranchLink_H
4
#define CbcBranchLink_H
6
#include "CbcBranchBase.hpp"
8
/** Define Special Linked Ordered Sets.
13
class CbcLink : public CbcObject {
17
// Default Constructor
20
/** Useful constructor - A valid solution is if all variables are zero
21
apart from k*numberLink to (k+1)*numberLink-1 where k is 0 through
22
numberInSet-1. The length of weights array is numberInSet.
23
For this constructor the variables in matrix are the numberInSet*numberLink
24
starting at first. If weights null then 0,1,2..
26
CbcLink (CbcModel * model, int numberMembers,
27
int numberLinks, int first,
28
const double * weights, int setNumber);
29
/** Useful constructor - A valid solution is if all variables are zero
30
apart from k*numberLink to (k+1)*numberLink-1 where k is 0 through
31
numberInSet-1. The length of weights array is numberInSet.
32
For this constructor the variables are given by list - grouped.
33
If weights null then 0,1,2..
35
CbcLink (CbcModel * model, int numberMembers,
36
int numberLinks, int typeSOS, const int * which,
37
const double * weights, int setNumber);
40
CbcLink ( const CbcLink &);
43
virtual CbcObject * clone() const;
45
// Assignment operator
46
CbcLink & operator=( const CbcLink& rhs);
51
/// Infeasibility - large is 0.5
52
virtual double infeasibility(int & preferredWay) const;
54
/// This looks at solution and sets bounds to contain solution
55
virtual void feasibleRegion();
56
/// Creates a branching object
57
virtual CbcBranchingObject * createBranch(int way) ;
60
inline int numberMembers() const
61
{return numberMembers_;}
63
/// Number of links for each member
64
inline int numberLinks() const
65
{return numberLinks_;}
68
inline const int * which() const
71
/** Array of weights */
72
inline const double * weights() const
90
/** Branching object for Special ordered sets
92
Variable_ is the set id number (redundant, as the object also holds a
95
class CbcLinkBranchingObject : public CbcBranchingObject {
99
// Default Constructor
100
CbcLinkBranchingObject ();
102
// Useful constructor
103
CbcLinkBranchingObject (CbcModel * model, const CbcLink * set,
108
CbcLinkBranchingObject ( const CbcLinkBranchingObject &);
110
// Assignment operator
111
CbcLinkBranchingObject & operator=( const CbcLinkBranchingObject& rhs);
114
virtual CbcBranchingObject * clone() const;
117
virtual ~CbcLinkBranchingObject ();
119
/// Does next branch and updates state
120
virtual double branch();
122
/** \brief Print something about branch - only if log level high
124
virtual void print();
125
/** Return the type (an integer identifier) of \c this */
126
virtual int type() const
129
/** Compare the \c this with \c brObj. \c this and \c brObj must be os the
130
same type and must have the same original object, but they may have
131
different feasible regions.
132
Return the appropriate CbcRangeCompare value (first argument being the
133
sub/superset if that's the case). In case of overlap (and if \c
134
replaceIfOverlap is true) replace the current branching object with one
135
whose feasible region is the overlap.
137
virtual CbcRangeCompare compareBranchingObject
138
(const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
141
const CbcLink * set_;