Scippy

GCG

Branch-and-Price & Column Generation for Everyone

score_spfawh.cpp
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* GCG --- Generic Column Generation */
5/* a Dantzig-Wolfe decomposition based extension */
6/* of the branch-cut-and-price framework */
7/* SCIP --- Solving Constraint Integer Programs */
8/* */
9/* Copyright (C) 2010-2026 Operations Research, RWTH Aachen University */
10/* Zuse Institute Berlin (ZIB) */
11/* */
12/* Licensed under the Apache License, Version 2.0 (the "License"); */
13/* you may not use this file except in compliance with the License. */
14/* You may obtain a copy of the License at */
15/* */
16/* http://www.apache.org/licenses/LICENSE-2.0 */
17/* */
18/* Unless required by applicable law or agreed to in writing, software */
19/* distributed under the License is distributed on an "AS IS" BASIS, */
20/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
21/* See the License for the specific language governing permissions and */
22/* limitations under the License. */
23/* */
24/* You should have received a copy of the Apache-2.0 license */
25/* along with GCG; see the file LICENSE. If not visit gcg.or.rwth-aachen.de.*/
26/* */
27/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
28
29/**@file score_spfawh.cpp
30 * @brief setpartitioning maximum foreseeing white area score with aggregation information
31 * @author Jurgen Lentz
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
38#include "gcg/cons_decomp.h"
39#include "gcg/cons_decomp.hpp"
40#include "gcg/score_spfawh.h"
41
42
43/* score properties */
44#define SCORE_NAME "ppc-max-white with aggregation info"
45#define SCORE_SHORTNAME "spfawh"
46#define SCORE_DESC "setpartitioning maximum foreseeing white area score with aggregation information (convex combination of maximum foreseeing white area score and rewarding if a master contains only setppc and cardinality constraints)"
47
48
49/*
50 * Data structures
51 */
52struct GCG_ScoreData
53{
54};
55
56/*
57 * Local methods
58 */
59
60/* put your local methods here, and declare them static */
61
62
63
64
65/*
66 * score callback methods
67 */
68
69/** destructor of score to free user data (called when GCG is exiting) */
70#define scoreFreeSpfawh NULL
71
72static
73GCG_DECL_SCORECALC(scoreCalcSpfawh)
74{
75 SCIP_Real maxforeseeingwhitescoreagg = 0;
76
78
79 maxforeseeingwhitescoreagg = partialdec->getScore(GCGconshdlrDecompFindScore(gcg, "max foreseeing white with aggregation info"));
80
81 if( partialdec->hasSetppccardMaster() && !partialdec->isTrivial() && partialdec->getNBlocks() > 1 )
82 {
83 *scorevalue = 0.5 * maxforeseeingwhitescoreagg + 0.5;
84 }
85 else
86 {
87 *scorevalue = 0.5 * maxforeseeingwhitescoreagg;
88 }
89
90 return SCIP_OKAY;
91}
92
93
94
95
96/*
97 * score specific interface methods
98 */
99
100/** creates the setpartitioning maximum foreseeing white area score with aggregation information score and includes it in SCIP */
102 GCG* gcg /**< GCG data structure */
103 )
104{
105 GCG_SCOREDATA* scoredata = NULL;
106
107 SCIP_CALL(
109 scoreFreeSpfawh, scoreCalcSpfawh) );
110
111 return SCIP_OKAY;
112}
class storing partialdecs and the problem matrix
class storing (potentially incomplete) decompositions
class to manage partial decompositions
GCG_EXPORT SCIP_Real getScore(GCG_SCORE *score)
returns the score of the partialdec
GCG_EXPORT SCIP_Bool hasSetppccardMaster()
checks if all master constraints set partitioning, set packing, set cover, or cardinality constraints
GCG_EXPORT bool isTrivial()
Gets whether this partialdec is considered to be trivial.
GCG_EXPORT int getNBlocks()
Gets the number of blocks.
GCG_SCORE * GCGconshdlrDecompFindScore(GCG *gcg, const char *name)
searches for the score with the given name and returns it or NULL if score is not found
PARTIALDECOMP * GCGconshdlrDecompGetPartialdecFromID(GCG *gcg, int partialdecid)
local method to find a partialdec for a given id or NULL if no partialdec with such id is found
constraint handler for structure detection
C++ interface of cons_decomp.
#define SCIP_Real
#define SCIP_CALL(x)
GCG_EXPORT SCIP_RETCODE GCGincludeScore(GCG *gcg, const char *name, const char *shortname, const char *description, GCG_SCOREDATA *scoredata, GCG_DECL_SCOREFREE((*scorefree)), GCG_DECL_SCORECALC((*scorecalc)))
creates a score and includes it in GCG
Definition: score.c:50
#define NULL
#define SCORE_SHORTNAME
#define SCORE_NAME
SCIP_RETCODE GCGincludeScoreSpfawh(GCG *gcg)
static GCG_DECL_SCORECALC(scoreCalcSpfawh)
#define SCORE_DESC
#define scoreFreeSpfawh
setpartitioning maximum foreseeing white area score with aggregation information score
Definition: struct_gcg.h:55
SCIP_OKAY
enum SCIP_Retcode SCIP_RETCODE