GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
score_spfwh.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_spfwh.cpp
30 * @brief setpartitioning maximum foreseeing white area 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_spfwh.h"
41#include "gcg/struct_score.h"
42
43
44/* score properties */
45#define SCORE_NAME "ppc-max-white"
46#define SCORE_SHORTNAME "spfwh"
47#define SCORE_DESC "setpartitioning maximum foreseeing white area score (convex combination of maximum foreseeing white area score and rewarding if master contains only setppc and cardinality constraints)"
48
49
50/*
51 * Data structures
52 */
53struct GCG_ScoreData
54{
55};
56
57/*
58 * Local methods
59 */
60
61/* put your local methods here, and declare them static */
62
63
64
65
66/*
67 * score callback methods
68 */
69
70/** destructor of score to free user data (called when GCG is exiting) */
71#define scoreFreeSpfwh NULL
72
73static
74GCG_DECL_SCORECALC(scoreCalcSpfwh)
75{
76 SCIP_Real maxforeseeingwhitescore = 0;
77
79
80 maxforeseeingwhitescore = partialdec->getScore(GCGconshdlrDecompFindScore(gcg, "max foreseeing white"));
81
82 if( partialdec->hasSetppccardMaster() && !partialdec->isTrivial() && partialdec->getNBlocks() > 1 )
83 {
84 *scorevalue = 0.5 * maxforeseeingwhitescore + 0.5;
85 }
86 else
87 {
88 *scorevalue = 0.5 * maxforeseeingwhitescore;
89 }
90
91 return SCIP_OKAY;
92}
93
94
95
96
97/*
98 * score specific interface methods
99 */
100
101/** creates the setpartitioning maximum foreseeing white area score and includes it in SCIP */
103 GCG* gcg /**< GCG data structure */
104 )
105{
106 GCG_SCOREDATA* scoredata = NULL;
107
108 SCIP_CALL(
110 scoreFreeSpfwh, scoreCalcSpfwh) );
111
112 return SCIP_OKAY;
113}
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
GCG_EXPORT SCIP_RETCODE GCGincludeScore(GCG *gcg, const char *name, const char *shortname, const char *description, GCG_SCOREDATA *scoredata, GCG_DECL_SCOREFREE((*scorefree)),)
creates a score and includes it in GCG
Definition score.c:50
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
#define NULL
#define SCORE_SHORTNAME
#define SCORE_NAME
#define SCORE_DESC
SCIP_RETCODE GCGincludeScoreSpfwh(GCG *gcg)
#define scoreFreeSpfwh
setpartitioning maximum foreseeing white area score
data structures for score
struct Gcg GCG
Definition type_gcg.h:44
enum SCIP_Retcode SCIP_RETCODE
struct GCG_ScoreData GCG_SCOREDATA
Definition type_score.h:46
#define GCG_DECL_SCORECALC(x)
Definition type_score.h:66