Commit 974ad846 authored by jonasseidel's avatar jonasseidel

adding field description to automatically name scip instances when generating computational models

parent 5d350514
......@@ -8,14 +8,13 @@ Linear_Program::Linear_Program(Linear_Program&& lp){
*this = std::move(lp);
}
Linear_Program::Linear_Program(bool maximum) : _maximum(maximum) {}
Linear_Program::Linear_Program(std::string description, bool maximum) : _description(description), _maximum(maximum) {}
Linear_Program::Linear_Program(bool maximum, std::unordered_map<Variable*, Coefficient> direction, Polyeder polyeder)
: _maximum(std::move(maximum)), _direction(std::move(direction)), _polyeder(std::move(polyeder)) {}
Linear_Program::Linear_Program(std::string description, bool maximum, std::unordered_map<Variable*, Coefficient> direction, Polyeder polyeder)
: _description(description), _maximum(std::move(maximum)), _direction(std::move(direction)), _polyeder(std::move(polyeder)) {}
std::string Linear_Program::description(){
// TODO: implement names
return "";
return this->_description;
}
bool Linear_Program::is_maximum(){
......@@ -72,12 +71,14 @@ std::pair<SCIP*, std::unordered_map<Variable*, SCIP_VAR*> > Linear_Program::comp
}
void Linear_Program::operator=(Linear_Program& lp){
this->_description = lp._description;
this->_maximum = lp._maximum;
this->_direction = lp._direction;
this->_polyeder = lp._polyeder;
}
void Linear_Program::operator=(Linear_Program&& lp){
this->_description = lp._description;
this->_maximum = lp._maximum;
this->_direction = std::move(lp._direction);
lp._direction = std::unordered_map<Variable*, Coefficient>();
......@@ -170,7 +171,9 @@ Linear_Program Linear_Program::relaxation_dual(){
direction.insert({variables.unwrap().right.find(index)->second, this->polyeder().constraint(index).rhs()});
}
return Linear_Program(!this->is_maximum(), direction, polyeder);
std::stringstream dual_name;
dual_name << this->description() << "_dual";
return Linear_Program(dual_name.str(), !this->is_maximum(), direction, polyeder);
}
std::ostream& operator<<(std::ostream& os, Linear_Program& linear_program){
......
......@@ -5,6 +5,7 @@
#include <unordered_map>
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <fstream>
#include <iostream>
......@@ -13,20 +14,20 @@
#include <boost/bimap.hpp>
#include <scip/scip.h>
#include <scip/scipdefplugins.h>
#include <scip/debug.h>
#include "Polyeder.h"
#include "../Common/integrality.h"
class Linear_Program{
bool _maximum;
std::string _description;
std::unordered_map<Variable*, Coefficient> _direction;
Polyeder _polyeder;
public:
Linear_Program(Linear_Program& lp);
Linear_Program(Linear_Program&& lp);
Linear_Program(bool maximum);
Linear_Program(bool maximum, std::unordered_map<Variable*, Coefficient> direction, Polyeder polyeder);
Linear_Program(std::string description, bool maximum);
Linear_Program(std::string description, bool maximum, std::unordered_map<Variable*, Coefficient> direction, Polyeder polyeder);
std::string description();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment