All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sol.c
Go to the documentation of this file.
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
80 SCIP_CALL( SCIPboolarraySetVal(sol->valid, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, TRUE) );
83 SCIP_CALL( SCIPrealarraySetVal(sol->vals, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, val) );
87 sol->hasinfval = (sol->hasinfval || SCIPsetIsInfinity(set, val) || SCIPsetIsInfinity(set, -val));
110 /* if the variable was not valid, mark it to be valid and set the value to the incval (it is 0.0 if not valid) */
114 SCIP_CALL( SCIPboolarraySetVal(sol->valid, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, TRUE) );
117 SCIP_CALL( SCIPrealarraySetVal(sol->vals, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, incval) );
122 SCIP_CALL( SCIPrealarrayIncVal(sol->vals, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, incval) );
128 sol->hasinfval = (sol->hasinfval || SCIPsetIsInfinity(set, incval) || SCIPsetIsInfinity(set, -incval));
196 assert(SCIPvarGetStatus(var) == SCIP_VARSTATUS_COLUMN || SCIPvarGetStatus(var) == SCIP_VARSTATUS_LOOSE);
300 /** creates primal CIP solution in original problem space, initialized to the offset in the original problem */
366 /** transformes given original solution to the transformed space; a corresponding transformed solution has to be given
390 /* switch vals and valid arrays; the exisiting solution gets the arrays of the transformed solution;
391 * the transformed one gets the original arrays, because they have to be freed anyway and freeing the transsol
402 * we keep the other statistics of the original solution, since that was the first time that this solution as found
412 /** adjusts solution values of implicit integer variables in handed solution. Solution objective value is not
421 SCIP_Bool uselprows /**< should LP row information be considered for none-objective variables */
462 /* we do not need to round integral solution values or those of variables which are not column variables */
473 /* in case of a non-zero objective coefficient, there is only one possible rounding direction */
740 * use objective values of variables, because columns objective values are changed to dive values
761 /* the objective value in the columns is correct, s.t. the LP's objective value is also correct */
843 /* the objective value in the columns is correct, s.t. the LP's objective value is also correct */
991 SCIPdebugMessage("setting value of <%s> in solution %p to %g\n", SCIPvarGetName(var), (void*)sol, val);
993 /* we want to store only values for non fixed variables (LOOSE or COLUMN); others have to be transformed */
1047 SCIPerrorMessage("cannot set solution value for variable <%s> fixed to %.15g to different value %.15g\n",
1055 assert(!SCIPsetIsInfinity(set, SCIPvarGetAggrConstant(var)) && !SCIPsetIsInfinity(set, -SCIPvarGetAggrConstant(var)));
1056 assert(!SCIPsetIsInfinity(set, SCIPvarGetAggrScalar(var)) && !SCIPsetIsInfinity(set, -SCIPvarGetAggrScalar(var)));
1061 return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetAggrVar(var), SCIPvarGetAggrScalar(var) > 0 ? val : -val);
1063 return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetAggrVar(var), (val - SCIPvarGetAggrConstant(var))/SCIPvarGetAggrScalar(var));
1081 SCIPerrorMessage("cannot set solution value for variable <%s> fixed to %.15g to different value %.15g\n",
1090 return SCIPsolSetVal(sol, set, stat, tree, multaggrvars[0], multaggrscalars[0] > 0 ? val : -val);
1092 return SCIPsolSetVal(sol, set, stat, tree, multaggrvars[0], (val - multaggrconstant)/multaggrscalars[0]);
1099 assert(!SCIPsetIsInfinity(set, SCIPvarGetNegationConstant(var)) && !SCIPsetIsInfinity(set, -SCIPvarGetNegationConstant(var)));
1106 return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetNegationVar(var), SCIPvarGetNegationConstant(var) - val);
1134 SCIPdebugMessage("increasing value of <%s> in solution %p by %g\n", SCIPvarGetName(var), (void*)sol, incval);
1143 /* we want to store only values for non fixed variables (LOOSE or COLUMN); others have to be transformed */
1172 return SCIPsolIncVal(sol, set, stat, tree, SCIPvarGetAggrVar(var), incval/SCIPvarGetAggrScalar(var));
1209 /* if the value of a transformed variable in an original solution is requested, we need to project the variable back
1219 /* we cannot get the value of a transformed variable for a solution that lives in the original problem space
1230 /* the variable has no original counterpart: in the original solution, it has a value of zero */
1237 /* only values for non fixed variables (LOOSE or COLUMN) are stored; others have to be transformed */
1328 /* only values for non fixed variables (LOOSE or COLUMN) are stored; others have to be transformed */
1349 return SCIPvarGetAggrScalar(var) * solval; /* constants are ignored for computing the ray direction */
1407 assert(SCIPvarGetStatus(var) == SCIP_VARSTATUS_LOOSE || SCIPvarGetStatus(var) == SCIP_VARSTATUS_COLUMN);
1438 SCIPdebugMessage("checking solution with objective value %g (nodenum=%"SCIP_LONGINT_FORMAT", origin=%u)\n",
1467 SCIPmessagePrintInfo(messagehdlr, "solution value %g violates bounds of <%s>[%g,%g] by %g\n", solval, SCIPvarGetName(var),
1468 SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var), MAX(lb - solval, 0.0) + MAX(solval - ub, 0.0));
1475 SCIPdebugPrintf(" -> solution value %g violates bounds of <%s>[%g,%g]\n", solval, SCIPvarGetName(var),
1482 /* check whether there are infinite variable values that lead to an objective value of +infinity */
1498 *feasible = *feasible && (!SCIPsetIsInfinity(set, solval) || SCIPsetIsLE(set, SCIPvarGetObj(var), 0.0) );
1499 *feasible = *feasible && (!SCIPsetIsInfinity(set, -solval) || SCIPsetIsGE(set, SCIPvarGetObj(var), 0.0) );
1501 if( printreason && ((SCIPsetIsInfinity(set, solval) && SCIPsetIsGT(set, SCIPvarGetObj(var), 0.0)) ||
1504 SCIPmessagePrintInfo(messagehdlr, "infinite solution value %g for variable <%s> with obj %g implies objective value +infinity\n",
1512 SCIPdebugPrintf("infinite solution value %g for variable <%s> with obj %g implies objective value +infinity\n",
1557 /* round all roundable fractional variables in the corresponding direction as long as no unroundable var was found */
1567 assert(SCIPvarGetStatus(var) == SCIP_VARSTATUS_LOOSE || SCIPvarGetStatus(var) == SCIP_VARSTATUS_COLUMN);
1677 /* This method was a performance bottleneck when retransforming a solution during presolving, before flattening the
1678 * aggregation graph. In that case, calling SCIPsolGetVal() on the original variable consumed too much
1679 * time. Therefore, we now first compute the active representation of each original variable using
1680 * SCIPvarGetActiveRepresentatives(), which is much faster, and sum up the solution values of the active variables by
1688 /* allocate temporary memory for getting the active representation of the original variables, buffering the solution
1713 SCIP_CALL( SCIPvarGetActiveRepresentatives(set, activevars, activevals, &nactivevars, ntransvars + 1, &constant,
1721 assert(0 <= SCIPvarGetProbindex(activevars[i]) && SCIPvarGetProbindex(activevars[i]) < ntransvars);
1722 assert(!SCIPsetIsInfinity(set, -solvals[v]) || !SCIPsetIsInfinity(set, activevals[i] * transsolvals[SCIPvarGetProbindex(activevars[i])]));
1723 assert(!SCIPsetIsInfinity(set, solvals[v]) || !SCIPsetIsInfinity(set, -activevals[i] * transsolvals[SCIPvarGetProbindex(activevars[i])]));
1755 /**@todo remember the variables without original counterpart (priced variables) in the solution */
1823 /* if both solutions are original or both are transformed, take the objective values stored in the solutions */
1829 /* one solution is original and the other not, so we have to get for both the objective in the transformed problem */
1840 /* if one of the solutions is defined in the original space, the comparison has to be performed in the original
1898 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetObj(prob->fixedvars[v]));
1943 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetObj(transprob->fixedvars[v]));
1964 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetObj(transprob->vars[v]));
2007 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetObj(prob->fixedvars[v]));
2051 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetObj(transprob->fixedvars[v]));
2072 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetObj(transprob->vars[v]));
|