mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 09:28:51 -06:00
Implement component.fit, component.fit_xy
This commit is contained in:
@@ -265,20 +265,16 @@ class KnapsackInstance(Instance):
|
||||
return model
|
||||
|
||||
def get_instance_features(self):
|
||||
return np.array(
|
||||
[
|
||||
self.capacity,
|
||||
np.average(self.weights),
|
||||
]
|
||||
)
|
||||
return [
|
||||
self.capacity,
|
||||
np.average(self.weights),
|
||||
]
|
||||
|
||||
def get_variable_features(self, var, index):
|
||||
return np.array(
|
||||
[
|
||||
self.weights[index],
|
||||
self.prices[index],
|
||||
]
|
||||
)
|
||||
return [
|
||||
self.weights[index],
|
||||
self.prices[index],
|
||||
]
|
||||
|
||||
|
||||
class GurobiKnapsackInstance(KnapsackInstance):
|
||||
|
||||
@@ -129,7 +129,7 @@ class MaxWeightStableSetInstance(Instance):
|
||||
features += neighbor_weights[:5]
|
||||
features += neighbor_degrees[:5]
|
||||
features += [self.graph.degree(index)]
|
||||
return np.array(features)
|
||||
return features
|
||||
|
||||
def get_variable_category(self, var, index):
|
||||
return "default"
|
||||
|
||||
@@ -157,10 +157,10 @@ class TravelingSalesmanInstance(Instance):
|
||||
return model
|
||||
|
||||
def get_instance_features(self):
|
||||
return np.array([1])
|
||||
return [1]
|
||||
|
||||
def get_variable_features(self, var_name, index):
|
||||
return np.array([1])
|
||||
return [1]
|
||||
|
||||
def get_variable_category(self, var_name, index):
|
||||
return index
|
||||
|
||||
Reference in New Issue
Block a user