Scippy

GCG

Branch-and-Price & Column Generation for Everyone

score_maxwhite.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_maxwhite.cpp
30 * @brief max white score
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_maxwhite.h"
41
42/* score properties */
43#define SCORE_NAME "max white"
44#define SCORE_SHORTNAME "maxwhi"
45#define SCORE_DESC "maximum white area score (white area is nonblock and nonborder area)"
46
47
48/*
49 * Data structures
50 */
51struct GCG_ScoreData
52{
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 scoreFreeMaxwhite NULL
71
72static
73GCG_DECL_SCORECALC(scoreCalcMaxwhite)
74{
75 SCIP_Real borderareascore;
76
78
79 SCIP_Real blockareascore = partialdec->calcBlockAreaScore();
80 borderareascore = partialdec->getScore(GCGconshdlrDecompFindScore(gcg, "border area"));
81
82 SCIP_Real maxwhitescore = blockareascore + borderareascore - 1.;
83
84 if( maxwhitescore < 0. )
85 maxwhitescore = 0.;
86
87 *scorevalue = maxwhitescore;
88
89 return SCIP_OKAY;
90}
91
92
93
94
95/*
96 * score specific interface methods
97 */
98
99/** creates the max white score and includes it in SCIP */
101 GCG* gcg /**< GCG data structure */
102 )
103{
104 GCG_SCOREDATA* scoredata = NULL;
105
106 SCIP_CALL(
108 scoreFreeMaxwhite, scoreCalcMaxwhite) );
109
110 return SCIP_OKAY;
111}
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
SCIP_Real calcBlockAreaScore()
gets an intermediate score value for the blocks of a partialdec
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
static GCG_DECL_SCORECALC(scoreCalcMaxwhite)
#define SCORE_SHORTNAME
#define SCORE_NAME
SCIP_RETCODE GCGincludeScoreMaxwhite(GCG *gcg)
#define SCORE_DESC
#define scoreFreeMaxwhite
max white score
Definition: struct_gcg.h:55
SCIP_OKAY
enum SCIP_Retcode SCIP_RETCODE